|
|
|
@ -53,6 +53,7 @@ |
|
|
|
|
<el-radio label="2">外链接</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
{{ form.correspondingLinkId }} |
|
|
|
|
<el-form-item v-if="form.link === '1'" |
|
|
|
|
class="req" |
|
|
|
|
label="链接内容"> |
|
|
|
@ -67,7 +68,34 @@ |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<template v-if="form.selectLinkId === '1'"> |
|
|
|
|
<el-select class="m-l-20" |
|
|
|
|
style="width: 150px" |
|
|
|
|
placeholder="请选择供应商" |
|
|
|
|
v-model="form.correspondingLinkId" |
|
|
|
|
filterable |
|
|
|
|
@change="getGoods"> |
|
|
|
|
<el-option v-for="item in linkDetails" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-select class="m-l-20" |
|
|
|
|
style="width: 150px" |
|
|
|
|
placeholder="请选择商品" |
|
|
|
|
v-model="form.goodsId" |
|
|
|
|
clearable |
|
|
|
|
filterable> |
|
|
|
|
<el-option v-for="item in goods" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</template> |
|
|
|
|
<el-select v-else |
|
|
|
|
class="m-l-20" |
|
|
|
|
v-model="form.correspondingLinkId" |
|
|
|
|
clearable |
|
|
|
|
filterable> |
|
|
|
@ -112,6 +140,7 @@ export default { |
|
|
|
|
originForm: {}, |
|
|
|
|
form: { |
|
|
|
|
correspondingLinkId: '', |
|
|
|
|
goodsId: '', |
|
|
|
|
coverUrl: '', |
|
|
|
|
details: '1', |
|
|
|
|
description: '', |
|
|
|
@ -139,6 +168,7 @@ export default { |
|
|
|
|
name: '店铺' |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
goods: [], |
|
|
|
|
linkDetails: [], |
|
|
|
|
submiting: false, |
|
|
|
|
updateTime: 0, |
|
|
|
@ -179,7 +209,20 @@ export default { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// 商品id |
|
|
|
|
if (data.selectLinkId === '1' && data.correspondingLinkId.includes(',')) { |
|
|
|
|
const linkId = data.correspondingLinkId.split(',') |
|
|
|
|
data.correspondingLinkId = +linkId[0] |
|
|
|
|
if (linkId.length > 1) { |
|
|
|
|
data.goodsId = +linkId[1] |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
data.correspondingLinkId = +data.correspondingLinkId |
|
|
|
|
} |
|
|
|
|
if (!data.correspondingLinkId) data.correspondingLinkId = '' |
|
|
|
|
if (!data.goodsId) data.goodsId = '' |
|
|
|
|
this.form = data |
|
|
|
|
data.goodsId && this.getGoods() |
|
|
|
|
this.getDetails() |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
@ -187,18 +230,6 @@ export default { |
|
|
|
|
async getDetails (id) { |
|
|
|
|
if (id) this.form.correspondingLinkId = '' |
|
|
|
|
const { selectLinkId } = this.form |
|
|
|
|
// if (selectLinkId === '1') { |
|
|
|
|
// const { data } = await this.$get(this.api.prodList, { |
|
|
|
|
// current: 1, |
|
|
|
|
// size: 1000, |
|
|
|
|
// status: '', |
|
|
|
|
// }) |
|
|
|
|
// data.records.forEach(e => { |
|
|
|
|
// e.name = e.competitionName |
|
|
|
|
// e.id = +e.id |
|
|
|
|
// }) |
|
|
|
|
// this.linkDetails = data.records |
|
|
|
|
// } else |
|
|
|
|
if (selectLinkId === '2') { // 活动列表 |
|
|
|
|
const { data } = await this.$post(this.api.postLoginActivity, { |
|
|
|
|
pageNum: 1, |
|
|
|
@ -206,11 +237,11 @@ export default { |
|
|
|
|
listType: 0, |
|
|
|
|
}) |
|
|
|
|
data.records.forEach(e => { |
|
|
|
|
e.name = e.competitionName |
|
|
|
|
e.id = +e.id |
|
|
|
|
e.name = e.competitionName |
|
|
|
|
}) |
|
|
|
|
this.linkDetails = data.records |
|
|
|
|
} else if (selectLinkId === '3') { // 供应商 |
|
|
|
|
} else if (selectLinkId === '1' || selectLinkId === '3') { // 供应商 |
|
|
|
|
const { data } = await this.$post(this.api.selectEnterpriseCertificationList, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 1000, |
|
|
|
@ -218,13 +249,29 @@ export default { |
|
|
|
|
}) |
|
|
|
|
data.records.forEach(e => { |
|
|
|
|
e.name = e.companyName |
|
|
|
|
e.id = +e.teamId |
|
|
|
|
e.id = e.teamId |
|
|
|
|
}) |
|
|
|
|
this.linkDetails = data.records |
|
|
|
|
} else { |
|
|
|
|
this.linkDetails = [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 查询商品 |
|
|
|
|
async getGoods (id) { |
|
|
|
|
if (id) this.form.goodsId = '' |
|
|
|
|
if (this.form.correspondingLinkId) { |
|
|
|
|
const { page } = await this.$get(this.api.prodList, { |
|
|
|
|
current: 1, |
|
|
|
|
size: 1000, |
|
|
|
|
shopId: this.form.correspondingLinkId |
|
|
|
|
}) |
|
|
|
|
page.records.forEach(e => { |
|
|
|
|
e.name = e.prodName |
|
|
|
|
e.id = e.prodId |
|
|
|
|
}) |
|
|
|
|
this.goods = page.records |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 清除链接详情 |
|
|
|
|
clearDetails () { |
|
|
|
|
this.form.correspondingLinkId = '' |
|
|
|
@ -259,13 +306,15 @@ export default { |
|
|
|
|
// 提交 |
|
|
|
|
save (status) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const { form } = this |
|
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
|
if (!form.productName) return Util.warningMsg('请填写产品名称'); |
|
|
|
|
// 发布需要校验 |
|
|
|
|
if (status) { |
|
|
|
|
if (!this.pics.length) return Util.warningMsg('请上传封面图'); |
|
|
|
|
if (form.details === '1' && !form.description) return Util.warningMsg('请填写详情内容'); |
|
|
|
|
} |
|
|
|
|
if (form.selectLinkId === '1' && form.correspondingLinkId && form.goodsId) form.correspondingLinkId = form.correspondingLinkId + ',' + form.goodsId |
|
|
|
|
|
|
|
|
|
form.coverUrl = this.pics.map(e => e.url).join() |
|
|
|
|
form.publishStatus = status |
|
|
|
|
this.submiting = true |
|
|
|
|