【类 型】:feat
【主 题】:选好 商品提交订单时 清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面 【描 述】: [原因]: [过程]:清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
242b5b5fee
commit
1cb1a23327
@ -57,6 +57,12 @@
|
||||
{
|
||||
"navigationBarTitleText" : ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/main/order",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"uniIdRouter": {}
|
||||
|
@ -105,9 +105,11 @@
|
||||
}).then(res => {
|
||||
//订单添加成功
|
||||
if (res.data.status === 1) {
|
||||
const order_sn = res.data.order_sn;
|
||||
//清空购物车
|
||||
this.$store.commit('clearCartList')
|
||||
//跳转到支付页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/shop/pay?order_sn=${order_sn}`
|
||||
url: `/pages/shop/pay?order_sn=${res.data.order_sn}`
|
||||
});
|
||||
} else if (res.data.status === -1) {
|
||||
uni.removeStorage({ //清除用户信息 跳转首页
|
||||
@ -133,7 +135,12 @@
|
||||
formatPrice, //格式化价格
|
||||
},
|
||||
onShow() {
|
||||
|
||||
//购物车没有信息 跳转到订单查询页面
|
||||
if (this.$store.state.cartList.length === 0) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/main/order'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -93,6 +93,10 @@ const store = new Vuex.Store({
|
||||
setShopCon(state, obj) {
|
||||
state.shopCon = obj
|
||||
},
|
||||
//清空购物车
|
||||
clearCartList(state){
|
||||
Vue.set(state,'cartList', [])
|
||||
},
|
||||
// 设置购物车列表
|
||||
setCartList(state, obj) {
|
||||
let isExisting = false
|
||||
|
Loading…
Reference in New Issue
Block a user