Forráskód Böngészése

相同提货方式的商品才能一起结算

gcz 1 éve
szülő
commit
41c615509b
2 módosított fájl, 9 hozzáadás és 5 törlés
  1. 4 2
      components/cartfixed.vue
  2. 5 3
      shopping/cart.vue

+ 4 - 2
components/cartfixed.vue

@@ -34,7 +34,8 @@
 						if(res.data.total==this.cartTotal){
 							uni.showToast({
 								title:'添加成功',
-								icon:'success'
+								icon:'success',
+								duration:1000
 							})
 							
 							// this.$refs.uToast.show({
@@ -44,7 +45,8 @@
 						}else{
 							uni.showToast({
 								title:'添加成功',
-								icon:'success'
+								icon:'success',
+								duration:1000
 							})
 							// this.$refs.uToast.show({
 							// 	type:"success",

+ 5 - 3
shopping/cart.vue

@@ -337,7 +337,8 @@
 					logis.push(item.logisticsTypeList)
 				})
 				// console.log('logis',logis);
-				const referenceArray = logis[0];
+				const referenceArray = logis.shift();
+				// console.log('logis',logis);
 				// 使用some()方法遍历数组,并判断每个子数组是否存在与参照数组相同的值
 				const result = logis.some(subArray => {
 				  // 遍历参照数组的每个元素,判断是否包含在子数组中
@@ -345,8 +346,9 @@
 				    return subArray.includes(element);
 				  });
 				});
-				if (result) {
-				  // console.log("每个子数组中至少存在一个相同的值");
+				// console.log('result',result);
+				if (result||logis.length==0) {
+				  console.log("每个子数组中至少存在一个相同的值");
 				} else {
 				  // console.log("每个子数组中都没有相同的值");
 				  uni.$u.toast('只有相同提货方式的商品才能一起结算哦')