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