shish 3 лет назад
Родитель
Сommit
80a06d350b
2 измененных файлов с 11 добавлено и 46 удалено
  1. 11 45
      mallApp/src/mixins/cgProduct.js
  2. 0 1
      mallApp/src/pages/item/item.vue

+ 11 - 45
mallApp/src/mixins/cgProduct.js

@@ -218,20 +218,16 @@ export default {
 			}
 			this.resetSelectInfoByType(this.pageType);
 		},
-		//进入鲜花时请求花材接口
-		async initGhsData(id,shopId) {
+		async initData(extendInfo) {
 			try {
-				let params = { py: this.py, id:id, shopId:shopId, account:shopId }
-				let directList = [];
-				const { data } = await getItemList(params);
-
+				let params = { py: this.py, type: this.type }
+				if (extendInfo) {
+					params = { ...params, ...extendInfo };
+				}
+				const { data } = await getProductDataApi(params);
 				data.forEach(element => {
 					element.child &&
 					element.child.forEach(child => {
-
-						//价格如果有改动,记忆的花材价格需要改掉 shish 20210811
-						directList[child.id] = child
-
 						child.classId = element.classId;
 						child.className = element.className;
 					});
@@ -242,45 +238,15 @@ export default {
 					if(uni.getStorageSync('selectList'+this.pageType+'_hd_'+this.option.account)){
 						let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_hd_'+this.option.account)
 						if(!this.$util.isEmpty(currentInfo)){
-							currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
-								let currentId = currentItem.id
-								if(directList[currentId]){
-									//价格如果有改动,记忆花材的价格需要更新 shish 20210811
-									currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
-									currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
-								}
-							})
 							this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
+						}else{
+							this.resetSelectInfoByType(this.pageType);
 						}
-					}			
+					}else{
+						this.resetSelectInfoByType(this.pageType);
+					}		
 				}
 
-				this.classIndex = 0;
-				this.scroll_into_view = 'class_0';
-				this.scrollPushList();
-			} catch (error) {
-			} finally {
-				uni.hideLoading();
-			}
-		},
-		async initData(extendInfo) {
-			try {
-				let params = {
-					py: this.py,
-					type: this.type
-				};
-				if (extendInfo) {
-					params = { ...params, ...extendInfo };
-				}
-				const { data } = await getProductDataApi(params);
-				data.forEach(element => {
-					element.child &&
-					element.child.forEach(child => {
-						child.classId = element.classId;
-						child.className = element.className;
-					});
-				});
-				this.productInfo = data;
 				this.classIndex = 0;
 				this.scrollPushList();
 			} catch (error) {

+ 0 - 1
mallApp/src/pages/item/item.vue

@@ -315,7 +315,6 @@ export default {
 			this.init = false
 			const shopId = uni.getStorageSync('account')
 			this.option.shopId = shopId
-			this.initGhsData(0,shopId);
 		},
 		scroll_detail(options){
 			if(options.detail.scrollTop > 20) {