首页推荐主类目子类目调整
This commit is contained in:
parent
a9cdaf1c40
commit
d0d989826f
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
<view class="flex-twice">
|
||||
<scroll-view scroll-x class="nav text-right" :scroll-with-animation="true" :scroll-left="scrollLeft">
|
||||
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''"
|
||||
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''" v-if="index < 2"
|
||||
v-for="(item,index) in categories" :key="item.goodsCategoryId" @tap="tabSelect($event, item)" :data-index="index">
|
||||
{{item.goodsCategoryName}}
|
||||
</view>
|
||||
|
|
@ -155,13 +155,8 @@
|
|||
}
|
||||
},
|
||||
async loadCategoryList() {
|
||||
let typeList = await this.$request.listByStep();
|
||||
typeList = typeList.data;
|
||||
let subTypeList = await this.$request.listByStep({
|
||||
goodsCategoryId: typeList[0].goodsCategoryId
|
||||
});
|
||||
subTypeList = subTypeList.data;
|
||||
this.categories = subTypeList;
|
||||
let res = await this.$request.getProductCategories();
|
||||
this.categories = res[1].data.data;
|
||||
this.tabSelect(null, this.categories[0]);
|
||||
},
|
||||
async loadRegionList() {
|
||||
|
|
@ -227,10 +222,18 @@
|
|||
async tabSelect(e, item) {
|
||||
this.tabCur = e == null ? 0 : e.currentTarget.dataset.index;
|
||||
this.scrollLeft = (this.tabCur - 1) * 60;
|
||||
let subSubTypeList = await this.$request.listByStep({
|
||||
goodsCategoryId: item.goodsCategoryId
|
||||
});
|
||||
subSubTypeList = subSubTypeList.data;
|
||||
|
||||
let subSubTypeList = [];
|
||||
for (let i = 0; i < item.child.length; i++) {
|
||||
if (item.child[i].child && item.child[i].child.length) {
|
||||
subSubTypeList = subSubTypeList.concat(item.child[i].child);
|
||||
if (subSubTypeList.length >= 15) {
|
||||
subSubTypeList = subSubTypeList.slice(0, 15);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let subCategoryOpt = await this.$api.data('subCategories');
|
||||
for(let i = 0; i < subSubTypeList.length; i++) {
|
||||
subSubTypeList[i]['cuIcon'] = subCategoryOpt[i].cuIcon;
|
||||
|
|
|
|||
Loading…
Reference in New Issue