diff --git a/pages/index/home.vue b/pages/index/home.vue index 7770408..7784372 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -42,7 +42,7 @@ - {{item.goodsCategoryName}} @@ -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;