捕获支付异常
This commit is contained in:
parent
0597bdbcb0
commit
8b2167ea56
@ -72,7 +72,7 @@ export default {
|
|||||||
uni.chooseAddress({
|
uni.chooseAddress({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
uni.setStorageSync("address", res)
|
uni.setStorageSync("address", res)
|
||||||
console.log(res)
|
// console.log(res)
|
||||||
this.address = res
|
this.address = res
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -82,6 +82,7 @@ export default {
|
|||||||
if (!this.address.userName) {
|
if (!this.address.userName) {
|
||||||
return uni.showToast({ title: "请选择收货地址", icon: "none" });
|
return uni.showToast({ title: "请选择收货地址", icon: "none" });
|
||||||
} else {
|
} else {
|
||||||
|
try{
|
||||||
// console.log("走支付逻辑");
|
// console.log("走支付逻辑");
|
||||||
// 创建订单
|
// 创建订单
|
||||||
// 解构拿到goods参数
|
// 解构拿到goods参数
|
||||||
@ -98,16 +99,16 @@ export default {
|
|||||||
consignee_addr: this.addressDetail,
|
consignee_addr: this.addressDetail,
|
||||||
goods
|
goods
|
||||||
})
|
})
|
||||||
console.log(order_number);
|
// console.log(order_number);
|
||||||
// 获取支付参数
|
// 获取支付参数
|
||||||
const {message: {pay}} = await this.$u.api.orderPayParams({order_number})
|
const {message: {pay}} = await this.$u.api.orderPayParams({order_number})
|
||||||
console.log(pay);
|
// console.log(pay);
|
||||||
// 调用支付接口
|
// 调用支付接口
|
||||||
// const res1 = await wx.requestPayment(pay)
|
const res1 = await wx.requestPayment(pay)
|
||||||
// console.log(res1)
|
console.log(res1)
|
||||||
// 更新支付状态
|
// 更新支付状态
|
||||||
// const {message} = await this.$u.api.checkOrder(order_number)
|
const {message} = await this.$u.api.checkOrder({order_number})
|
||||||
// console.log(message);
|
console.log(message);
|
||||||
// 支付成功
|
// 支付成功
|
||||||
await uni.showToast({
|
await uni.showToast({
|
||||||
title: "支付成功",
|
title: "支付成功",
|
||||||
@ -121,7 +122,13 @@ export default {
|
|||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/order/order"
|
url: "/pages/order/order"
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500)
|
||||||
|
}catch(err){
|
||||||
|
uni.showToast({
|
||||||
|
title: "支付异常",
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user