Selaa lähdekoodia

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

Yannay 4 viikkoa sitten
vanhempi
commit
4c85e17308
1 muutettua tiedostoa jossa 26 lisäystä ja 34 poistoa
  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 259
   watch: {
260
-    orderDetail: {
261
-      handler(newVal) {
260
+    // 支付信息已保存到 receiptForm,不再从 orderDetail(sendForm) 读取
261
+    currentReceipt: {
262
+      handler(newVal, oldVal) {
262 263
         if (newVal) {
264
+          this.paymentAmount = newVal.tableFee || '0.00'
265
+          // 从回单表 receiptForm 回填支付信息(与 PC 端一致)
263 266
           this.paymentInfo.customName = newVal.customName || ''
264 267
           this.paymentInfo.bankName = newVal.bankName || ''
265 268
           this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
266 269
           this.paymentInfo.idNumber = newVal.idCard || ''
267 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 271
           // 只有当 receipt id 变化时才重新加载图片,避免 fileIds 更新时重新加载
278 272
           if (!oldVal || oldVal.id !== newVal.id) {
279 273
             this.loadDetailImages()
@@ -607,20 +601,16 @@ export default {
607 601
      * 立即支付点击
608 602
      */
609 603
     async handlePayNowClick() {
610
-      // 保存支付信息
604
+      // 与 PC 端一致:支付信息通过 updateReceiptForm 保存;后端需 sendFormId 才能更新发单表的开户人/银行/身份证等
611 605
       await uni.$u.api.updateReceiptForm({
612 606
         id: this.currentReceipt.id,
607
+        sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
613 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 610
         customName: this.paymentInfo.customName || '',
620 611
         bankName: this.paymentInfo.bankName || '',
621 612
         bankCardNumber: this.paymentInfo.bankAccount || '',
622
-        idCard: this.paymentInfo.idNumber || '',
623
-        // paymentMethod: this.paymentMethod || ''
613
+        idCard: this.paymentInfo.idNumber || ''
624 614
       })
625 615
 
626 616
       if (!this.paymentInfo.customName || !this.paymentInfo.bankName ||
@@ -639,10 +629,11 @@ export default {
639 629
         return
640 630
       }
641 631
 
642
-      // 线下支付:不弹确认框,直接更新支付方式并进入下一步
632
+      // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
643 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 637
           paymentMethod: this.paymentMethod || ''
647 638
         })
648 639
         this.handleNext()
@@ -657,10 +648,11 @@ export default {
657 648
      */
658 649
     async confirmRiskWarning() {
659 650
       this.riskWarningModalVisible = false
660
-      // 线下支付:不弹确认框,直接更新支付方式并进入下一步
651
+      // 线下支付:不弹确认框,直接更新支付方式并进入下一步(后端需 sendFormId 更新发单表支付方式)
661 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 656
           paymentMethod: this.paymentMethod || ''
665 657
         })
666 658
         this.handleNext()
@@ -674,9 +666,10 @@ export default {
674 666
      */
675 667
     async confirmTransfer() {
676 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 673
         paymentMethod: this.paymentMethod || ''
681 674
       })
682 675
       // 根据 radio 选择判断:线上支付(online / online_alipay)需调用支付接口,线下则直接下一步
@@ -740,18 +733,17 @@ export default {
740 733
      * 下一步
741 734
      */
742 735
     async handleNext() {
736
+      // 与 PC 端一致:支付信息通过 updateReceiptForm 保存;后端需 sendFormId 才能更新发单表的开户人/银行/身份证等
743 737
       await uni.$u.api.updateReceiptForm({
744 738
         id: this.currentReceipt.id,
739
+        sendFormId: this.currentReceipt.sendFormId || this.orderDetail.id,
745 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 742
         customName: this.paymentInfo.customName || '',
752 743
         bankName: this.paymentInfo.bankName || '',
753 744
         bankCardNumber: this.paymentInfo.bankAccount || '',
754
-        idCard: this.paymentInfo.idNumber || ''
745
+        idCard: this.paymentInfo.idNumber || '',
746
+        // paymentMethod: this.paymentMethod || ''
755 747
       })
756 748
 
757 749
       this.$emit('save', {