支付宝
// 请求接口 返回orderInfo
alipayPay(this.orderNo).then(res => {
console.log(res)
uni.requestPayment({
provider: 'alipay',
orderInfo: res.data.orderInfo,
success: resPay => {
},
fail: err => {
const message = err.errMsg || '';
if (message.indexOf('[payment支付宝:62001]') !== -1) {
uni.showModal({
content: '您已取消支付。如有需要,您可在我的订单里重新付款。30分钟内有效。',
showCancel: false
});
} else {
uni.showModal({
content: '支付失败,原因为: ' + message,
showCancel: false
});
}
},
complete: () => {
}
});
微信
wxpayPay(this.orderNo).then(res => {
console.log(res, "13246546546545")
uni.requestPayment({
provider: 'wxpay',
orderInfo: res.data,
success: resPay => {
成功
},
fail: err => {
this.payShow = false;
uni.showModal({
content: '您已取消支付.',
showCancel: false
});
},
complete: () => {
this.payShow = false;
}
});
})