|
|
|
@ -135,11 +135,19 @@ |
|
|
|
|
// 记录订单ID |
|
|
|
|
this.orderId = Number(orderId) |
|
|
|
|
// 获取收银台信息 |
|
|
|
|
this.getCashierInfo() |
|
|
|
|
this.getCashierInfo(); |
|
|
|
|
uni.$on('appShow', this.solveShowMsg); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
solveShowMsg(msgData) { |
|
|
|
|
console.log(msgData); |
|
|
|
|
if (msgData.errCode === '0000') { |
|
|
|
|
this.onShowSuccess({ message: msgData.errStr }); |
|
|
|
|
} else { |
|
|
|
|
this.onPayFail({ message: msgData.errStr }); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取收银台信息 |
|
|
|
|
getCashierInfo() { |
|
|
|
|
const app = this |
|
|
|
@ -182,10 +190,10 @@ |
|
|
|
|
|
|
|
|
|
// 选择支付方式 |
|
|
|
|
handleSelectPayType(index) { |
|
|
|
|
if (this.methods[index].method == 'huifu') { |
|
|
|
|
this.$toast('抱歉,此支付方式暂未完善') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
// if (this.methods[index].method == 'huifu') { |
|
|
|
|
// this.$toast('抱歉,此支付方式暂未完善') |
|
|
|
|
// return |
|
|
|
|
// } |
|
|
|
|
this.curPaymentItem = this.methods[index] |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -230,13 +238,29 @@ |
|
|
|
|
// 按钮禁用 |
|
|
|
|
if (app.disabled) return |
|
|
|
|
app.disabled = true |
|
|
|
|
// 提交到后端API |
|
|
|
|
// 提交到后端API |
|
|
|
|
CashierApi.orderPay(app.orderId, { |
|
|
|
|
method: app.curPaymentItem.method, |
|
|
|
|
client: app.platform, |
|
|
|
|
extra: app.getExtraAsUnify(app.curPaymentItem.method) |
|
|
|
|
}) |
|
|
|
|
.then(result => app.onSubmitCallback(result)) |
|
|
|
|
.then(result => { |
|
|
|
|
console.log(result); |
|
|
|
|
if (app.curPaymentItem.method === 'huifu') { |
|
|
|
|
const { miniPayRequest } = result.data.payment; |
|
|
|
|
let appPayRequest = ''; |
|
|
|
|
appPayRequest = encodeURIComponent(JSON.stringify({ |
|
|
|
|
sign: miniPayRequest.sign, |
|
|
|
|
prepayid: miniPayRequest.prepayid, |
|
|
|
|
})); |
|
|
|
|
uni.navigateToMiniProgram({ |
|
|
|
|
appId: miniPayRequest.miniuser, |
|
|
|
|
path: `${miniPayRequest.minipath}?appPayRequest=${appPayRequest}`, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
app.onSubmitCallback(result) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.finally(err => setTimeout(() => app.disabled = false, 10)) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|