|
|
@@ -54,34 +54,34 @@ Page({ |
|
|
|
let that = this; |
|
|
|
wx.scanCode({ |
|
|
|
success: (res) => { |
|
|
|
console.log(res.result) |
|
|
|
Http.get({ |
|
|
|
url: config.api.findByCode, |
|
|
|
data: { |
|
|
|
merchantCode: res.result, |
|
|
|
} |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log(res); |
|
|
|
if (res.code == 200) { |
|
|
|
let merChantDetail = JSON.stringify(res.data); |
|
|
|
if (merChantDetail && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) { |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: "未识别到商户二维码", |
|
|
|
icon: "none", |
|
|
|
mask: false |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(res.result.indexOf('merchant_id_scan')) |
|
|
|
if(res.result.indexOf('merchant_id_scan')!=-1){ |
|
|
|
Http.get({ |
|
|
|
url: config.api.findByCode, |
|
|
|
data: { |
|
|
|
merchantCode: JSON.parse(res.result).merchant_id_scan, |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log(err) |
|
|
|
.then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
let merChantDetail = JSON.stringify(res.data); |
|
|
|
if (merChantDetail && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) { |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
wx.showToast({ |
|
|
|
title: "未识别到商户二维码", |
|
|
|
icon: "none", |
|
|
|
mask: false |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (res) => { |
|
|
|
console.log(res); |
|
|
|