|
|
|
@ -35,6 +35,12 @@ |
|
|
|
|
<el-input v-model="form.classificationName" /> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="供应商分类"> |
|
|
|
|
<el-cascader v-model="classificationId" |
|
|
|
|
:options="classifications" |
|
|
|
|
:props="{ checkStrictly: true, value: 'id',label: 'classificationName' }" |
|
|
|
|
clearable></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="供应商slogan"> |
|
|
|
|
<el-input type="textarea" |
|
|
|
|
rows="4" |
|
|
|
@ -70,15 +76,16 @@ |
|
|
|
|
<el-input type="textarea" |
|
|
|
|
rows="4" |
|
|
|
|
v-model="form.briefIntroduction" /> |
|
|
|
|
<Upload class="m-t-10" |
|
|
|
|
:limit="3" |
|
|
|
|
:file-list.sync="pics" |
|
|
|
|
:on-remove="handleAnnexRemove" |
|
|
|
|
@onSuccess="uploadPicSuccess"> |
|
|
|
|
<template slot="tip"> |
|
|
|
|
<p>最多选择3张图片</p> |
|
|
|
|
</template> |
|
|
|
|
</Upload> |
|
|
|
|
<el-upload class="m-t-10" |
|
|
|
|
action="#" |
|
|
|
|
list-type="picture-card" |
|
|
|
|
:on-remove="handlePicRemove" |
|
|
|
|
:limit="3" |
|
|
|
|
:file-list="pics" |
|
|
|
|
:on-exceed="handlePicExceed" |
|
|
|
|
:http-request="uploadPicSuccess"> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="二维码一"> |
|
|
|
|
<el-input v-model="form.qrCodeOneName" |
|
|
|
@ -187,11 +194,13 @@ export default { |
|
|
|
|
qrCodeTwoUrl: '', |
|
|
|
|
slogan: '', |
|
|
|
|
}, |
|
|
|
|
classificationId: [], |
|
|
|
|
provinceList: [], |
|
|
|
|
cityList: [], |
|
|
|
|
pics: [], |
|
|
|
|
editing: false, |
|
|
|
|
submiting: false, |
|
|
|
|
classifications: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -222,10 +231,47 @@ export default { |
|
|
|
|
methods: { |
|
|
|
|
getData () { |
|
|
|
|
this.$get(`${this.api.queryTeamInfo}?teamId=${this.teamId}`).then(res => { |
|
|
|
|
Object.assign(this.form, res.teamInfo) |
|
|
|
|
const data = res.teamInfo |
|
|
|
|
Object.assign(this.form, data) |
|
|
|
|
|
|
|
|
|
// 分类回显 |
|
|
|
|
const type = res.supplierClassification |
|
|
|
|
if (type && type.length) { |
|
|
|
|
this.classificationId = [type[0].supplierClassificationId] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 描述图片回显 |
|
|
|
|
if (data.pictureUrl) { |
|
|
|
|
const urls = data.pictureUrl.split(',') |
|
|
|
|
this.pics = urls.map(e => { |
|
|
|
|
return { |
|
|
|
|
name: e, |
|
|
|
|
url: e |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.getClassifications() |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取供应商分类 |
|
|
|
|
async getClassifications () { |
|
|
|
|
const { list } = await this.$post(this.api.treeStructureList) |
|
|
|
|
this.classifications = list[0].children |
|
|
|
|
this.handleClassifications(this.classifications, this.classificationId[0]) |
|
|
|
|
}, |
|
|
|
|
// 递归处理供应商分类 |
|
|
|
|
handleClassifications (list, id, parent) { |
|
|
|
|
for (const e of list) { |
|
|
|
|
if (e.id === id) { |
|
|
|
|
this.classificationId = parent ? [parent.id, e.id] : [e.id] |
|
|
|
|
// break |
|
|
|
|
} else { |
|
|
|
|
this.handleClassifications(e.children, id, e) |
|
|
|
|
} |
|
|
|
|
if (!e.children.length) delete e.children |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getProvince () { |
|
|
|
|
this.$get(this.api.queryProvince).then(res => { |
|
|
|
|
this.provinceList = res.list |
|
|
|
@ -277,11 +323,18 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 附件上传成功 |
|
|
|
|
uploadPicSuccess (file) { |
|
|
|
|
console.log(33, this.pics) |
|
|
|
|
// 简介自定义上传 |
|
|
|
|
async uploadPicSuccess ({ file }) { |
|
|
|
|
Oss.upload(file).then(({ url }) => { |
|
|
|
|
this.pics.push({ |
|
|
|
|
url |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handlePicExceed (files, fileList) { |
|
|
|
|
Util.warningMsg(`当前限制选择 3 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
handleAnnexRemove (file, fileList) { |
|
|
|
|
handlePicRemove (file, fileList) { |
|
|
|
|
Oss.del(file.url) |
|
|
|
|
this.pics = fileList |
|
|
|
|
}, |
|
|
|
@ -292,6 +345,21 @@ export default { |
|
|
|
|
if (!form.classificationName) return Util.warningMsg('请输入供应商名称') |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
this.submiting = true |
|
|
|
|
|
|
|
|
|
// 简介图片处理 |
|
|
|
|
if (this.pics) { |
|
|
|
|
form.pictureUrl = this.pics.map(e => e.url).join() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 选择了供应商分类,则保存分类 |
|
|
|
|
const type = this.classificationId |
|
|
|
|
if (type.length) { |
|
|
|
|
form.supplierClassificationConfigs = [ |
|
|
|
|
{ |
|
|
|
|
classificationId: type[type.length - 1] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
await this.$post(this.api.updateTeamInfo, form).then(res => { |
|
|
|
|
Util.successMsg('保存成功!'); |
|
|
|
|