Forráskód Böngészése

Merge pull request #256 from John-Hong/John/release-2.17.0/KIP-11937

John/release 2.17.0/kip 11937
Tron 1 éve
szülő
commit
54efb8c557

+ 12 - 1
src/pages/parkingFeeV2/mixins/parkingFee.js

@@ -682,7 +682,18 @@ export default {
             // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
             success: (res) => {
               console.log('H5页面扫码获取到的参数——成功', res);
-              runScanFn(res);
+              // const test = {"resultStr": "lp$Qed.3YuVi*D7vXilrrV0571a2&type=unlicensedOut", "errMsg": "scanQRCode:ok"}
+              let path = res.resultStr.replace(/.*([a-z0-9]{6}&type)/g, '8b$1')
+              console.log(614, path);
+              const regex = /(\w+)&type=(\w+)/;
+              const match = path.match(regex);
+              const obj = { code: match[1], type: match[2] };
+              console.log(618, obj);
+              this.$store.commit('SET_UNLICENSED_INFO', obj);
+              this.$nextTick(() => {
+                this.qrCodesRule(obj.code, 'scan');
+              })
+              // runScanFn(res);
               // this.formMsg.deviceCode = res.resultStr;
             },
             error: (res) => {

+ 42 - 33
src/pages/parkingFeeV2/mixins/parkingFeeDetail.js

@@ -430,37 +430,37 @@ export default {
           if (res.data?.code == '000000') {
             const prepayJson = res.data.data.params;
             // console.log('prepayJson::', res.data)
-            const platform = getPlatform();
+            // const platform = getPlatform();
             this.isPay = true
             // TODO: h5环境判断
-            if (platform === 'micromessenger') {
-              const weixinH5PayRes = await this.weixinH5Pay(prepayJson);
-              // 微信支付完成,判断结果
-              // console.log(1784, weixinH5PayRes);
-              //  errMsg: 'requestPayment:ok'
-              if (weixinH5PayRes?.errMsg === 'requestPayment:ok') {
-                this.btnLoading = false
-                this.isPay = false
-                this.clearOrderTimeEvent()
-                this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-                  name: 'parkingFeeDetail',
-                });
-                this.$router.replace({
-                  // path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
-                  path: this.getPagePath(),
-                  query: {...this.$route.query}
-                });
-              } else {
-                this.reCreateParkOrder();
-              }
-            } else {
+            // if (platform === 'micromessenger') {
+              // const weixinH5PayRes = await this.weixinH5Pay(prepayJson);
+              // // 微信支付完成,判断结果
+              // // console.log(1784, weixinH5PayRes);
+              // //  errMsg: 'requestPayment:ok'
+              // if (weixinH5PayRes?.errMsg === 'requestPayment:ok') {
+              //   this.btnLoading = false
+              //   this.isPay = false
+              //   this.clearOrderTimeEvent()
+              //   this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
+              //     name: 'parkingFeeDetail',
+              //   });
+              //   this.$router.replace({
+              //     // path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
+              //     path: this.getPagePath(),
+              //     query: {...this.$route.query}
+              //   });
+              // } else {
+              //   this.reCreateParkOrder();
+              // }
+            // } else {
               let options = {}
-              if (isAlipay()) {
-                options = {
-                  provider: 'alipay',
-                  orderInfo: prepayJson.trade_no,
-                }
-              } else {
+              // if (isAlipay()) {
+              //   options = {
+              //     provider: 'alipay',
+              //     orderInfo: prepayJson.trade_no,
+              //   }
+              // } else {
                 options = {
                   provider: 'wxpay',
                   timeStamp: prepayJson.timeStamp,
@@ -469,7 +469,7 @@ export default {
                   signType: prepayJson.signType,
                   paySign: prepayJson.paySign,
                 }
-              }
+              // }
               // console.log(430, options)
               const data = {
                 ...options,
@@ -482,7 +482,8 @@ export default {
               const signType = data.signType + '$';
               const paySign = data.paySign + '$';
               const vehicleNo = this.orderDetail.parkingRecord.vehicleNo + '$';
-              const unlicensed = vehicleNo.indexOf('临') > -1 ? 'unlicensedVehicle': 'licensedVehicle'  + '$';
+              const unlicensed = this.orderDetail.unlicensed ? 'unlicensedVehicle' + '$': 'licensedVehicle'  + '$';
+              // console.log(486, this.orderDetail);
               // return
               wx.miniProgram.redirectTo({
                 url: `/pages/package-parkingFee/payment?timeStamp=${encodeURIComponent(
@@ -535,7 +536,7 @@ export default {
               //     });
               //   }
               // });
-            }
+            // }
           } else {
             this.reCreateParkOrder();
           }
@@ -775,9 +776,11 @@ export default {
     },
     // 获取成功缴费之后前往的页面
     getPagePath() {
+      const { vehicleNo = '', unlicensed = '' } = this.$route.query
+      // unlicensed: unlicensedVehicle(无牌车), licensedVehicle(有牌车)
       let pagePath = 'parkingFeeSuccess?vehicleNo=' + this.$route.query.vehicleNo
       // console.log('临时车流程', this.endlessLoop);
-      if (this.$route.query.vehicleNo.indexOf('临') > -1) {
+      if (vehicleNo.indexOf('临') > -1 && unlicensed === 'unlicensedVehicle') {
         pagePath = 'parkingFeeMsg?type=pay'
       }
       return pagePath
@@ -804,6 +807,7 @@ export default {
       }  
     },
     orderInitCallBack(res) {
+      console.log('orderInitCallBack', res);
       try {
         setTimeout(() => {
           this.$store.dispatch('clearUnlicensed');
@@ -811,11 +815,16 @@ export default {
         // 如果 无牌车扫码出场扫码 无需缴费,直接展示无需缴费页面
         if(/unlicensedOut/.test(res.code) && res?.unlicensed) {
           this.clearOrderTimeEvent()
+          // console.log('818', {
+          //   type: 'pay',
+          //   ...this.$route.query,
+          // });
+          console.log('822822822822822', this.$route.query);
           this.$router.replace({
             path: 'parkingFeeMsg',
             query: {
-              type: 'pay',
               ...this.$route.query,
+              type: 'pay',
             }
           });
           return

+ 4 - 1
src/store/order/index.js

@@ -52,7 +52,10 @@ export default {
         // 所有的优惠时间长转为金额
         // console.log(112,'所有的优惠时间长转为金额');
         // dispatch('orderInitRule', checkOutQHResponse);
-        dispatch('orderInitRule',res);
+        dispatch('orderInitRule',{
+          ...res,
+          unlicensed: unlicensed && endlessLoop || !vehicleNo
+        });
       } catch ( error ) {
         // console.log('151151151151151',error);
         /* if (/NOT_FOUND|PARKING_RECORD_NOT_FOUND/.test(error.code)) {