Преглед на файлове

fix(SCRM-4952): [DE][C端]临时停车,浦东。扫描纸质优惠券没有反应,接口提示优惠券码有误

john преди 1 година
родител
ревизия
143c0b9052
променени са 1 файла, в които са добавени 23 реда и са изтрити 5 реда
  1. 23 5
      src/pages/parkingFeeV2/mixins/parkingFeePaperCoupon.js

+ 23 - 5
src/pages/parkingFeeV2/mixins/parkingFeePaperCoupon.js

@@ -92,7 +92,18 @@ export default {
     },
     // 扫码
    async scanCode() {
-    // const test =  {"resultStr": "9B913361000000020000002139ea2915b7b8515d", "errMsg": "scanQRCode:ok"}
+    // const res =  {"resultStr": "https://ad.itooler.cn/back/coupon/auth/b4ad4bd60fc6ef46636b1227d2217406b29685bab51df55fced60dec189e4c69?redirect=ADD", "errMsg": "scanQRCode:ok"}
+    //  if ( res.resultStr.indexOf('auth/') === -1 ) {
+    //    this.getPaperCouponInfo(res.resultStr);
+    //  } else {
+    //    const start = res.resultStr.indexOf('auth/');
+    //    const end = res.resultStr.indexOf('?');
+    //    const params = res.resultStr.slice(start,end).split('/');
+    //    if ( params && params.length ) {
+    //      const couponCode = params[1];
+    //      this.getPaperCouponInfo(couponCode);
+    //    }
+    //  }
     // this.getPaperCouponInfo(test.result);
     // return
       const runScanFn = ( res ) => {
@@ -130,10 +141,17 @@ export default {
           needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
           // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
           success: ( res ) => {
-            // console.log(237,res);
-            // runScanFn(res);
-            this.getPaperCouponInfo(res.resultStr);
-            // this.formMsg.deviceCode = res.resultStr;
+             if ( res.resultStr.indexOf('auth/') === -1 ) {
+              this.getPaperCouponInfo(res.resultStr);
+            } else {
+              const start = res.resultStr.indexOf('auth/');
+              const end = res.resultStr.indexOf('?');
+              const params = res.resultStr.slice(start,end).split('/');
+              if ( params && params.length ) {
+                const couponCode = params[1];
+                this.getPaperCouponInfo(couponCode);
+              }
+            }
           },
           error: ( res ) => {
             console.log(242, res);