PaymentPlanModule.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="payment-plan-module">
  3. <TableCard
  4. :tableData="paymentPlanList"
  5. :columns="[
  6. {label: '序号', prop: 'code', width: '280'},
  7. {label: '预计回款时间', prop: 'time'},
  8. {label: '预计回款金额', prop: 'money'}
  9. ]"
  10. :width="'1108px'"
  11. :cellClass="'payment-plan-content-table'"
  12. >
  13. <template v-slot:money="{row}">
  14. <span>¥{{ formatNumber(row.row.money) }}</span>
  15. </template>
  16. </TableCard>
  17. </div>
  18. </template>
  19. <script>
  20. import TableCard from '../../ui/TableCard.vue'
  21. import { mapState } from 'vuex'
  22. export default {
  23. name: 'PaymentPlanModule',
  24. components: {
  25. TableCard
  26. },
  27. data() {
  28. return {
  29. paymentPlanList: [
  30. {"code":1,"money":999,"time":"2025-04-22"},
  31. {"code":2,"money":7000,"time":"2025-04-23"},
  32. {"code":"合计","money":7999,"time":"-"}
  33. ],
  34. returnMoneyPlant: {}
  35. }
  36. },
  37. mounted() {
  38. this.getPaymentPlanList()
  39. },
  40. computed: {
  41. ...mapState({
  42. orderDetail: state => state.order.orderDetail
  43. })
  44. },
  45. methods: {
  46. getPaymentPlanList() {
  47. this.returnMoneyPlant = this.orderDetail?.returnMoneyPlant || {};
  48. const listMap = this.orderDetail?.returnMoneyPlant?.list || {};
  49. let plantList = listMap.plantList;
  50. if (!plantList) {
  51. this.paymentPlanList = [];
  52. return;
  53. }
  54. try {
  55. plantList = JSON.parse(plantList);
  56. } catch (error) {
  57. console.error('Failed to parse plantList JSON:', error);
  58. plantList = [];
  59. }
  60. this.paymentPlanList = Array.isArray(plantList) ? plantList : [];
  61. },
  62. setState(state) {
  63. this.paymentPlanList = state;
  64. },
  65. formatNumber(num, x = 2) {
  66. return (num / 100).toFixed(x)
  67. }
  68. }
  69. }
  70. </script>