捕获支付异常

This commit is contained in:
jqtmviyu@gmail.com 2021-03-07 00:28:53 +08:00
parent 0597bdbcb0
commit 8b2167ea56

View File

@ -72,7 +72,7 @@ export default {
uni.chooseAddress({
success: (res) => {
uni.setStorageSync("address", res)
console.log(res)
// console.log(res)
this.address = res
}
})
@ -82,6 +82,7 @@ export default {
if (!this.address.userName) {
return uni.showToast({ title: "请选择收货地址", icon: "none" });
} else {
try{
// console.log("");
//
// goods
@ -98,16 +99,16 @@ export default {
consignee_addr: this.addressDetail,
goods
})
console.log(order_number);
// console.log(order_number);
//
const {message: {pay}} = await this.$u.api.orderPayParams({order_number})
console.log(pay);
// console.log(pay);
//
// const res1 = await wx.requestPayment(pay)
// console.log(res1)
const res1 = await wx.requestPayment(pay)
console.log(res1)
//
// const {message} = await this.$u.api.checkOrder(order_number)
// console.log(message);
const {message} = await this.$u.api.checkOrder({order_number})
console.log(message);
//
await uni.showToast({
title: "支付成功",
@ -121,7 +122,13 @@ export default {
uni.redirectTo({
url: "/pages/order/order"
})
}, 1500);
}, 1500)
}catch(err){
uni.showToast({
title: "支付异常",
icon: "none"
})
}
}
},
},