Przeglądaj źródła

防止用户扫码时重复触发领取车牌的流程

john 2 lat temu
rodzic
commit
5371ed3ddb
1 zmienionych plików z 7 dodań i 27 usunięć
  1. 7 27
      src/pages/parkingFee/mixins/parkingFee.js

+ 7 - 27
src/pages/parkingFee/mixins/parkingFee.js

@@ -61,6 +61,7 @@ export default {
       preUrl: '',
       tabbarActive: '手动缴费',
       supportUnlicensed: false, // 控制当前site,是否使用无牌车
+      qrCodeHistory: ''
       // custTypeId: 0,
     };
   },
@@ -146,7 +147,7 @@ export default {
                   if(options?.options?.type && /unlicensedIn|unlicensedOut/.test(options.options.type)) {
                     this.$store.commit('SET_UNLICENSED_INFO', options.options);
                     this.qrCodesRule(options.options.code);
-                  }  
+                  }
                 })
               })
             },
@@ -526,8 +527,6 @@ export default {
     // 无牌车闸机扫码
     async scanCarCode() {
       try {
-        // this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
-        // return
         const runScanFn = (res) => {
           console.log(513, res);
           if (res.scanType && res.scanType == 'QR_CODE') {
@@ -598,6 +597,10 @@ export default {
     // 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
     async qrCodesRule(code) {
       try {
+        if ( this.qrCodeHistory && this.qrCodeHistory === code ) {
+          return
+        }
+        this.qrCodeHistory = code
         const qrCodesres = await qrCodes(code); // 无牌车扫码
         // 记录buildingId,确保 buildingId 是最新的数据
         window.localStorage.setItem('buildingId', qrCodesres.buildingId);
@@ -611,34 +614,11 @@ export default {
           this.$router.push({
             path: 'parkingFeeDetail',
             query: {
-              type: 'success',
               gateId: qrCodesres.gateId,
               vehicleNo: '',
               type: this.unlicensedInfo.type
-            } 
-          })
-          // const res = await unlicensedCarCheckout({
-          //   gateId: qrCodesres.gateId
-          // });
-          // console.log(595, res);
-          // return
-          // 查询用户是否存在车牌(出场扫码不查询车牌,直接前往支付页面)
-          /*this.$store.dispatch('order/unlicensedRule', (vehicleNo) => {
-            if(vehicleNo === 'error') {
-
-              return
             }
-            // 出场前,扫码缴费
-            this.$router.push({
-              path: 'parkingFeeDetail',
-              query: {
-                type: 'success',
-                gateId: qrCodesres.gateId,
-                vehicleNo: vehicleNo,
-                type: this.unlicensedInfo.type
-              }
-            })
-          });*/
+          })
           return
         }
         // 如果是无牌车扫码:入场