Browse Source

修复首页支付后购物车商品还存在问题

王耀南 2 years ago
parent
commit
e09a0163ce
3 changed files with 12 additions and 2 deletions
  1. 10 2
      components/common/k-payPop/index.vue
  2. 1 0
      pages/car/index.vue
  3. 1 0
      pages/home/index.vue

+ 10 - 2
components/common/k-payPop/index.vue

@@ -151,9 +151,17 @@ export default {
 			const shopCarts = this.$M_GS('common', '$S_tabbar_shopCarts');
 			const payCarts = this.payParam.shopCarts;
 			// 比较购物车数据和当前支付成功数据,找出没有支付的商品
-			for (let key in payCarts) {
-				delete shopCarts[key];
+			
+			if(payCarts.constructor === Array) {
+				for(let i = 0; i < payCarts.length; i++) {
+					delete shopCarts[payCarts[i]['no']];
+				}
+			} else {
+				for (let key in payCarts) {
+					delete shopCarts[key];
+				}
 			}
+			
 			// 储存没有支付的商品数据到vuex
 			this.$M_Dp('ACTI_SHOPCARTS', shopCarts);
 		}

+ 1 - 0
pages/car/index.vue

@@ -11,6 +11,7 @@
 			v-model="dataList"
 		>
 			<template #top>
+				<text style="opacity: 0; position: absolute;">{{showEmptyCart}}</text>
 				<view v-if="!showEmptyCart" style="overflow: hidden" class="l-boxShadow c-bg-f o-plr-24 o-ptb-10">
 					<view style="float: right">
 						<u-tag @click="isEdit = !isEdit" :text="isEdit ? '完成' : '编辑'" :type="isEdit ? 'success' : 'warning'"></u-tag>

+ 1 - 0
pages/home/index.vue

@@ -413,6 +413,7 @@ export default {
 			}
 			//询问是否订阅取餐通知
 			this.dingyue();
+			
 			const payParam = {
 				shopCarts: this.$S_tabbar_shopCarts,
 				clientId: this.GETT_clientId,