goods列表和师傅列表的类目筛选增加“全部”节点

This commit is contained in:
donqi 2022-07-22 17:54:14 +08:00
parent c1f0cf198a
commit 3286535a64
3 changed files with 103 additions and 55 deletions

View File

@ -11,8 +11,8 @@ export default {
}) })
// request 触发前拼接 url // request 触发前拼接 url
// args.url = 'https://www.opsoul.com' + args.url; // args.url = 'https://www.opsoul.com' + args.url;
args.url = 'http://120.79.136.57' + args.url; // args.url = 'http://120.79.136.57' + args.url;
// args.url = 'http://127.0.0.1:80' + args.url; args.url = 'http://127.0.0.1:80' + args.url;
if (args.data) { if (args.data) {
args.data.deptId = globalData.deptId; args.data.deptId = globalData.deptId;
args.data.from = globalData.from; args.data.from = globalData.from;
@ -353,15 +353,25 @@ export default {
}) })
return res[1].data; return res[1].data;
}, },
async listByStep(params = { async listByStepWithAllNode(params = {
goodsCategoryId: null goodsCategoryId: null
}) { }) {
let res = await uni.request({ let res = await uni.request({
url: '/goods/deptcategory/listByStep', url: '/goods/deptcategory/app/listByStep',
method: 'POST', method: 'POST',
data: params data: params
}) })
return res[1].data; return res[1].data;
},
async listByStep(params = {
goodsCategoryId: null
}) {
let res = await uni.request({
url: '/goods/deptcategory/listByStep',
method: 'POST',
data: params
})
return res[1].data;
}, },
async uploadFile(filePath) { async uploadFile(filePath) {
let res = await uni.uploadFile({ let res = await uni.uploadFile({

View File

@ -175,21 +175,21 @@
} }
}, },
async loadCategoryList(idArr) { async loadCategoryList(idArr) {
let typeList = await this.$request.listByStep(); let typeList = await this.$request.listByStepWithAllNode();
typeList = typeList.data; typeList = typeList.data;
let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; // let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
let subTypeList = await this.$request.listByStep({ // let subTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: col1Id // goodsCategoryId: col1Id
}); // });
subTypeList = subTypeList.data; // subTypeList = subTypeList.data;
let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; // let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId;
let subSubTypeList = await this.$request.listByStep({ // let subSubTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: col2Id // goodsCategoryId: col2Id
}); // });
subSubTypeList = subSubTypeList.data; // subSubTypeList = subSubTypeList.data;
this.categoryList.push(typeList); this.categoryList.push(typeList);
this.categoryList.push(subTypeList); this.categoryList.push([]);
this.categoryList.push(subSubTypeList); this.categoryList.push([]);
}, },
async loadRegionList() { async loadRegionList() {
let regionList = await this.$request.areaListByStep(); let regionList = await this.$request.areaListByStep();
@ -258,6 +258,20 @@
for (let i = 0; i < this.categoryList.length; i++) { for (let i = 0; i < this.categoryList.length; i++) {
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[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];
break;
}
lastCategory = chosenCategory[i];
if (!lastCategory || lastCategory.isAllNode) {
lastCategory = chosenCategory[i - 1];
continue;
}
break;
}
chosenCategory[chosenCategory.length - 1] = lastCategory;
this.searchInfo.category = chosenCategory; this.searchInfo.category = chosenCategory;
this.searchGoods(); this.searchGoods();
}, },
@ -265,23 +279,25 @@
let colObj = e.detail; let colObj = e.detail;
if (colObj.column == 0) { if (colObj.column == 0) {
// //
let subTypeList = await this.$request.listByStep({ let subTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId,
isAllNode: this.categoryList[0][colObj.value].isAllNode
}); });
subTypeList = subTypeList.data; subTypeList = subTypeList.data;
let subSubTypeList = await this.$request.listByStep({ // let subSubTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: subTypeList[0].goodsCategoryId // goodsCategoryId: subTypeList[0].goodsCategoryId
}); // });
subSubTypeList = subSubTypeList.data; // subSubTypeList = subSubTypeList.data;
this.categoryList.pop(); this.categoryList.pop();
this.categoryList.pop(); this.categoryList.pop();
this.categoryList.push(subTypeList); this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList); this.categoryList.push([]);
this.categoryMultiIndex = [colObj.value, 0, 0]; this.categoryMultiIndex = [colObj.value, 0, 0];
} else if (colObj.column == 1) { } else if (colObj.column == 1) {
// //
let subSubTypeList = await this.$request.listByStep({ let subSubTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId,
isAllNode: this.categoryList[1][colObj.value].isAllNode
}); });
subSubTypeList = subSubTypeList.data; subSubTypeList = subSubTypeList.data;
this.categoryList.pop(); this.categoryList.pop();

View File

@ -226,21 +226,21 @@
this.pageNum++; this.pageNum++;
}, },
async loadCategoryList(idArr) { async loadCategoryList(idArr) {
let typeList = await this.$request.listByStep(); let typeList = await this.$request.listByStepWithAllNode();
typeList = typeList.data; typeList = typeList.data;
let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; // let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
let subTypeList = await this.$request.listByStep({ // let subTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: col1Id // goodsCategoryId: col1Id
}); // });
subTypeList = subTypeList.data; // subTypeList = subTypeList.data;
let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; // let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId;
let subSubTypeList = await this.$request.listByStep({ // let subSubTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: col2Id // goodsCategoryId: col2Id
}); // });
subSubTypeList = subSubTypeList.data; // subSubTypeList = subSubTypeList.data;
this.categoryList.push(typeList); this.categoryList.push(typeList);
this.categoryList.push(subTypeList); this.categoryList.push([]);
this.categoryList.push(subSubTypeList); this.categoryList.push([]);
}, },
async loadRegionList() { async loadRegionList() {
let regionList = await this.$request.areaListByStep(); let regionList = await this.$request.areaListByStep();
@ -340,35 +340,57 @@
for (let i = 0; i < this.categoryList.length; i++) { for (let i = 0; i < this.categoryList.length; i++) {
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[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];
break;
}
lastCategory = chosenCategory[i];
if (!lastCategory || lastCategory.isAllNode) {
lastCategory = chosenCategory[i - 1];
continue;
}
break;
}
chosenCategory[chosenCategory.length - 1] = lastCategory;
this.chosenCategory = chosenCategory; this.chosenCategory = chosenCategory;
this.taskConditions[this.tabCur].value = chosenCategory[chosenCategory.length - 1].goodsCategoryId; this.taskConditions[this.tabCur].value = chosenCategory[chosenCategory.length - 1].goodsCategoryId;
this.searchGoods(); this.searchGoods();
}, },
async categoryColChange(e) { async categoryColChange(e) {
let subTypeList = [];
let subSubTypeList = [];
let colObj = e.detail; let colObj = e.detail;
if (colObj.column == 0) { if (colObj.column == 0) {
// //
let subTypeList = await this.$request.listByStep({ let chosenColCategory = this.categoryList[0][colObj.value];
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId subTypeList = await this.$request.listByStepWithAllNode({
}); goodsCategoryId: chosenColCategory.goodsCategoryId,
subTypeList = subTypeList.data; isAllNode: chosenColCategory.isAllNode
let subSubTypeList = await this.$request.listByStep({ });
goodsCategoryId: subTypeList[0].goodsCategoryId subTypeList = subTypeList.data;
}); // if (subTypeList && subTypeList.length) {
subSubTypeList = subSubTypeList.data; // subSubTypeList = await this.$request.listByStepWithAllNode({
// goodsCategoryId: subTypeList[0].goodsCategoryId,
// isAllNode: chosenColCategory.isAllNode
// });
// subSubTypeList = subSubTypeList.data;
// }
this.categoryList.pop(); this.categoryList.pop();
this.categoryList.pop(); this.categoryList.pop();
this.categoryList.push(subTypeList); this.categoryList.push(subTypeList ? subTypeList : []);
this.categoryList.push(subSubTypeList); this.categoryList.push([]);
this.categoryMultiIndex = [colObj.value, 0, 0]; this.categoryMultiIndex = [colObj.value, 0, 0];
} else if (colObj.column == 1) { } else if (colObj.column == 1) {
// //
let subSubTypeList = await this.$request.listByStep({ let subSubTypeList = await this.$request.listByStepWithAllNode({
goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId,
isAllNode: this.categoryList[1][colObj.value].isAllNode
}); });
subSubTypeList = subSubTypeList.data; subSubTypeList = subSubTypeList.data;
this.categoryList.pop(); this.categoryList.pop();
this.categoryList.push(subSubTypeList); this.categoryList.push(subSubTypeList ? subSubTypeList : []);
this.categoryMultiIndex = [this.categoryMultiIndex[0], colObj.value, 0]; this.categoryMultiIndex = [this.categoryMultiIndex[0], colObj.value, 0];
} }
}, },