Forráskód Böngészése

修复在page3获取和保存不在receiptform的问题

Yannay 4 hét óta
szülő
commit
4c85e17308
1 módosított fájl, 26 hozzáadás és 34 törlés
  1. 26 34
      pages/orderDetailRefactored/components/PageThree.vue

+ 26 - 34
pages/orderDetailRefactored/components/PageThree.vue

@@ -257,23 +257,17 @@ export default {
257
     }
257
     }
258
   },
258
   },
259
   watch: {
259
   watch: {
260
-    orderDetail: {
261
-      handler(newVal) {
260
+    // 支付信息已保存到 receiptForm,不再从 orderDetail(sendForm) 读取
261
+    currentReceipt: {
262
+      handler(newVal, oldVal) {
262
         if (newVal) {
263
         if (newVal) {
264
+          this.paymentAmount = newVal.tableFee || '0.00'
265
+          // 从回单表 receiptForm 回填支付信息(与 PC 端一致)
263
           this.paymentInfo.customName = newVal.customName || ''
266
           this.paymentInfo.customName = newVal.customName || ''
264
           this.paymentInfo.bankName = newVal.bankName || ''
267
           this.paymentInfo.bankName = newVal.bankName || ''
265
           this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
268
           this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
266
           this.paymentInfo.idNumber = newVal.idCard || ''
269
           this.paymentInfo.idNumber = newVal.idCard || ''
267
           this.initPaymentMethod(newVal.paymentMethod)
270
           this.initPaymentMethod(newVal.paymentMethod)
268
-        }
269
-      },
270
-      deep: true,
271
-      immediate: true
272
-    },
273
-    currentReceipt: {
274
-      handler(newVal, oldVal) {
275
-        if (newVal) {
276
-          this.paymentAmount = newVal.tableFee || '0.00'
277
           // 只有当 receipt id 变化时才重新加载图片,避免 fileIds 更新时重新加载
271
           // 只有当 receipt id 变化时才重新加载图片,避免 fileIds 更新时重新加载
278
           if (!oldVal || oldVal.id !== newVal.id) {
272
           if (!oldVal || oldVal.id !== newVal.id) {
279
             this.loadDetailImages()
273
             this.loadDetailImages()
@@ -607,20 +601,16 @@ export default {
607
      * 立即支付点击
601
      * 立即支付点击
608
      */
602
      */
609
     async handlePayNowClick() {
603
     async handlePayNowClick() {
610
-      // 保存支付信息
604
+      // 与 PC 端一致:支付信息通过 updateReceiptForm 保存;后端需 sendFormId 才能更新发单表的开户人/银行/身份证等
611
       await uni.$u.api.updateReceiptForm({
605
       await uni.$u.api.updateReceiptForm({
612
         id: this.currentReceipt.id,
606
         id: this.currentReceipt.id,
607
+        sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
613
         tableFee: this.paymentAmount,
608
         tableFee: this.paymentAmount,
614
-        fileIds: this.detailImages.map(item => item.id).join(',')
615
-      })
616
-
617
-      await uni.$u.api.updateClueOrderForm({
618
-        id: this.orderDetail.id,
609
+        fileIds: this.detailImages.map(item => item.id).join(','),
619
         customName: this.paymentInfo.customName || '',
610
         customName: this.paymentInfo.customName || '',
620
         bankName: this.paymentInfo.bankName || '',
611
         bankName: this.paymentInfo.bankName || '',
621
         bankCardNumber: this.paymentInfo.bankAccount || '',
612
         bankCardNumber: this.paymentInfo.bankAccount || '',
622
-        idCard: this.paymentInfo.idNumber || '',
623
-        // paymentMethod: this.paymentMethod || ''
613
+        idCard: this.paymentInfo.idNumber || ''
624
       })
614
       })
625
 
615
 
626
       if (!this.paymentInfo.customName || !this.paymentInfo.bankName ||
616
       if (!this.paymentInfo.customName || !this.paymentInfo.bankName ||
@@ -639,10 +629,11 @@ export default {
639
         return
629
         return
640
       }
630
       }
641
 
631
 
642
-      // 线下支付:不弹确认框,直接更新支付方式并进入下一步
632
+      // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
643
       if (this.paymentMethodRadio === 'offline') {
633
       if (this.paymentMethodRadio === 'offline') {
644
-        await uni.$u.api.updateClueOrderForm({
645
-          id: this.orderDetail.id,
634
+        await uni.$u.api.updateReceiptForm({
635
+          id: this.currentReceipt.id,
636
+          sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
646
           paymentMethod: this.paymentMethod || ''
637
           paymentMethod: this.paymentMethod || ''
647
         })
638
         })
648
         this.handleNext()
639
         this.handleNext()
@@ -657,10 +648,11 @@ export default {
657
      */
648
      */
658
     async confirmRiskWarning() {
649
     async confirmRiskWarning() {
659
       this.riskWarningModalVisible = false
650
       this.riskWarningModalVisible = false
660
-      // 线下支付:不弹确认框,直接更新支付方式并进入下一步
651
+      // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
661
       if (this.paymentMethodRadio === 'offline') {
652
       if (this.paymentMethodRadio === 'offline') {
662
-        await uni.$u.api.updateClueOrderForm({
663
-          id: this.orderDetail.id,
653
+        await uni.$u.api.updateReceiptForm({
654
+          id: this.currentReceipt.id,
655
+          sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
664
           paymentMethod: this.paymentMethod || ''
656
           paymentMethod: this.paymentMethod || ''
665
         })
657
         })
666
         this.handleNext()
658
         this.handleNext()
@@ -674,9 +666,10 @@ export default {
674
      */
666
      */
675
     async confirmTransfer() {
667
     async confirmTransfer() {
676
       this.payNowModalVisible = false
668
       this.payNowModalVisible = false
677
-
678
-      await uni.$u.api.updateClueOrderForm({
679
-        id: this.orderDetail.id,
669
+      // 支付方式保存(后端需 sendFormId 更新发单表)
670
+      await uni.$u.api.updateReceiptForm({
671
+        id: this.currentReceipt.id,
672
+        sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
680
         paymentMethod: this.paymentMethod || ''
673
         paymentMethod: this.paymentMethod || ''
681
       })
674
       })
682
       // 根据 radio 选择判断:线上支付(online / online_alipay)需调用支付接口,线下则直接下一步
675
       // 根据 radio 选择判断:线上支付(online / online_alipay)需调用支付接口,线下则直接下一步
@@ -740,18 +733,17 @@ export default {
740
      * 下一步
733
      * 下一步
741
      */
734
      */
742
     async handleNext() {
735
     async handleNext() {
736
+      // 与 PC 端一致:支付信息通过 updateReceiptForm 保存;后端需 sendFormId 才能更新发单表的开户人/银行/身份证等
743
       await uni.$u.api.updateReceiptForm({
737
       await uni.$u.api.updateReceiptForm({
744
         id: this.currentReceipt.id,
738
         id: this.currentReceipt.id,
739
+        sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
745
         tableFee: this.paymentAmount,
740
         tableFee: this.paymentAmount,
746
-        fileIds: this.detailImages.map(item => item.id).join(',')
747
-      })
748
-
749
-      await uni.$u.api.updateClueOrderForm({
750
-        id: this.orderDetail.id,
741
+        fileIds: this.detailImages.map(item => item.id).join(','),
751
         customName: this.paymentInfo.customName || '',
742
         customName: this.paymentInfo.customName || '',
752
         bankName: this.paymentInfo.bankName || '',
743
         bankName: this.paymentInfo.bankName || '',
753
         bankCardNumber: this.paymentInfo.bankAccount || '',
744
         bankCardNumber: this.paymentInfo.bankAccount || '',
754
-        idCard: this.paymentInfo.idNumber || ''
745
+        idCard: this.paymentInfo.idNumber || '',
746
+        // paymentMethod: this.paymentMethod || ''
755
       })
747
       })
756
 
748
 
757
       this.$emit('save', {
749
       this.$emit('save', {