新增服务类目选择从第二级类目开始,默认一级类目为服务商城

This commit is contained in:
donqi 2022-08-02 14:27:28 +08:00
parent eaaf2586e6
commit e8e13a4154
1 changed files with 36 additions and 27 deletions

View File

@ -21,7 +21,7 @@
<picker :mode="'multiSelector'" @change="categoryChange" @columnchange="categoryColChange"
:value="categoryMultiIndex" :range-key="'goodsCategoryName'" :range="categoryList">
<input disabled class="line-input radius-input"
:value="formData.category && formData.category.length ? formData.category[0].goodsCategoryName + '-' + formData.category[1].goodsCategoryName + '-' + formData.category[2].goodsCategoryName : ''"
:value="formData.category && formData.category.length ? formData.category[0].goodsCategoryName + '-' + formData.category[1].goodsCategoryName : ''"
placeholder="请选择类目"></input>
</picker>
</view>
@ -270,7 +270,7 @@
videoList: []
},
categoryList: [],
categoryMultiIndex: [0, 0, 0],
categoryMultiIndex: [0, 0],
regionList: [],
regionMultiIndex: [0, 0],
isShowAllSpecs: false,
@ -348,19 +348,23 @@
return true;
},
async loadCategoryList(idArr) {
let typeList = await this.$request.listByStep();
let typeList = await this.$request.listByStep({
type: 1
});
typeList = typeList.data;
let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId;
let subTypeList = await this.$request.listByStep({
type: 1,
goodsCategoryId: col1Id
});
subTypeList = subTypeList.data;
let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId;
let subSubTypeList = await this.$request.listByStep({
type: 1,
goodsCategoryId: col2Id
});
subSubTypeList = subSubTypeList.data;
this.categoryList.push(typeList);
// this.categoryList.push(typeList);
this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList);
},
@ -387,36 +391,41 @@
//
let res = await this.$request.listByStep({
goodsCategoryId: chosenCategory[2].goodsCategoryId
type: 1,
goodsCategoryId: chosenCategory[chosenCategory.length - 1].goodsCategoryId
});
this.formData.specsList = res.data;
},
async categoryColChange(e) {
let colObj = e.detail;
// if (colObj.column == 0) {
// //
// let subTypeList = await this.$request.listByStep({
// type: 1,
// goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
// });
// subTypeList = subTypeList.data;
// let subSubTypeList = await this.$request.listByStep({
// type: 1,
// goodsCategoryId: subTypeList[0].goodsCategoryId
// });
// subSubTypeList = subSubTypeList.data;
// this.categoryList.pop();
// this.categoryList.pop();
// this.categoryList.push(subTypeList);
// this.categoryList.push(subSubTypeList);
// this.categoryMultiIndex = [colObj.value, 0, 0];
// } else
if (colObj.column == 0) {
//
let subTypeList = await this.$request.listByStep({
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
});
subTypeList = subTypeList.data;
let subSubTypeList = await this.$request.listByStep({
goodsCategoryId: subTypeList[0].goodsCategoryId
});
subSubTypeList = subSubTypeList.data;
this.categoryList.pop();
this.categoryList.pop();
this.categoryList.push(subTypeList);
this.categoryList.push(subSubTypeList);
this.categoryMultiIndex = [colObj.value, 0, 0];
} else if (colObj.column == 1) {
//
let subSubTypeList = await this.$request.listByStep({
goodsCategoryId: this.categoryList[1][colObj.value].goodsCategoryId
type: 1,
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
});
subSubTypeList = subSubTypeList.data;
this.categoryList.pop();
this.categoryList.push(subSubTypeList);
this.categoryMultiIndex = [this.categoryMultiIndex[0], colObj.value, 0];
this.categoryMultiIndex = [colObj.value, 0];
}
},
async regionChange(e) {
@ -638,7 +647,7 @@
goodsName: this.formData.servName,
goodsDesc: this.formData.servDesc,
goodsUnit: this.formData.goodsUnit,
deptGoodsCategoryId: this.formData.category[2].goodsCategoryId,
deptGoodsCategoryId: this.formData.category[this.formData.category.length - 1].goodsCategoryId,
goodsStandardList: goodsStandardList,
goodsAreaList: goodsAreaList,
goodsImgUrl: this.formData.coverImgList[0],