类目全部修改为从第二级开始展示(第一级默认为服务商城)
This commit is contained in:
parent
616a0554c7
commit
eb8a29a2f5
|
|
@ -225,13 +225,25 @@
|
|||
|
||||
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 stopFlag = false;
|
||||
let secondList = item.child[i].child;
|
||||
if (secondList && secondList.length) {
|
||||
for (let k = 0; k < secondList.length; k++) {
|
||||
let thirdList = secondList[k].child;
|
||||
if (thirdList && thirdList.length) {
|
||||
for (let j = 0; j < thirdList.length; j++) {
|
||||
subSubTypeList = subSubTypeList.concat(thirdList[j]);
|
||||
if (subSubTypeList.length >= 15) {
|
||||
subSubTypeList = subSubTypeList.slice(0, 15);
|
||||
stopFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stopFlag) break;
|
||||
}
|
||||
}
|
||||
if (stopFlag) break;
|
||||
}
|
||||
|
||||
let subCategoryOpt = await this.$api.data('subCategories');
|
||||
|
|
|
|||
|
|
@ -175,7 +175,14 @@
|
|||
}
|
||||
},
|
||||
async loadCategoryList(idArr) {
|
||||
let typeList = await this.$request.listByStepWithAllNode();
|
||||
let res = await this.$request.listByStep({
|
||||
type: 1
|
||||
});
|
||||
res = res.data;
|
||||
let typeList = await this.$request.listByStepWithAllNode({
|
||||
goodsCategoryId: res[0].goodsCategoryId,
|
||||
type: 1
|
||||
});
|
||||
typeList = typeList.data;
|
||||
// let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
|
||||
// let subTypeList = await this.$request.listByStepWithAllNode({
|
||||
|
|
@ -262,6 +269,12 @@
|
|||
for (let i = chosenCategory.length - 1; i >= 0; i--) {
|
||||
if (i === 0) {
|
||||
lastCategory = chosenCategory[i];
|
||||
if (lastCategory && lastCategory.isAllNode) {
|
||||
let res = await this.$request.listByStep({
|
||||
type: 1
|
||||
});
|
||||
lastCategory = res.data[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
lastCategory = chosenCategory[i];
|
||||
|
|
|
|||
|
|
@ -226,7 +226,14 @@
|
|||
this.pageNum++;
|
||||
},
|
||||
async loadCategoryList(idArr) {
|
||||
let typeList = await this.$request.listByStepWithAllNode();
|
||||
let res = await this.$request.listByStep({
|
||||
type: 1
|
||||
});
|
||||
res = res.data;
|
||||
let typeList = await this.$request.listByStepWithAllNode({
|
||||
goodsCategoryId: res[0].goodsCategoryId,
|
||||
type: 1
|
||||
});
|
||||
typeList = typeList.data;
|
||||
// let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
|
||||
// let subTypeList = await this.$request.listByStepWithAllNode({
|
||||
|
|
@ -335,15 +342,21 @@
|
|||
}
|
||||
},
|
||||
async categoryChange(e) {
|
||||
this.categoryMultiIndex = e.detail.value;
|
||||
let chosenCategory = [];
|
||||
for (let i = 0; i < this.categoryList.length; i++) {
|
||||
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
|
||||
this.categoryMultiIndex = e.detail.value;
|
||||
let chosenCategory = [];
|
||||
for (let i = 0; i < this.categoryList.length; i++) {
|
||||
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
|
||||
}
|
||||
let lastCategory = null;
|
||||
for (let i = chosenCategory.length - 1; i >= 0; i--) {
|
||||
if (i === 0) {
|
||||
lastCategory = chosenCategory[i];
|
||||
if (lastCategory && lastCategory.isAllNode) {
|
||||
let res = await this.$request.listByStep({
|
||||
type: 1
|
||||
});
|
||||
lastCategory = res.data[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
lastCategory = chosenCategory[i];
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
data() {
|
||||
return {
|
||||
containerHeight: '100vh - ' + this.CustomBar + 'px',
|
||||
categoryList: null
|
||||
categoryList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
|
@ -33,7 +33,12 @@
|
|||
async loadData(params = {}) {
|
||||
// this.categoryList = await this.$api.data('categoryList');
|
||||
let res = await this.$request.getProductCategories(params);
|
||||
this.categoryList = res[1].data.data;
|
||||
res = res[1].data.data;
|
||||
res.forEach(firstCategory => {
|
||||
if (firstCategory.child && firstCategory.child.length) {
|
||||
this.categoryList = this.categoryList.concat(firstCategory.child)
|
||||
}
|
||||
})
|
||||
},
|
||||
bindEvent() {
|
||||
uni.$on(this.$globalFun.VERTICAL_NAV_GET_ITEM, this.chooseSubType);
|
||||
|
|
|
|||
Loading…
Reference in New Issue