Ver Fonte

Merge branch 'master' into notice-260707

shish há 3 semanas atrás
pai
commit
93e270ca45
2 ficheiros alterados com 36 adições e 24 exclusões
  1. 8 8
      mallApp/src/pages/billing/affirmGhs.vue
  2. 28 16
      mallApp/src/pages/item/item.vue

+ 8 - 8
mallApp/src/pages/billing/affirmGhs.vue

@@ -682,8 +682,8 @@ export default {
 			}).catch(()=>{})
 		},
 		modifyAddress(){
-			let account = this.option.account
-			let hdId = this.option.hdId
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
+			let hdId = this.option.hdId ? this.option.hdId : (uni.getStorageSync('hdId') || 0)
       		this.$util.pageTo({ url: '/pages/user/address?account='+account+'&hdId='+hdId})
 		},
 		changeSendType(num){
@@ -781,8 +781,8 @@ export default {
 			console.log('selectDelivery -- isFreeDelivery: ',isFreeDelivery)
 		},
 		confirmForm(){
-			let hdId = this.option.hdId ? this.option.hdId : 0
-			let account = this.option.account ? this.option.account : 0
+			let hdId = this.option.hdId ? this.option.hdId : (uni.getStorageSync('hdId') || 0)
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
 
 			if(Number(hdId)<=0 || Number(account)<=0){
 				inform({hdId:hdId,account:account,page:'affirmGhs'})
@@ -824,7 +824,7 @@ export default {
 				}
 				return { productId: ele.id, num: num, itemId: ele.itemId, unitType: unitType, property: 1 };
 			});
-			let hdId = this.option.hdId ? this.option.hdId : 0
+			let hdId = this.option.hdId ? this.option.hdId : (uni.getStorageSync('hdId') || 0)
 			let params = {
 				product: JSON.stringify(product),
 				...this.form,
@@ -872,7 +872,7 @@ export default {
 					this.limitExceedProductId = ''
 					this.limitExceedLimitBuy = ''
 					this.limitExceedNum = ''
-					let account = this.option.account ? this.option.account : 0
+					let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
 					let getPayType = res.data.getPayType?res.data.getPayType:0
 					let totalPrice = res.data.totalPrice?res.data.totalPrice:0
 					let orderSn = res.data.orderSn?res.data.orderSn:''
@@ -899,8 +899,8 @@ export default {
 			})
 		},
 		modifyItem() {
-			let account = this.option.account ? this.option.account : 0
-			let hdId = this.option.hdId ? this.option.hdId : 0
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
+			let hdId = this.option.hdId ? this.option.hdId : (uni.getStorageSync('hdId') || 0)
 			this.$util.pageTo({url:'/pages/item/item?account='+account+'&hdId='+hdId,type:2})
 		},
 		isLimitExceededItem(item){

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

@@ -324,15 +324,19 @@ export default {
 			this.popupShow = false;
 		},
 		buyAlbum(){
-			let account = this.option.account ? this.option.account : 0
-			this.$util.pageTo({url: "/pages/home/mall?account="+account+'&hdId='+this.hdId,type:2})
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
+			let realHdId = this.hdId || uni.getStorageSync('hdId') || 0
+			this.$util.pageTo({url: "/pages/home/mall?account="+account+'&hdId='+realHdId,type:2})
 		},
 		buyHs(){
-			let account = this.option.account ? this.option.account : 0
-			this.$util.pageTo({url: "/pages/home/category?account="+account+'&hdId='+this.hdId,type:2})
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
+			let realHdId = this.hdId || uni.getStorageSync('hdId') || 0
+			this.$util.pageTo({url: "/pages/home/category?account="+account+'&hdId='+realHdId,type:2})
 		},
 		showBigCover(item){
-      		this.$util.pageTo({url: "/pages/item/detail?id="+item.id+"&account="+this.option.account+'&hdId='+this.hdId})
+			let account = this.option.account ? this.option.account : (uni.getStorageSync('account') || 0)
+			let realHdId = this.hdId || uni.getStorageSync('hdId') || 0
+      		this.$util.pageTo({url: "/pages/item/detail?id="+item.id+"&account="+account+'&hdId='+realHdId})
 		},
 		init(){
 			this.init = false
@@ -340,6 +344,12 @@ export default {
 			if(this.option.hdId && Number(this.option.hdId) > 0){
 				this.hdId = this.option.hdId
 				uni.setStorageSync('hdId', this.hdId)
+			} else {
+				// 兜底:如果URL中没有,尝试从缓存取
+				let cacheHdId = uni.getStorageSync('hdId')
+				if (cacheHdId && Number(cacheHdId) > 0) {
+					this.hdId = cacheHdId
+				}
 			}
 
 			const shopId = uni.getStorageSync('account')
@@ -525,17 +535,19 @@ export default {
 							this.$msg("有花材超出限购")
 							return
 						}
-						this.limitBuyWarnList = []
-						this.setLimitBuyInfoByType({ type: this.pageType, info: limitBuyInfo });
-						this.setSelectInfoByType({ type: this.pageType, info: list });
-						this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:2})
-					})
-				} else {
-					this.limitBuyWarnList = []
-					this.setLimitBuyInfoByType({ type: this.pageType, info: [] });
-					this.setSelectInfoByType({ type: this.pageType, info: list });
-					this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:2})
-				}
+				this.limitBuyWarnList = []
+				this.setLimitBuyInfoByType({ type: this.pageType, info: limitBuyInfo });
+				this.setSelectInfoByType({ type: this.pageType, info: list });
+				let realHdId = this.hdId || uni.getStorageSync('hdId') || 0
+				this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+realHdId,type:2})
+			})
+		} else {
+			this.limitBuyWarnList = []
+			this.setLimitBuyInfoByType({ type: this.pageType, info: [] });
+			this.setSelectInfoByType({ type: this.pageType, info: list });
+			let realHdId = this.hdId || uni.getStorageSync('hdId') || 0
+			this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+realHdId,type:2})
+		}
 			} else {
 				this.$msg("请选择花材");
 			}