| @@ -54,34 +54,36 @@ Page({ | |||||
| let that = this; | let that = this; | ||||
| wx.scanCode({ | wx.scanCode({ | ||||
| success: (res) => { | 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(JSON.parse(res.result).merchant_id_scan) | |||||
| let merchant_id_scan = JSON.parse(res.result).merchant_id_scan; | |||||
| if(merchant_id_scan){ | |||||
| Http.get({ | |||||
| url: config.api.findByCode, | |||||
| data: { | |||||
| merchantCode: merchant_id_scan, | |||||
| } | } | ||||
| }) | }) | ||||
| .catch(err => { | |||||
| console.log(err) | |||||
| .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}`, | |||||
| }) | |||||
| } | |||||
| } | |||||
| }) | |||||
| .catch(err => { | |||||
| console.log(err) | |||||
| }) | |||||
| }else{ | |||||
| wx.showToast({ | |||||
| title: "未识别到商户二维码", | |||||
| icon: "none", | |||||
| mask: false | |||||
| }) | }) | ||||
| } | |||||
| }, | }, | ||||
| fail: (res) => { | fail: (res) => { | ||||
| console.log(res); | console.log(res); | ||||