shish 1 год назад
Родитель
Сommit
5f3f9fa1c9
1 измененных файлов с 16 добавлено и 8 удалено
  1. 16 8
      mallApp/src/pages/item/item.vue

+ 16 - 8
mallApp/src/pages/item/item.vue

@@ -185,7 +185,8 @@ export default {
 			isNewCustom:false,
 			cartItemShow:false,
 			shopName:'',
-			shopImg:''
+			shopImg:'',
+			hdId:0
 		};
 	},
 	onPullDownRefresh() {
@@ -309,19 +310,22 @@ export default {
 			this.popupShow = false;
 		},
 		buyHs(){
-			let hdId = this.option.hdId ? this.option.hdId : 0
 			let account = this.option.account ? this.option.account : 0
-			this.$util.pageTo({url: "/pages/home/category?account="+account+'&hdId='+hdId,type:2})
+			this.$util.pageTo({url: "/pages/home/category?account="+account+'&hdId='+this.hdId,type:2})
 		},
 		showBigCover(item){
-			let hdId = this.option.hdId ? this.option.hdId : 0
-      		this.$util.pageTo({url: "/pages/item/detail?id="+item.id+"&account="+this.option.account+'&hdId='+hdId})
+      		this.$util.pageTo({url: "/pages/item/detail?id="+item.id+"&account="+this.option.account+'&hdId='+this.hdId})
 		},
 		init(){
 			this.init = false
+
+			if(this.option.hdId && Number(this.option.hdId) > 0){
+				this.hdId = this.option.hdId
+			}
+
 			const shopId = uni.getStorageSync('account')
 			this.option.shopId = shopId
-			getInfo().then(res=>{
+			getInfo({hdId:this.hdId}).then(res=>{
 				if(res.code == 1){
 					if(res.data.info && res.data.info.merchantName){
 						let sjName = res.data.info.merchantName
@@ -330,6 +334,11 @@ export default {
 						this.shopName = name
 						this.shopImg = res.data.info.avatar
 					}
+					if(res.data.hd && Number(res.data.hd.id) > 0){
+						if(Number(this.hdId) == 0){
+							this.hdId = res.data.hd.id
+						}
+					}
 				}
 			})
 		},
@@ -479,9 +488,8 @@ export default {
 					return
 				}
 				this.setSelectInfoByType({ type: this.pageType, info: list });
-				let hdId = this.option.hdId ? this.option.hdId : 0
 				let account = this.option.account ? this.option.account : 0
-				this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+hdId,type:2})
+				this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:2})
 			} else {
 				this.$msg("请选择花材");
 			}