Bladeren bron

增加支付接口

Yannay 2 maanden geleden
bovenliggende
commit
737e6cfc6b

+ 30 - 37
pages/orderDetailNew/components/orderDetailNewView.vue

@@ -9,7 +9,7 @@
9 9
         </view>
10 10
         <view class="page-item" v-show="activeIndex === 2">
11 11
             <pageThree @handleNextClick="handleNextClick" :orderDetail="detail" @handleNeedSave="handleNeedSave"
12
-                ref="pageThreeComp" :orderId="orderId" />
12
+                @handleConfirmPay="handleConfirmPay" ref="pageThreeComp" :orderId="orderId" />
13 13
         </view>
14 14
         <view class="page-item" v-show="activeIndex === 3">
15 15
             <pageFour @handleNextClick="handleNextClick" :orderDetail="detail" />
@@ -58,7 +58,8 @@ export default {
58 58
                 formThree: {},
59 59
                 formFour: {},
60 60
             },
61
-            pageThreeForm: {}
61
+            pageThreeForm: {},
62
+            fileIds: ''
62 63
         }
63 64
     },
64 65
     name: 'OrderDetailNewView',
@@ -72,9 +73,20 @@ export default {
72 73
                 this.$refs.pageThreeComp.getList('2', '3');
73 74
             }
74 75
         },
75
-        // 支付前保存数据
76
-        async saveData() {
77
-            await uni.$u.api.addReceiptForm({
76
+        // 没有recepitid就新增
77
+        async saveData(params) {
78
+            await uni.$u.api.addReceiptForm(params);
79
+        },
80
+        // 有recepitid就更新
81
+        async updateData(params) {
82
+            await uni.$u.api.updateReceiptForm(params);
83
+        },
84
+
85
+        handleNeedSave({ nowPage, form, fileIds }) {
86
+            this.pageThreeForm = form;
87
+            this.fileIds = fileIds;
88
+
89
+            const params = {
78 90
                 "searchValue": this.detail.searchValue,
79 91
                 "createBy": this.detail.createBy,
80 92
                 "createTime": this.detail.createTime,
@@ -102,7 +114,7 @@ export default {
102 114
                 // "repairAmount": null, //维修总金额 ,先不传
103 115
                 // "grossPerformance": "7443.00",   //毛利 performance*splitRatio
104 116
                 // "expressOrderNo": null,   //快递单号+后续加上一个键加上图url
105
-                // "fileIds": "",  //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
117
+                "fileIds": this.fileIds,  //传第三部里面排序完成之后的id的数组,参考编辑收单里面的附件传的方法
106 118
                 "model": this.detail.model,
107 119
                 // "splitRatio": "25",   //分成比例,先不传
108 120
                 "customerServiceName": "1", //默认传1,判断入库的类型,回收类入库,销售类入库,维保类入库,第四步传,增加选项下拉
@@ -114,38 +126,18 @@ export default {
114 126
                 "bankCardNumber": this.pageThreeForm.bankAccount,
115 127
                 "bankName": this.pageThreeForm.bankName,
116 128
                 "customName": this.pageThreeForm.customName,
117
-            });
118
-        },
119
-        // 保存实物图数据
120
-        saveDetailImagesData() {
121
-            // 上传二进制文件
122
-            // console.log("上传文件成功:1", this.allFroms.formOne.truePic)
123
-
124
-            // this.allFroms.formOne.truePic.forEach(async (item) => {
125
-            //     const res = await uni.$u.api.uploadFile(item);
126
-            //     console.log("上传文件成功:", res)
127
-            // })
128
-        },
129
-        // // 保存聊天图数据
130
-        // saveChatPicData() {
131
-        //     this.allFroms.formOne.truePic.forEach(async (item) => {
132
-        //         await uni.$u.api.uploadFile(item);
133
-        //     })
134
-        // },
135
-        // // 保存高清图数据
136
-        // saveHighDefinitionPicData() {
137
-        //     this.allFroms.formOne.truePic.forEach(async (item) => {
138
-        //         await uni.$u.api.uploadFile(item);
139
-        //     })
140
-        // },
141
-        handleNeedSave({ nowPage, form }) {
142
-            this.pageThreeForm = form;
129
+            }
143 130
 
144 131
             //调用接口保存收单表单
145
-            this.saveData();
146
-            // this.saveDetailImagesData();
147
-
148
-            //保存数据之后调支付接口
132
+            if (this.detail.receiptId) {
133
+                this.updateData(params);
134
+            } else {
135
+                this.saveData(params);
136
+            }
137
+        },
138
+        // 确认支付
139
+        handleConfirmPay() {
140
+            // 调用支付接口
149 141
             this.pay();
150 142
         },
151 143
         //支付
@@ -162,7 +154,8 @@ export default {
162 154
                 uni.$u.toast(`支付失败:${response.msg}`)
163 155
             }
164 156
         },
165
-    }
157
+    },
158
+
166 159
 }
167 160
 
168 161
 

+ 8 - 5
pages/orderDetailNew/components/pageThree.vue

@@ -268,12 +268,12 @@ export default {
268 268
             // 执行元素交换
269 269
             if (this.canDropIndex !== -1 && this.canDropIndex !== this.draggingIndex) {
270 270
                 // 交换元素位置
271
-                const temp = this.localDetailImages[this.draggingIndex];
272
-                this.localDetailImages[this.draggingIndex] = this.localDetailImages[this.canDropIndex];
273
-                this.localDetailImages[this.canDropIndex] = temp;
271
+                const temp = this.detailImages[this.draggingIndex];
272
+                this.detailImages[this.draggingIndex] = this.detailImages[this.canDropIndex];
273
+                this.detailImages[this.canDropIndex] = temp;
274 274
 
275 275
                 // Update position properties after swap
276
-                this.localDetailImages.forEach((item, index) => {
276
+                this.detailImages.forEach((item, index) => {
277 277
                     item.position = index + 1;
278 278
                 });
279 279
             }
@@ -342,6 +342,7 @@ export default {
342 342
 
343 343
             //让父组件保存数据
344 344
             this.$emit('handleNeedSave', {
345
+                fileIds: this.detailImages.map(item => item.id).join(','),
345 346
                 nowPage: 'formThree',
346 347
                 form: {
347 348
                     ...this.paymentInfo,
@@ -369,10 +370,12 @@ export default {
369 370
             console.log('确认转账');
370 371
             this.payNowModelShow = false;
371 372
             // 可以在这里添加转账确认的逻辑
373
+
374
+            this.$emit('handleConfirmPay');
372 375
         },
373 376
         // 下一步按钮点击事件
374 377
         handleNextClick() {
375
-            console.log('page3点击了下一步按钮', this.localDetailImages);
378
+            console.log('page3点击了下一步按钮', this.detailImages);
376 379
             this.$emit('handleNextClick', {
377 380
                 nowPage: 'formThree',
378 381
                 form: {