Kaynağa Gözat

优化支付按钮

john 2 yıl önce
ebeveyn
işleme
13fcda8480

+ 9 - 2
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -19,6 +19,7 @@ export default {
       // 微服务接口字段
       isShowDescription: true, // 缴费说明true:显示全部 false:显示部分
       btnLoading: false,
+      isPay: false,
       popup: false,
       msData: {},
     };
@@ -123,7 +124,7 @@ export default {
     async toPay() {
       this.btnLoading = true
       setTimeout(() => {
-        if ( this.btnLoading ) {
+        if ( this.btnLoading && !this.isPay ) {
           const toast1 = Toast({
             message: '操作异常,返回上一页后请重试!',
             duration: 3000,
@@ -134,8 +135,8 @@ export default {
               });
             }
           });
+          this.btnLoading = false
         }
-        this.btnLoading = false
       }, 7000)
       const { parkingRecord, discountInfo = {}, parkingRule = {}} = this.orderDetail;
       const { coupons, points, memberGrade = [], paperCoupons = [], consume = [] } = discountInfo
@@ -232,6 +233,7 @@ export default {
         // console.log('orderDetail', res);
         if (res?.paymentType === 'NO_FEE_PAY') {
           this.btnLoading = false;
+          this.isPay = false
           this.$router.replace({
             path: this.getPagePath(),
           });
@@ -241,6 +243,7 @@ export default {
         this.kerryPayment(res.sessionId);
       } catch (err) {
         this.btnLoading = false
+        this.isPay = false
         console.log(err);
       }
     },
@@ -278,6 +281,7 @@ export default {
           if (res.data?.code == '000000') {
             const prepayJson = res.data.data.params;
             const platform = getPlatform();
+            this.isPay = true
             // TODO: h5环境判断
             if (platform === 'micromessenger') {
               const weixinH5PayRes = await this.weixinH5Pay(prepayJson);
@@ -286,6 +290,7 @@ export default {
               //  errMsg: 'requestPayment:ok'
               if (weixinH5PayRes?.errMsg === 'requestPayment:ok') {
                 this.btnLoading = false
+                this.isPay = false
                 this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
                   name: 'parkingFeeDetail'
                 });
@@ -317,6 +322,7 @@ export default {
                   this.reCreateParkOrder();
                 } else {
                   this.btnLoading = false;
+                  this.isPay = false
                   this.$router.replace({
                     // path: 'parkingFeeSuccess?vehicleNo=' + this.$route.query.vehicleNo,
                     path: this.getPagePath(),
@@ -369,6 +375,7 @@ export default {
           endlessLoop: this.endlessLoop
         })
         this.btnLoading = false;
+        this.isPay = false
         // this.createParkOrder();
       });
       // uni.showModal({