Sfoglia il codice sorgente

Merge branch 'master' of http://git.cc-lotus.info/pointToNetwork/point-app

guhongwei 2 anni fa
parent
commit
9457ccd14b
3 ha cambiato i file con 26 aggiunte e 34 eliminazioni
  1. 23 31
      pages/market/index.vue
  2. 2 1
      pagesHome/order/detail.vue
  3. 1 2
      pagesHome/order/order.vue

+ 23 - 31
pages/market/index.vue

@@ -238,12 +238,13 @@ export default {
         })
       }
       that.$set(that, `list`, list)
-      that.goodsAllChange(value);
+      that.goodsAllChange();
       // 计算总额
       that.countMoney();
     },
     //商品全部选择true,店铺自动选择,
-    goodsAllChange(value) {
+    // 所有店铺为true,则全选为true
+    goodsAllChange() {
       const that = this;
       let list = that.list;
       list = list.map(i => {
@@ -252,6 +253,9 @@ export default {
         else i.check = false;
         return i;
       })
+      const allSelect = list.every(e => e.check)
+      if (allSelect) this.$set(this, `isAll`, true)
+      else this.$set(this, `isAll`, false)
       // 计算总额
       that.countMoney();
     },
@@ -279,36 +283,24 @@ export default {
         that.countMoney();
       })
     },
-    // 删除
-    toDel(e) {
-      const that = this;
-      const list = that.list;
-      let shop = list.find(f => f.goods.find(i => i.check == true))
-      if (shop) {
-        uni.showModal({
-          title: '提示',
-          content: '确认要删除这些商品吗?',
-          success: async function (res) {
-            if (res.confirm) { }
+    // 删除, 接口,购物车删除,然后将该数据移除
+    async toDel(e) {
+      let list = this.list;
+      uni.showModal({
+        title: '提示',
+        content: '请选择要删除的商品',
+        success: async (res) => {
+          if (!res.confirm) return
+          const result = await this.$api(`/cart/${e.cart_id}`, 'Delete');
+          if (result.errcode === 0) {
+            list = list.map(i => ({ ...i, goods: i.goods.filter(f => f.cart_id !== e.cart_id) }))
+            this.$set(this, `list`, list);
+            // 计算总额
+            this.countMoney();
           }
-        });
-      } else if (e.id) {
-        uni.showModal({
-          title: '提示',
-          content: '是否确认删除该商品',
-          success: async function (res) {
-            if (res.confirm) { }
-          }
-        });
-      } else {
-        uni.showModal({
-          title: '提示',
-          content: '请选择要删除的商品',
-          success: async function (res) {
-            if (res.confirm) { }
-          }
-        });
-      }
+        }
+      });
+
     },
     // 计算总额
     countMoney() {

+ 2 - 1
pagesHome/order/detail.vue

@@ -166,6 +166,7 @@
 					{
 						icon: 'cart',
 						text: '购物车',
+						route: 'pages/market/index',
 					}, {
 						icon: 'chat',
 						text: '客服',
@@ -224,7 +225,7 @@
 			//店铺,购物车,客服跳转
 			onClick(e) {
 				if (e && e.content.route) {
-					uni.navigateTo({
+					uni.reLaunch({
 						url: `/${e.content.route}`
 					})
 				}

+ 1 - 2
pagesHome/order/order.vue

@@ -69,7 +69,7 @@
 			<view class="two">
 				<view class="two_1">
 					<view>实付金额:</view>
-					<view>¥{{info.money}}</view>
+					<view>¥{{shop.money}}</view>
 				</view>
 				<view class="two_2">
 					<text @click="toSubmit">提交订单</text>
@@ -170,7 +170,6 @@
 									title: '删除信息成功',
 									icon: 'none'
 								})
-								that.clearPage();
 								that.search();
 							} else {
 								uni.showToast({