支付成功跳转订单页
This commit is contained in:
parent
1ec179d2ae
commit
0597bdbcb0
@ -45,6 +45,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "结算"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order/order",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
@ -110,7 +116,13 @@
|
||||
"name": "个人页面",
|
||||
"path": "pages/my/my",
|
||||
"query": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "订单页",
|
||||
"path": "pages/order/order",
|
||||
"query": ""
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
15
src/pages/order/order.vue
Normal file
15
src/pages/order/order.vue
Normal file
@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<view>
|
||||
订定单页面
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
@ -80,7 +80,7 @@ export default {
|
||||
// 去付款
|
||||
async payHandle(){
|
||||
if (!this.address.userName) {
|
||||
return uni.showToast({ title: "请选择收货地址", icon: "none" });
|
||||
return uni.showToast({ title: "请选择收货地址", icon: "none" });
|
||||
} else {
|
||||
// console.log("走支付逻辑");
|
||||
// 创建订单
|
||||
@ -103,11 +103,25 @@ export default {
|
||||
const {message: {pay}} = await this.$u.api.orderPayParams({order_number})
|
||||
console.log(pay);
|
||||
// 调用支付接口
|
||||
const res1 = await wx.requestPayment(pay)
|
||||
console.log(res1)
|
||||
// const res1 = await wx.requestPayment(pay)
|
||||
// console.log(res1)
|
||||
// 更新支付状态
|
||||
const res2 = await this.$u.api.checkOrder(order_number)
|
||||
console.log(res2);
|
||||
// const {message} = await this.$u.api.checkOrder(order_number)
|
||||
// console.log(message);
|
||||
// 支付成功
|
||||
await uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "none"
|
||||
})
|
||||
setTimeout(() => {
|
||||
// 保留未支付的商品
|
||||
const cartList = this.cartList.filter(item=>!item.goods_select)
|
||||
uni.setStorageSync("cartList", cartList)
|
||||
// 替换到订单页
|
||||
uni.redirectTo({
|
||||
url: "/pages/order/order"
|
||||
})
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user