shish 1 éve
szülő
commit
5ad68ad982

+ 6 - 2
mallApp/src/pages/goods/components/sel-popup.vue

@@ -71,6 +71,10 @@ export default {
       type: Number,
       type: Number,
       default: 1
       default: 1
     },
     },
+    hdId: {
+      type: Number,
+      default: 0
+    },
     show: {
     show: {
       type: Boolean,
       type: Boolean,
       default: true
       default: true
@@ -105,11 +109,11 @@ export default {
     },
     },
     nextFn() {
     nextFn() {
       if(Number(this.info.price) <= 0){
       if(Number(this.info.price) <= 0){
-        this.$msg('没有价格,暂时无法下单')
+        this.$msg('商品还没有价格哦')
         return false
         return false
       }
       }
       uni.setStorageSync("buyGoodsDetil", this.info)
       uni.setStorageSync("buyGoodsDetil", this.info)
-      this.$util.pageTo({url:"/pages/order/buy",type:2,query:{goodsId:this.info.id,goodsNum:this.buyNum,selIndex:this.selIndex}})
+      this.$util.pageTo({url:"/pages/order/buy?hdId="+this.hdId+'&goodsId='+this.info.id+'&goodsNum='+this.buyNum+'&selIndex='+this.selIndex,type:2})
     }
     }
   }
   }
 };
 };

+ 8 - 4
mallApp/src/pages/goods/detail.vue

@@ -48,7 +48,7 @@
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>
-    <sel-popup :show="popupShow" :info="data" :buyNum="buyNum" @change="changeNum" @close="hidePopup" />
+    <sel-popup :show="popupShow" :info="data" :buyNum="buyNum" :hdId="hdId" @change="changeNum" @close="hidePopup" />
     <buy-foot @buy="showPopup" @goShop="goToShop" :stock="data.stock" />
     <buy-foot @buy="showPopup" @goShop="goToShop" :stock="data.stock" />
   </view>
   </view>
 </template>
 </template>
@@ -82,10 +82,13 @@ export default {
       buyNum: 1,
       buyNum: 1,
       popupShow: false,
       popupShow: false,
       loginShow: false,
       loginShow: false,
-      showShare: false
+      showShare: false,
+      hdId:0
     };
     };
   },
   },
-  onLoad(option) {},
+  onLoad(option) {
+    this.hdId = this.option.hdId ? this.option.hdId : 0
+  },
   mounted() {},
   mounted() {},
   computed: {
   computed: {
     ...mapGetters({ shopUser: "getShopUser" })
     ...mapGetters({ shopUser: "getShopUser" })
@@ -112,7 +115,8 @@ export default {
     },
     },
     goToShop(){
     goToShop(){
       let account = uni.getStorageSync('account')
       let account = uni.getStorageSync('account')
-      this.$util.pageTo({ url: '/pages/home/shop', type: 4, query: { account: account } })
+      let hdId = this.option.hdId ? this.option.hdId : 0
+      this.$util.pageTo({ url: '/pages/home/shop?account='+account+'&hdId='+hdId, type: 4})
     },
     },
     showPopup() {
     showPopup() {
         this.popupShow = true
         this.popupShow = true

+ 18 - 14
mallApp/src/pages/home/category.vue

@@ -21,7 +21,7 @@
     <block v-for="(item,index) in tabbar" :key="index" >
     <block v-for="(item,index) in tabbar" :key="index" >
       <scroll-view scroll-y class="right-box" @scrolltolower="onReachBottoms" v-if="currentTab==index" >
       <scroll-view scroll-y class="right-box" @scrolltolower="onReachBottoms" v-if="currentTab==index" >
         <view class="page-view" v-if="!$util.isEmpty(list.data)" >
         <view class="page-view" v-if="!$util.isEmpty(list.data)" >
-          <view class="goods-list" v-for="(items) in list.data" :key="items.id" @click="pageTo(`/pages/goods/detail?id=${items.id}`)" >
+          <view class="goods-list" v-for="(items) in list.data" :key="items.id" @click="toBuy(items)" >
             <view class="img-blo">
             <view class="img-blo">
               <image :src="items.smallImgList[0]" mode="aspectFill" ></image>
               <image :src="items.smallImgList[0]" mode="aspectFill" ></image>
             </view>
             </view>
@@ -73,7 +73,8 @@ export default {
       currentTabIndex: 1,
       currentTabIndex: 1,
       myClass: 'fadeIn',
       myClass: 'fadeIn',
 			shopName:'',
 			shopName:'',
-			shopImg:''
+			shopImg:'',
+      hdId:0
     }
     }
   },
   },
 	computed: {
 	computed: {
@@ -86,8 +87,10 @@ export default {
 			path: "pages/home/category?account="+this.option.account,
 			path: "pages/home/category?account="+this.option.account,
 		}
 		}
 	},
 	},
+  onLoad () {
+    this.hdId = this.option.hdId ? this.option.hdId : 0
+  },
 	onShow(){
 	onShow(){
-		//登录状态
 		if(!this.$util.isEmpty(this.loginInfo)){
 		if(!this.$util.isEmpty(this.loginInfo)){
 			this.globalLoginStyle = 1
 			this.globalLoginStyle = 1
 		}else{
 		}else{
@@ -108,15 +111,17 @@ export default {
 		}
 		}
 	},
 	},
   methods: {
   methods: {
+    toBuy(item){
+      this.$util.pageTo({url: "/pages/goods/detail?id="+item.id+'&hdId='+this.hdId})
+    },
 		buyProduct(){
 		buyProduct(){
-			this.$util.pageTo({url: "/pages/item/item?account="+this.option.account,type:2})
+			this.$util.pageTo({url: "/pages/item/item?account="+this.option.account+'&hdId='+this.hdId,type:2})
 		},
 		},
 		loginTo() {
 		loginTo() {
 			this.$util.pageTo({url:"/pages/login/index?needBack=1"})
 			this.$util.pageTo({url:"/pages/login/index?needBack=1"})
 		},
 		},
     init(){
     init(){
-      this.sInit()
-
+      this.classInit()
 			getInfo().then(res=>{
 			getInfo().then(res=>{
 				if(res.code == 1){
 				if(res.code == 1){
 					if(res.data.info && res.data.info.merchantName){
 					if(res.data.info && res.data.info.merchantName){
@@ -128,24 +133,23 @@ export default {
 					}
 					}
 				}
 				}
 			})
 			})
-
     },
     },
     onReachBottoms () {
     onReachBottoms () {
       if (!this.list.finished) {
       if (!this.list.finished) {
-        this._list().then(res => {
+        this.getGoodList().then(res => {
           uni.stopPullDownRefresh()
           uni.stopPullDownRefresh()
         });
         });
       } else {
       } else {
         uni.stopPullDownRefresh()
         uni.stopPullDownRefresh()
       }
       }
     },
     },
-    async sInit () {
-      this._getClass() .then(res => {
-          this._list()
+    async classInit () {
+      this.getMyClass() .then(res => {
+          this.getGoodList()
         })
         })
     },
     },
     // 分类
     // 分类
-    _getClass () {
+    getMyClass () {
       return getClass().then(res => {
       return getClass().then(res => {
         if(res.code && res.code == 1){
         if(res.code && res.code == 1){
           this.form.categoryId = res.data[0].id
           this.form.categoryId = res.data[0].id
@@ -154,7 +158,7 @@ export default {
       })
       })
     },
     },
     // 列表
     // 列表
-    _list () {
+    getGoodList () {
       return getList({ ...this.form, page: this.list.page,pageSize:100 }) .then(res => {
       return getList({ ...this.form, page: this.list.page,pageSize:100 }) .then(res => {
           this.completes(res)
           this.completes(res)
       })
       })
@@ -168,7 +172,7 @@ export default {
         this.currentTab = cur
         this.currentTab = cur
         this.form.categoryId = item.id
         this.form.categoryId = item.id
         this.resetList()
         this.resetList()
-        this._list()
+        this.getGoodList()
       }
       }
     },
     },
     // 判断当前滚动超过一屏时,设置tab标题滚动条。
     // 判断当前滚动超过一屏时,设置tab标题滚动条。