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