Przeglądaj źródła

API前置判断

beibo 5 miesięcy temu
rodzic
commit
fabef7e43a

+ 15 - 0
components/activity/sku.js

@@ -672,6 +672,13 @@ Component({
672 672
     },
673 673
 
674 674
     toBuy(type) {
675
+      // 判断当前API是否正在调用
676
+      if (this.data.APILoading) {
677
+        return
678
+      }
679
+      this.setData({
680
+        APILoading: true
681
+      })
675 682
       // console.log(this.data, 89898)
676 683
       let that = this,
677 684
         sessionContent = {} //选择的套餐
@@ -768,6 +775,10 @@ Component({
768 775
           life_trade_flag: 0 // 0:非融合链路(默认值)  1:走融合链路(标准融合/完全融合)
769 776
         }, // 透传数据,开发者自定义字段 非必传
770 777
         success: (res) => {
778
+          // 重置调用状态
779
+          that.setData({
780
+            APILoading: false
781
+          })
771 782
           const {
772 783
             orderId,
773 784
             outOrderNo
@@ -779,6 +790,10 @@ Component({
779 790
           console.log("orderId888888", orderId, "outOrderNo", outOrderNo, );
780 791
         },
781 792
         fail: (res) => {
793
+          // 重置调用状态
794
+          that.setData({
795
+            APILoading: false
796
+          })
782 797
           const {
783 798
             orderId,
784 799
             outOrderNo,

+ 1 - 1
pages/order/detail/index.ttml

@@ -265,7 +265,7 @@
265 265
         <view class="sub-order-item">
266 266
           <block tt:if="{{item.status == 3&&item.statusDesc!='处理中'}}">待支付</block>
267 267
           <!-- <block tt:elif="{{item.statusDesc=='处理中'}}">支付结果确认中</block> -->
268
-          <block tt:elif="{{item.status == 1&&item.statusDesc=='处理中'}}">支付结果确认中</block>
268
+          <block tt:elif="{{item.status !=6&&item.statusDesc=='处理中'}}">支付结果确认中</block>
269 269
           <block tt:else>
270 270
             <text class="red">{{item.password}} </text><text class="qrCode"></text>
271 271
           </block>

+ 15 - 0
pages/order/index/order.js

@@ -181,14 +181,29 @@ Page({
181 181
   },
182 182
   // 立即支付(支付尾款) --待付款状态
183 183
   pay(e) {
184
+    // 判断当前API是否正在调用
185
+    if (this.data.APILoading) {
186
+      return
187
+    }
188
+    this.setData({
189
+      APILoading: true
190
+    })
184 191
     let that = this;
185 192
     console.log(e, '付款');
186 193
     util.TTPay(e.target.dataset.outtradeno)
187 194
       .then(res => {
195
+        // 重置调用状态
196
+        that.setData({
197
+          APILoading: false
198
+        })
188 199
         that.stat();
189 200
         that.getList(false);
190 201
       })
191 202
       .catch(err => {
203
+        // 重置调用状态
204
+        that.setData({
205
+          APILoading: false
206
+        })
192 207
         if (err.errNo != 4) {
193 208
           util.showTips(err.errMsg);
194 209
         }

+ 14 - 1
pages/order/refund/refund.js

@@ -460,6 +460,13 @@ Page({
460 460
     });
461 461
   },
462 462
   refundRequest() {
463
+    // 判断当前API是否正在调用
464
+    if (this.data.APILoading) {
465
+      return
466
+    }
467
+    this.setData({
468
+      APILoading: true
469
+    })
463 470
     let that = this,
464 471
       current = this.data.current;
465 472
     console.log(current, 78787);
@@ -493,15 +500,21 @@ Page({
493 500
             oid: that.data.oid,
494 501
           }, // 透传数据,开发者自定义字段 非必传
495 502
           success: successRes => {
503
+            // 重置调用状态
496 504
             that.setData({
505
+              APILoading: false,
497 506
               mask: true
498
-            });
507
+            })
499 508
             console.log('申请退款成功', successRes, '参数',
500 509
               'itemOrderId:', res.data.itemOrderList[0].itemOrderId,
501 510
               'reason:', that.data.defaultText
502 511
             );
503 512
           },
504 513
           fail: errRes => {
514
+            // 重置调用状态
515
+            that.setData({
516
+              APILoading: false
517
+            })
505 518
             const {
506 519
               errNo,
507 520
               errMsg,