|
|
@@ -54,28 +54,36 @@ Page({ |
|
|
|
let that = this; |
|
|
|
wx.scanCode({ |
|
|
|
success: (res) => { |
|
|
|
let value = JSON.parse(res.result); |
|
|
|
if (value.END == 'B' && value.TYPE == 'merchant' && value.ID){ |
|
|
|
Http.get({ |
|
|
|
url: config.api.findByCode, |
|
|
|
data: { |
|
|
|
merchantCode:value.ID, |
|
|
|
} |
|
|
|
}) |
|
|
|
.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}`, |
|
|
|
}) |
|
|
|
if (util.isJSON(res.result)) { |
|
|
|
let value = JSON.parse(res.result); |
|
|
|
if (value.END == 'B' && value.TYPE == 'merchant' && value.ID) { |
|
|
|
Http.get({ |
|
|
|
url: config.api.findByCode, |
|
|
|
data: { |
|
|
|
merchantCode: value.ID, |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.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 |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: "未识别到商户二维码", |
|
|
|
icon: "none", |
|
|
@@ -84,7 +92,11 @@ Page({ |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (res) => { |
|
|
|
console.log(res); |
|
|
|
wx.showToast({ |
|
|
|
title: "未识别到商户二维码", |
|
|
|
icon: "none", |
|
|
|
mask: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|