PaymentPlan.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div class="payment-plan">
  3. <InfoCard>
  4. <template #title>
  5. <span>回款计划</span>
  6. <span style="font-size: 14px;line-height: 22px;">
  7. (共<span class="num-active"> {{ paymentPlanList.length }} </span>条
  8. <span>预计回款</span>
  9. <span class="num-active"> ¥{{ formatNumber(returnMoneyPlant?.plantMoney || 0) }} </span>
  10. <span> 实际回款</span>
  11. <span class="num-active"> ¥{{ formatNumber(returnMoneyPlant?.returnMoney || 0) }} </span>)
  12. </span>
  13. </template>
  14. <div class="payment-plan-content">
  15. <paymentPlanModule :orderDetail="orderDetail"></paymentPlanModule>
  16. </div>
  17. </InfoCard>
  18. </div>
  19. </template>
  20. <script>
  21. import InfoCard from '../../ui/InfoCard.vue'
  22. import paymentPlanModule from './PaymentPlanModule.vue';
  23. import { mapState } from 'vuex';
  24. export default {
  25. name: 'PaymentPlan',
  26. components: {
  27. InfoCard,
  28. paymentPlanModule
  29. },
  30. data() {
  31. return {
  32. paymentPlanList: [],
  33. returnMoneyPlant: {}
  34. }
  35. },
  36. computed: {
  37. ...mapState({
  38. orderDetail: state => state.order.orderDetail
  39. })
  40. },
  41. watch: {
  42. orderDetail: {
  43. deep: true,
  44. handler() {
  45. this.$nextTick(() => {
  46. this.getPaymentPlanList()
  47. })
  48. }
  49. }
  50. },
  51. mounted() {
  52. this.getPaymentPlanList()
  53. },
  54. methods: {
  55. getPaymentPlanList() {
  56. this.returnMoneyPlant = this.orderDetail?.returnMoneyPlant || {};
  57. const listMap = this.orderDetail?.returnMoneyPlant?.list || {};
  58. let plantList = listMap.plantList;
  59. if (!plantList) {
  60. this.paymentPlanList = [];
  61. return;
  62. }
  63. try {
  64. plantList = JSON.parse(plantList);
  65. } catch (error) {
  66. console.error('Failed to parse plantList JSON:', error);
  67. plantList = [];
  68. }
  69. this.paymentPlanList = Array.isArray(plantList) ? plantList : [];
  70. },
  71. formatNumber(num, x = 2) {
  72. return (num / 100).toFixed(x)
  73. }
  74. }
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. .payment-plan {
  79. .payment-plan-content-table {
  80. border-radius: 4px;
  81. }
  82. .num-active {
  83. color: $color_main;
  84. }
  85. }
  86. </style>