diff --git a/api/shop.js b/api/shop.js index 81eaae32..192cd1ce 100644 --- a/api/shop.js +++ b/api/shop.js @@ -6,4 +6,5 @@ export const apiArr = { getCarCount:"/api/v2/wechat/commodity/cart/all_count",//购物车数量 addCar:"/api/v2/wechat/commodity/cart/add",//添加购物车 deleteCar:"/api/v2/wechat/commodity/cart/delete",//删除购物车 + updateCar:"/api/v2/wechat/commodity/cart/update", } \ No newline at end of file diff --git a/packages/shop/goods/index.vue b/packages/shop/goods/index.vue index e332392d..569dbf94 100644 --- a/packages/shop/goods/index.vue +++ b/packages/shop/goods/index.vue @@ -27,6 +27,7 @@ +
+ +
@@ -80,18 +83,21 @@
-
加入购物车
-
- +
+ + - {{ - info[currentGGIndex].cart_count.count }} + + {{ info.commodity_goods_info_list[currentGGIndex].cart_count.count }} @@ -143,7 +149,6 @@ diff --git a/packages/shop/index/index.css b/packages/shop/index/index.css index 8a6c4b7a..5c34f82d 100644 --- a/packages/shop/index/index.css +++ b/packages/shop/index/index.css @@ -538,7 +538,7 @@ page { height: 140rpx; position: fixed; right: 33rpx; - bottom: 380rpx; + bottom: 180rpx; z-index: 10; } .shop_car image{ diff --git a/packages/shop/index/index.vue b/packages/shop/index/index.vue index 9cedb3a7..3733ceba 100644 --- a/packages/shop/index/index.vue +++ b/packages/shop/index/index.vue @@ -191,7 +191,7 @@
- +
@@ -277,7 +277,8 @@ export default { rightCateList:[], //底部右侧分类 currentThirdId:"", - tagList:[] + tagList:[], + carNum:"", } }, methods: { @@ -336,6 +337,13 @@ export default { }) }, + getShopCarList(){ + request(apiArr.getCar,"POST",).then(res=>{ + console.log(res); + this.carNum = res.total + }) + }, + changeLeftCate(e){ this.secondId = e this.getGoodsList() @@ -347,6 +355,7 @@ export default { this.top = meun.top; this.localHeight = meun.height; this.getCateList() + this.getShopCarList() }, onReachBottom() { if (this.flag) { diff --git a/packages/shop/shopCar/index.vue b/packages/shop/shopCar/index.vue index f32867b9..1b379e6f 100644 --- a/packages/shop/shopCar/index.vue +++ b/packages/shop/shopCar/index.vue @@ -13,28 +13,28 @@
-
+
-
+
- +
-
{{ item.goods_name }}
-
{{ item.goods_intro }}
+
{{ item.commodity_goods_info.goods_name }}
+
{{ item.commodity_goods_info.goods_intro }}
- {{ item.sales_price }} /{{ item.goods_unit }} + {{ item.commodity_goods_info.sales_price }} /{{ item.commodity_goods_info.goods_unit }}
@@ -114,6 +114,9 @@ export default { } }, methods: { + back() { + NavgateTo("1") + }, submitOrder() { NavgateTo("../submitOrder/index") }, @@ -129,7 +132,7 @@ export default { }) }, - // 单个修改 + // 单个修改 changeChecked(item, index) { this.shopCarList[index].checked = !this.shopCarList[index].checked this.calcTotal() @@ -156,11 +159,40 @@ export default { let total = 0 this.shopCarList.forEach(item => { if (item.checked) { - total += item.sales_price * item.count + total += item.commodity_goods_info.sales_price * item.count } }); this.shopMoney = total }, + + deleteItem() { + let that = this + uni.showModal({ + title: '提示', + content: '确定删除所选商品吗', + success: function (res) { + if (res.confirm) { + let ids = [] + that.shopCarList.forEach(item => { + if(item.checked){ + ids.push(item.id) + } + }) + request(apiArr.deleteCar, "POST", { + ids + }).then(res=>{ + uni.showToast({ + title: '删除成功', + duration: 2000 + }); + that.getShopCar() + }) + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }); + }, }, onLoad(options) { const meun = menuButtonInfo();