|
@@ -92,7 +92,18 @@ export default {
|
|
},
|
|
},
|
|
// 扫码
|
|
// 扫码
|
|
async scanCode() {
|
|
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);
|
|
// this.getPaperCouponInfo(test.result);
|
|
// return
|
|
// return
|
|
const runScanFn = ( res ) => {
|
|
const runScanFn = ( res ) => {
|
|
@@ -130,10 +141,17 @@ export default {
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
// scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
// scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
success: ( res ) => {
|
|
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 ) => {
|
|
error: ( res ) => {
|
|
console.log(242, res);
|
|
console.log(242, res);
|