【类 型】:feat

【主	题】:选好 商品提交订单时 清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面
【描	述】:
	[原因]:
	[过程]:清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-06-05 18:44:33 +08:00
parent 242b5b5fee
commit 1cb1a23327
3 changed files with 20 additions and 3 deletions

View File

@ -57,6 +57,12 @@
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/main/order",
"style": {
"navigationStyle": "custom"
}
}
],
"uniIdRouter": {}

View File

@ -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>

View File

@ -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