diff --git a/api/local_store.js b/api/local_store.js index da3310d..4a195bf 100644 --- a/api/local_store.js +++ b/api/local_store.js @@ -87,3 +87,7 @@ export function getCartGoods(data) { export function modifyCart(data) { return request.post("LocalStoreGoods/modifyCart", data) } + +export function clearCart(data) { + return request.post("LocalStoreGoods/clearCart", data) +} diff --git a/bundle/pages/user_spread/user_spread.vue b/bundle/pages/user_spread/user_spread.vue index 215d90b..5e4ec73 100644 --- a/bundle/pages/user_spread/user_spread.vue +++ b/bundle/pages/user_spread/user_spread.vue @@ -38,8 +38,7 @@ - - + @@ -390,7 +389,7 @@ }, onLoad(options) { this.scheme_city = options?.city - + // 获取店铺类型及合作方案 this.getSchemeFun() // 获取上级及个人信息 @@ -613,8 +612,18 @@ back_id_card, region, hand_id_card, - cost_card + cost_card, + partnerIndex, + selectIndex } = this; + + if (partnerIndex == -1) { + this.$toast({ + title: '请选择合伙人类型' + }) + return + } + if (!realName) { this.$toast({ @@ -664,6 +673,13 @@ }); return; } + + if (selectIndex == -1) { + this.$toast({ + title: '请选择合伙人类型' + }) + return + } let params = { real_name: realName, @@ -809,6 +825,7 @@ this.partnerIndex = i } }, + computed: { ...mapGetters(['appConfig']), }, diff --git a/bundle_b/pages/local_shop/local_shop_detail.vue b/bundle_b/pages/local_shop/local_shop_detail.vue index 72200e2..a37e906 100644 --- a/bundle_b/pages/local_shop/local_shop_detail.vue +++ b/bundle_b/pages/local_shop/local_shop_detail.vue @@ -172,49 +172,54 @@ - - - - - 总价 - - - - - - - 清空购物车 - - - - - - - - - - - - + + + + - - {{item.title}} - - - - - - - - - 移除 + 总价 + + + + + 清空购物车 + - + + + + + + + + + + + + {{item.title}} + + + + + + + + + 移除 + + + + + + + + 暂无商品数据! + @@ -235,7 +240,8 @@ addCart, cartNum, getCartGoods, - modifyCart + modifyCart, + clearCart } from '@/api/local_store'; import { sortType, @@ -459,6 +465,7 @@ }) this.cartNum = this.cartNum + goods_num + this.zoomValue = 1.5 setTimeout(() => { this.zoomValue = 1 @@ -476,18 +483,57 @@ async modifyCartFun(goods_num, cart_id, type) { const {code, data} = await modifyCart({ goods_num, - cart_id, - type + cart_id }) if (code == 1) { this.cart.total_amount = data.total_amount + if (type == 'minus') { this.cartNum-- } else { this.cartNum++ } } + }, + + // 移除商品和清空购物车 + clearCartFun(cart_id = 0, index = 0) { + let title = '购物车' + let content = "是否清空购物车?" + if (cart_id > 0) { + content = '是否从购物车移除该商品?' + } + uni.showModal({ + title, + content, + success: async res => { + let { + confirm + } = res; + if (confirm) { + const {code, data} = await clearCart({ + lstore_id: this.id, + cart_id + }) + + if (code == 1) { + this.cart.total_amount = data.total_amount + this.cartNum = data.goods_num + + if (cart_id > 0) { + this.cart.data.splice(index, 1) + } else { + this.cart.data = [] + } + + this.$toast({ + title: '操作成功' + }) + } + } + } + }); } }, computed: {