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