|
|
@@ -104,6 +104,7 @@
|
|
|
treeLeft: [], //一级列表
|
|
|
showText: '',
|
|
|
classifyList: [],
|
|
|
+ categoryId: '',
|
|
|
qualificationNameMap: []
|
|
|
}
|
|
|
},
|
|
|
@@ -115,25 +116,32 @@
|
|
|
if (data.params) {
|
|
|
let obj = JSON.parse(decodeURIComponent(data.params));
|
|
|
this.form = obj
|
|
|
- this.qualificationNameMap = this.form.qualificationNameListDTOS;
|
|
|
- this.qualificationNameMap.forEach((item) => {
|
|
|
- this.showText += item.categoryName + ' / '
|
|
|
- item.qualificationNameCategoryDTOS?.forEach((row) => {
|
|
|
- // row.special = '';
|
|
|
- row.imgList = [];
|
|
|
- row.imgList.push({
|
|
|
- url: row.special,
|
|
|
+ console.log('onLoad',obj)
|
|
|
+ const list = this.form.qualificationNameListDTOS || []
|
|
|
+ this.qualificationNameMap = list
|
|
|
+ if (list.length) {
|
|
|
+ this.classifyList = list.map((item) => item.categoryId).filter(Boolean)
|
|
|
+ this.categoryId = this.classifyList.join(',')
|
|
|
+ list.forEach((item) => {
|
|
|
+ this.showText += item.categoryName + ' / '
|
|
|
+ item.qualificationNameCategoryDTOS?.forEach((row) => {
|
|
|
+ row.imgList = [];
|
|
|
+ row.imgList.push({
|
|
|
+ url: row.special,
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- // this.specialImg = obj.special
|
|
|
+ } else if (this.form.categoryId) {
|
|
|
+ this.categoryId = this.form.categoryId
|
|
|
+ this.classifyList = this.form.categoryId.split(',').filter(Boolean)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
getTree() {
|
|
|
this.$http.get('/sys/category/loadTreeRoot?pcode=' + 'c09' + '&async=' + false).then(res => {
|
|
|
- this.treeData = res.data.result
|
|
|
- console.log(this.treeData)
|
|
|
+ // 只展示一级分类,去掉子级
|
|
|
+ this.treeData = (res.data.result || []).map(({ children, ...item }) => item)
|
|
|
})
|
|
|
},
|
|
|
showPicker() {
|
|
|
@@ -149,8 +157,8 @@
|
|
|
},
|
|
|
//监听选择(ids为数组)
|
|
|
selectChange(ids, names) {
|
|
|
- console.log(ids, names)
|
|
|
this.classifyList = ids
|
|
|
+ this.categoryId = ids.join(',')
|
|
|
this.showText = names
|
|
|
this.selectClassify()
|
|
|
},
|
|
|
@@ -160,7 +168,12 @@
|
|
|
let categoryNames = this.showText
|
|
|
this.$http.get('/localQualificationClassifica/localQualificationClassifica/getByCategoryId?categoryIds=' +
|
|
|
categoryIds + '&merchantId=' + merchantId + '&categoryNames=' + categoryNames).then(res => {
|
|
|
- this.qualificationNameMap = res.data.result
|
|
|
+ this.qualificationNameMap = res.data.result || []
|
|
|
+ const ids = this.qualificationNameMap.map((item) => item.categoryId).filter(Boolean)
|
|
|
+ if (ids.length) {
|
|
|
+ this.classifyList = ids
|
|
|
+ this.categoryId = ids.join(',')
|
|
|
+ }
|
|
|
this.qualificationNameMap.forEach((item) => {
|
|
|
item.qualificationNameCategoryDTOS?.forEach((row) => {
|
|
|
row.special = row.special ? row.special : '';
|
|
|
@@ -218,34 +231,42 @@
|
|
|
let hasEmptyImage = false;
|
|
|
this.qualificationNameMap.forEach((item) => {
|
|
|
item.qualificationNameCategoryDTOS?.forEach((row) => {
|
|
|
- console.log(row);
|
|
|
- // if (row.imgList[0]?.response) {
|
|
|
- // row.special = import.meta.env.VITE_GLOB_DOMAIN_URL + '/' + row.imgList[0].response.message;
|
|
|
- // }
|
|
|
-
|
|
|
- // 检查图片是否为空
|
|
|
if (!row.special) {
|
|
|
hasEmptyImage = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ const categoryId = this.categoryId ||
|
|
|
+ this.classifyList.filter(Boolean).join(',') ||
|
|
|
+ this.qualificationNameMap.map((item) => item.categoryId).filter(Boolean).join(',')
|
|
|
+ if (!categoryId) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请选择分类'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const categoryIds = categoryId.split(',').filter(Boolean)
|
|
|
+ const qualificationNameListDTOS = this.qualificationNameMap.map((item, index) => ({
|
|
|
+ ...item,
|
|
|
+ categoryId: item.categoryId || categoryIds[index] || categoryId
|
|
|
+ }))
|
|
|
let data = {
|
|
|
merchantId: uni.getStorageSync(USER_INFO).merchantId,
|
|
|
merchantUserId: this.form.merchantUserId,
|
|
|
merchantUserName: this.form.merchantUserName,
|
|
|
- // special: this.specialImage[0].url,
|
|
|
- qualificationNameListDTOS: this.qualificationNameMap,
|
|
|
+ categoryId,
|
|
|
+ qualificationNameListDTOS,
|
|
|
source: 1,
|
|
|
};
|
|
|
- console.log(data);
|
|
|
-
|
|
|
- if (hasEmptyImage) {
|
|
|
- // message.error('请上传全部图片');
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- message: '请上传全部图片'
|
|
|
- })
|
|
|
- } else {
|
|
|
+
|
|
|
+
|
|
|
+ // if (hasEmptyImage) {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: 'none',
|
|
|
+ // title: '请上传全部图片'
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
if (this.form.specialStatus == null) {
|
|
|
this.$http.post('/merchant/localMerchantSpecial/add', data).then(res => {
|
|
|
if (res.data.success) {
|
|
|
@@ -288,7 +309,7 @@
|
|
|
// this.$http.post('/merchant/examine/new/special/check', data).then((res) => {
|
|
|
// // this.getDetail();
|
|
|
// });
|
|
|
- }
|
|
|
+ // }
|
|
|
|
|
|
// let data = {
|
|
|
// merchantId: uni.getStorageSync(USER_INFO).merchantId,
|