Quellcode durchsuchen

排除同家供货商商品的问题

shish vor 1 Monat
Ursprung
Commit
7c143069b7

+ 23 - 1
hdApp/src/pagesPurchase/bookProduct.vue

@@ -440,6 +440,20 @@ export default {
 				}
 			}
 
+			// 立即同步恢复或重置当前供货商的购物车,防止上一个供货商的购物车数据残留导致串线
+			let initialGhsId = this.option && this.option.id ? Number(this.option.id) : 0;
+			if (initialGhsId > 0) {
+				let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + initialGhsId);
+				if (!this.$util.isEmpty(currentInfo)) {
+					const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+					this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+				} else {
+					this.resetSelectInfoByType(this.pageType);
+				}
+			} else {
+				this.resetSelectInfoByType(this.pageType);
+			}
+
 			const { shopId,id} = this.option;
 			
 			if(this.option.id == 0) {
@@ -451,6 +465,15 @@ export default {
 					if(this.buyNotice == 1){
 						this.myClass = 'fadeIn'
 					}
+					this.option.id = res.data.id;
+					// 扫码/分享进入时,在解析出真实 ghsId 后立即恢复对应购物车,防止异步加载延迟
+					if (id > 0) {
+						let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + id);
+						if (!this.$util.isEmpty(currentInfo)) {
+							const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+							this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+						}
+					}
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
@@ -463,7 +486,6 @@ export default {
 						}
 						this.tjFl = res.data.tjFl
 					}
-					this.option.id = res.data.id;
 					this.newCustomGift.xrFlAmount = res.data.xrFlAmount
 				})
 			} else {

+ 23 - 1
hdApp/src/pagesPurchase/bookProduct2.vue

@@ -444,6 +444,20 @@ export default {
 				}
 			}
 
+			// 立即同步恢复或重置当前供货商的购物车,防止上一个供货商的购物车数据残留导致串线
+			let initialGhsId = this.option && this.option.id ? Number(this.option.id) : 0;
+			if (initialGhsId > 0) {
+				let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + initialGhsId);
+				if (!this.$util.isEmpty(currentInfo)) {
+					const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+					this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+				} else {
+					this.resetSelectInfoByType(this.pageType);
+				}
+			} else {
+				this.resetSelectInfoByType(this.pageType);
+			}
+
 			const { shopId,id} = this.option;
 			
 			if(this.option.id == 0) {
@@ -455,6 +469,15 @@ export default {
 					if(this.buyNotice == 1){
 						this.myClass = 'fadeIn'
 					}
+					this.option.id = res.data.id;
+					// 扫码/分享进入时,在解析出真实 ghsId 后立即恢复对应购物车,防止异步加载延迟
+					if (id > 0) {
+						let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + id);
+						if (!this.$util.isEmpty(currentInfo)) {
+							const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+							this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+						}
+					}
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
@@ -467,7 +490,6 @@ export default {
 						}
 						this.tjFl = res.data.tjFl
 					}
-					this.option.id = res.data.id;
 					this.newCustomGift.xrFlAmount = res.data.xrFlAmount
 				})
 			} else {

+ 23 - 1
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -555,6 +555,20 @@ export default {
 				}
 			}
 
+			// 立即同步恢复或重置当前供货商的购物车,防止上一个供货商的购物车数据残留导致串线
+			let initialGhsId = this.option && this.option.id ? Number(this.option.id) : 0;
+			if (initialGhsId > 0) {
+				let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + initialGhsId);
+				if (!this.$util.isEmpty(currentInfo)) {
+					const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+					this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+				} else {
+					this.resetSelectInfoByType(this.pageType);
+				}
+			} else {
+				this.resetSelectInfoByType(this.pageType);
+			}
+
 			const { shopId,id} = this.option;
 			
 			if(this.option.id == 0) {
@@ -563,12 +577,20 @@ export default {
 					let id = res.data.id
 					this.ghsId = id
 					this.shopId = this.option.shopId
+					this.option.id = res.data.id;
+					// 扫码/分享进入时,在解析出真实 ghsId 后立即恢复对应购物车,防止异步加载延迟
+					if (id > 0) {
+						let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + id);
+						if (!this.$util.isEmpty(currentInfo)) {
+							const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+							this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+						}
+					}
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
 						this.initGhsDataV2(id,shopId,0)
 					}
-					this.option.id = res.data.id;
 				}).catch(err => {})
 			} else {
 				this.ghsId = this.option.id

+ 23 - 1
hdApp/src/pagesPurchase/ghsProduct2.vue

@@ -520,6 +520,20 @@ export default {
 				}
 			}
 
+			// 立即同步恢复或重置当前供货商的购物车,防止上一个供货商的购物车数据残留导致串线
+			let initialGhsId = this.option && this.option.id ? Number(this.option.id) : 0;
+			if (initialGhsId > 0) {
+				let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + initialGhsId);
+				if (!this.$util.isEmpty(currentInfo)) {
+					const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+					this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+				} else {
+					this.resetSelectInfoByType(this.pageType);
+				}
+			} else {
+				this.resetSelectInfoByType(this.pageType);
+			}
+
 			const { shopId,id} = this.option;
 			
 			if(this.option.id == 0) {
@@ -532,6 +546,15 @@ export default {
 					if(this.buyNotice == 1){
 						this.myClass = 'fadeIn'
 					}
+					this.option.id = res.data.id;
+					// 扫码/分享进入时,在解析出真实 ghsId 后立即恢复对应购物车,防止异步加载延迟
+					if (id > 0) {
+						let currentInfo = uni.getStorageSync('selectList' + this.pageType + '_ghs_' + id);
+						if (!this.$util.isEmpty(currentInfo)) {
+							const mergedInfo = this._mergeDuplicateSelectRows ? this._mergeDuplicateSelectRows(currentInfo) : currentInfo;
+							this.setSelectInfoByType({ type: this.pageType, info: mergedInfo });
+						}
+					}
 					//获取供货商花材
 					if(id>0){
 						this.visitMall(id)
@@ -545,7 +568,6 @@ export default {
 						this.tjFl = res.data.tjFl
 					}
 					uni.setNavigationBarTitle({title: this.ghsInfo.name})
-					this.option.id = res.data.id;
 					this.newCustomGift.xrFlAmount = res.data.xrFlAmount
 				}).catch(err => {})
 			} else {