|
@@ -5,7 +5,7 @@
|
|
<!-- 自定义的二级文字标题 -->
|
|
<!-- 自定义的二级文字标题 -->
|
|
<template slot="subTitle">
|
|
<template slot="subTitle">
|
|
<a id="promotionEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" />返回列表</a>
|
|
<a id="promotionEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" />返回列表</a>
|
|
- <span v-if="$route.params.sn" style="margin: 0 10px 0 20px;color: #666;font-size: 14px;font-weight: 600;">促销名称:{{ promotionName||'--' }}</span>
|
|
|
|
|
|
+ <span v-if="$route.params.sn" style="margin: 0 10px 0 20px;color: #666;font-size: 14px;font-weight: 600;">促销名称:{{ form.bannerName||'--' }}</span>
|
|
</template>
|
|
</template>
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
@@ -37,7 +37,7 @@
|
|
:format="dateFormat"
|
|
:format="dateFormat"
|
|
id="promotionEdit-time"
|
|
id="promotionEdit-time"
|
|
@change="dateChange"
|
|
@change="dateChange"
|
|
- :disabled="isDisabled"
|
|
|
|
|
|
+ :disabled="$route.params.sn"
|
|
:disabled-date="disabledDate"
|
|
:disabled-date="disabledDate"
|
|
:placeholder="['开始时间', '结束时间']" />
|
|
:placeholder="['开始时间', '结束时间']" />
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
@@ -47,7 +47,6 @@
|
|
<a-input-number
|
|
<a-input-number
|
|
style="width:40%"
|
|
style="width:40%"
|
|
id="promotionEdit-sort"
|
|
id="promotionEdit-sort"
|
|
- :disabled="isDisabled"
|
|
|
|
allowClear
|
|
allowClear
|
|
placeholder="请输入轮播图排序数字(数字越大越靠后)"
|
|
placeholder="请输入轮播图排序数字(数字越大越靠后)"
|
|
v-model="form.sort"
|
|
v-model="form.sort"
|
|
@@ -65,20 +64,21 @@
|
|
v-model="form.allDealerFlag"
|
|
v-model="form.allDealerFlag"
|
|
placeholder="请选择参与经销商"
|
|
placeholder="请选择参与经销商"
|
|
@change="changeDealerScope"
|
|
@change="changeDealerScope"
|
|
|
|
+ :disabled="$route.params.sn"
|
|
allowClear>
|
|
allowClear>
|
|
<a-select-option id="promotionList-dealerScope-all" value="1">全部经销商</a-select-option>
|
|
<a-select-option id="promotionList-dealerScope-all" value="1">全部经销商</a-select-option>
|
|
<a-select-option id="promotionList-dealerScope-some" value="0">部分经销商</a-select-option>
|
|
<a-select-option id="promotionList-dealerScope-some" value="0">部分经销商</a-select-option>
|
|
</a-select>
|
|
</a-select>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="2" :sm="24" v-show="form.allDealerFlag && form.allDealerFlag!='1' ">
|
|
<a-col :md="2" :sm="24" v-show="form.allDealerFlag && form.allDealerFlag!='1' ">
|
|
- <a-button id="promotionList-basicInfo-dealerScope" type="primary" :loading="spinning" @click="handleDealerModal">选择</a-button>
|
|
|
|
|
|
+ <a-button id="promotionList-basicInfo-dealerScope" type="primary" :loading="spinning" :disabled="$route.params.sn" @click="handleDealerModal">选择</a-button>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="5" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
<a-col :md="5" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
已{{ chooseDealerList.length }}选项
|
|
已{{ chooseDealerList.length }}选项
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="24" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
<a-col :md="24" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
<div class="buyerBox">
|
|
<div class="buyerBox">
|
|
- <a-tag closable v-for="con in chooseDealerList" id="promotionList-dealerSn" :key="con.dealerSn" @close="delBuyerName(con)">
|
|
|
|
|
|
+ <a-tag :closable="$route.params.sn" v-for="con in chooseDealerList" id="promotionList-dealerSn" :key="con.dealerSn" @close="delBuyerName(con)">
|
|
{{ con.dealerName }}
|
|
{{ con.dealerName }}
|
|
</a-tag>
|
|
</a-tag>
|
|
</div>
|
|
</div>
|
|
@@ -107,17 +107,20 @@
|
|
id="promotion-contentType"
|
|
id="promotion-contentType"
|
|
code="PROMO_CONTENT_TYPE"
|
|
code="PROMO_CONTENT_TYPE"
|
|
showType="radio"
|
|
showType="radio"
|
|
|
|
+ :disabled="$route.params.sn"
|
|
allowClear></v-select>
|
|
allowClear></v-select>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
<a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'">
|
|
<a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'">
|
|
<editor
|
|
<editor
|
|
|
|
+ v-show="!$route.params.sn"
|
|
id="promotionEdit-editor"
|
|
id="promotionEdit-editor"
|
|
ref="editor"
|
|
ref="editor"
|
|
class="promotionEdit-editor"
|
|
class="promotionEdit-editor"
|
|
@on-change="editorChange"
|
|
@on-change="editorChange"
|
|
:cache="false"></editor>
|
|
:cache="false"></editor>
|
|
|
|
+ <div style="border:1px solid #efefef;border-radius:8px;padding:10px 20px;" v-if="$route.params.sn" v-html="form.content"></div>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
<a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'">
|
|
<a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'">
|
|
<Upload
|
|
<Upload
|
|
@@ -126,6 +129,7 @@
|
|
v-model="form.content"
|
|
v-model="form.content"
|
|
fileType="video/mp4"
|
|
fileType="video/mp4"
|
|
ref="videoSet"
|
|
ref="videoSet"
|
|
|
|
+ :disabled="$route.params.sn"
|
|
:fileSize="100"
|
|
:fileSize="100"
|
|
:maxNums="1"
|
|
:maxNums="1"
|
|
@change="changeVideo"
|
|
@change="changeVideo"
|
|
@@ -171,9 +175,7 @@ import { VSelect, Upload } from '@/components'
|
|
import Editor from '@/components/WEeditor'
|
|
import Editor from '@/components/WEeditor'
|
|
import chooseDealer from './chooseDealer'
|
|
import chooseDealer from './chooseDealer'
|
|
// 接口
|
|
// 接口
|
|
-import { productTypeQuery } from '@/api/productType'
|
|
|
|
-import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
|
|
|
|
-import { saveShopBanner } from '@/api/shopBanner'
|
|
|
|
|
|
+import { saveShopBanner, shopBannerDetail } from '@/api/shopBanner'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'ProductBrandEditModal',
|
|
name: 'ProductBrandEditModal',
|
|
@@ -201,8 +203,10 @@ export default {
|
|
allDealerFlag: '1', // 参与经销商 0 部分 1全部
|
|
allDealerFlag: '1', // 参与经销商 0 部分 1全部
|
|
dealerSnList: [], // 已选经销商sn列表
|
|
dealerSnList: [], // 已选经销商sn列表
|
|
imageUrl: '', // 图片
|
|
imageUrl: '', // 图片
|
|
- contentType: 'IMAGE_CONTENT', // 内容类型
|
|
|
|
- content: '' // 内容
|
|
|
|
|
|
+ contentType: 'LINK', // 内容类型
|
|
|
|
+ content: '', // 内容
|
|
|
|
+ contentLink: '/pagesB/promoDetail',
|
|
|
|
+ state: 'UNPUBLISH'
|
|
},
|
|
},
|
|
|
|
|
|
dateFormat: 'YYYY-MM-DD', // 有效期时间格式
|
|
dateFormat: 'YYYY-MM-DD', // 有效期时间格式
|
|
@@ -227,6 +231,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 部分经销商 选择经销商成功
|
|
addDealerOk (list) {
|
|
addDealerOk (list) {
|
|
const dealerArr = list.map(item => {
|
|
const dealerArr = list.map(item => {
|
|
return {
|
|
return {
|
|
@@ -241,7 +246,7 @@ export default {
|
|
disabledDate (current) {
|
|
disabledDate (current) {
|
|
return current && current < moment().startOf('day')
|
|
return current && current < moment().startOf('day')
|
|
},
|
|
},
|
|
- // 券有效期时间
|
|
|
|
|
|
+ // 轮播时间
|
|
dateChange (date, dateString) {
|
|
dateChange (date, dateString) {
|
|
this.form.time = date
|
|
this.form.time = date
|
|
if (dateString[0] != '' && dateString[1] != '') {
|
|
if (dateString[0] != '' && dateString[1] != '') {
|
|
@@ -249,89 +254,37 @@ export default {
|
|
this.form.bannerEndDate = dateString[1] + ' 23:59:59'
|
|
this.form.bannerEndDate = dateString[1] + ' 23:59:59'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 关闭 选择经销商弹窗
|
|
closeDealerModal () {
|
|
closeDealerModal () {
|
|
this.openDealerModal = false
|
|
this.openDealerModal = false
|
|
},
|
|
},
|
|
|
|
+ // 打开 选择经销商弹窗
|
|
handleDealerModal () {
|
|
handleDealerModal () {
|
|
this.openDealerModal = true
|
|
this.openDealerModal = true
|
|
},
|
|
},
|
|
changeDealerScope () {},
|
|
changeDealerScope () {},
|
|
- // 打开产品弹窗
|
|
|
|
- insterProduct (obj) {
|
|
|
|
- if (obj && Object.keys(obj).length > 0) {
|
|
|
|
- this.chooseTypeList = obj.typeArr
|
|
|
|
- }
|
|
|
|
- this.showProModal = true
|
|
|
|
- },
|
|
|
|
- // 关闭产品弹窗
|
|
|
|
- closeProductModal () {
|
|
|
|
- this.showProModal = false
|
|
|
|
- },
|
|
|
|
// 返回列表
|
|
// 返回列表
|
|
handleBack () {
|
|
handleBack () {
|
|
this.$router.push({ name: 'carouselImageList', query: { closeLastOldTab: true } })
|
|
this.$router.push({ name: 'carouselImageList', query: { closeLastOldTab: true } })
|
|
},
|
|
},
|
|
- // 详情 挨个赋值原因:该接口和修理厂促销列表详情用的同一个接口,给后端传值过滤多余参数
|
|
|
|
|
|
+ // 详情
|
|
getDetail () {
|
|
getDetail () {
|
|
const _this = this
|
|
const _this = this
|
|
- promoActiveDetail({ sn: this.$route.params.sn }).then(res => {
|
|
|
|
|
|
+ shopBannerDetail({ bannerSn: this.$route.params.sn }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- // 编辑按钮时,publishState 已发布,只能编辑是否发布;publishState已关闭,都可以编辑
|
|
|
|
- if (_this.pageType === 'edit') {
|
|
|
|
- _this.isDisabled = res.data.publishState === 'PUBLISH'
|
|
|
|
- _this.form.promoRule.publishFlag = res.data.publishFlag
|
|
|
|
- _this.form.promoRule.dealerEditFlag = res.data.dealerEditFlag
|
|
|
|
- }
|
|
|
|
- _this.form.publishFlag = res.data.publishFlag
|
|
|
|
- _this.form.dealerEditFlag = res.data.dealerEditFlag
|
|
|
|
- _this.form.promoActiveSn = res.data.promoActiveSn
|
|
|
|
- _this.form.title = res.data.title
|
|
|
|
- _this.form.contentType = res.data.contentType
|
|
|
|
- _this.form.sort = res.data.sort
|
|
|
|
- _this.imageSet = res.data.imageSet
|
|
|
|
- if (res.data.imageSet) {
|
|
|
|
- const images = res.data.imageSet.join(',')
|
|
|
|
- _this.form.imageSet = images
|
|
|
|
- if (this.pageType === 'add' || (this.pageType === 'edit' && res.data.publishState != 'PUBLISH')) {
|
|
|
|
- _this.$refs.imageSet.setFileList(images)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- _this.form.content = res.data.content
|
|
|
|
- _this.promotionName = res.data.name || ''
|
|
|
|
- _this.form.dealerEditFlag = res.data.dealerEditFlag
|
|
|
|
if (res.data.contentType == 'IMAGE_CONTENT') {
|
|
if (res.data.contentType == 'IMAGE_CONTENT') {
|
|
_this.$refs.editor.setHtml(res.data.content)
|
|
_this.$refs.editor.setHtml(res.data.content)
|
|
} else if (res.data.contentType == 'VIDEO') {
|
|
} else if (res.data.contentType == 'VIDEO') {
|
|
- if (res.data.publishState != 'PUBLISH') {
|
|
|
|
- _this.$refs.videoSet.setFileList(res.data.content)
|
|
|
|
- }
|
|
|
|
|
|
+ _this.$refs.videoSet.setFileList(res.data.content)
|
|
} else if (res.data.contentType == 'LINK') {
|
|
} else if (res.data.contentType == 'LINK') {
|
|
_this.form.contentLink = res.data.content
|
|
_this.form.contentLink = res.data.content
|
|
- _this.form.linkType = res.data.content != '/pagesB/promoDetail' ? '2' : '1'
|
|
|
|
- if (res.data.promoRule) {
|
|
|
|
- _this.isShowNextStep = true
|
|
|
|
- _this.form.promoRule.range = '1'
|
|
|
|
- _this.time = [res.data.promoRule.validStartDate, res.data.promoRule.validEndDate]
|
|
|
|
- if (res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.length > 0) {
|
|
|
|
- _this.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- _this.form.promoRule = { ..._this.form.promoRule, ...res.data.promoRule }
|
|
|
|
}
|
|
}
|
|
|
|
+ _this.$refs.imageSet.setFileList(res.data.imageUrl)
|
|
|
|
+ _this.form = res.data
|
|
|
|
+ _this.form.time = [res.data.bannerStartDate, res.data.bannerEndDate]
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 券有效期 change
|
|
|
|
- handleValidType (con) {
|
|
|
|
- this.form.promoRule.validType = con
|
|
|
|
- if (con === 'FIXED') {
|
|
|
|
- this.form.promoRule.validDays = undefined
|
|
|
|
- } else {
|
|
|
|
- this.time = []
|
|
|
|
- this.form.promoRule.validStartDate = undefined
|
|
|
|
- this.form.promoRule.validEndDate = undefined
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
// 确定保存 验证必填
|
|
// 确定保存 验证必填
|
|
handleSave (type) {
|
|
handleSave (type) {
|
|
const _this = this
|
|
const _this = this
|
|
@@ -341,7 +294,6 @@ export default {
|
|
// 验证组件必填项
|
|
// 验证组件必填项
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- console.log('111111111:')
|
|
|
|
_this.savePartInfo(type)
|
|
_this.savePartInfo(type)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -356,10 +308,10 @@ export default {
|
|
}
|
|
}
|
|
_this.form.dealerSnList = _this.chooseDealerList.map(con => con.dealerSn)
|
|
_this.form.dealerSnList = _this.chooseDealerList.map(con => con.dealerSn)
|
|
}
|
|
}
|
|
- console.log('222222:', _this.form)
|
|
|
|
_this.form.bannerSn = _this.$route.params.sn || undefined
|
|
_this.form.bannerSn = _this.$route.params.sn || undefined
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
delete formData.time
|
|
delete formData.time
|
|
|
|
+ delete formData.contentLink
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
saveShopBanner(formData).then(res => {
|
|
saveShopBanner(formData).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
@@ -409,8 +361,10 @@ export default {
|
|
allDealerFlag: '1', // 参与经销商 0 部分 1全部
|
|
allDealerFlag: '1', // 参与经销商 0 部分 1全部
|
|
dealerSnList: [], // 已选经销商sn列表
|
|
dealerSnList: [], // 已选经销商sn列表
|
|
imageUrl: '', // 图片
|
|
imageUrl: '', // 图片
|
|
- contentType: 'IMAGE_CONTENT', // 内容类型
|
|
|
|
- content: '' // 内容
|
|
|
|
|
|
+ contentType: 'LINK', // 内容类型
|
|
|
|
+ content: '', // 内容
|
|
|
|
+ contentLink: '/pagesB/promoDetail',
|
|
|
|
+ state: 'UNPUBLISH'
|
|
}
|
|
}
|
|
this.isShowNextStep = false
|
|
this.isShowNextStep = false
|
|
this.isDisabled = false
|
|
this.isDisabled = false
|
|
@@ -421,93 +375,11 @@ export default {
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 获取产品范围数据
|
|
|
|
- getTreeData () {
|
|
|
|
- productTypeQuery({}).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.productTypeList = res.data
|
|
|
|
- } else {
|
|
|
|
- this.productTypeList = []
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 填入link内容
|
|
|
|
- handleLink (con) {
|
|
|
|
- if (!con.target.value || con.target.value != '/pagesB/promoDetail') {
|
|
|
|
- this.form.linkType = '2'
|
|
|
|
- } else {
|
|
|
|
- this.form.linkType = '1'
|
|
|
|
- }
|
|
|
|
- this.form.contentLink = con.target.value
|
|
|
|
- },
|
|
|
|
- // 选择货架促销填入默认值
|
|
|
|
- handleLinkType (val) {
|
|
|
|
- this.form.contentLink = val === '2' ? '' : '/pagesB/promoDetail'
|
|
|
|
- },
|
|
|
|
- // 添加产品
|
|
|
|
- handleAddProduct () {
|
|
|
|
- this.chooseTypeList = this.productRangeList
|
|
|
|
- this.showProModal = true
|
|
|
|
- },
|
|
|
|
- // 批量添加
|
|
|
|
- handleBatchAdd () {
|
|
|
|
- if (!this.form.promoRule.ruleValue) {
|
|
|
|
- this.$message.warning('请输入返券金额(需大于0)!')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.$refs.chooseProductList.editMorePrice(this.form.promoRule.ruleValue)
|
|
|
|
- },
|
|
|
|
- // 添加产品成功
|
|
|
|
- addProductSuccess (list) {
|
|
|
|
- const productArr = list.map(item => {
|
|
|
|
- return {
|
|
|
|
- promoActiveSn: this.$route.params.sn,
|
|
|
|
- promoRuleSn: this.form.promoRule.promoRuleSn,
|
|
|
|
- productCode: item.code,
|
|
|
|
- productSn: item.productSn,
|
|
|
|
- ruleValue: this.form.promoRule.ruleValue,
|
|
|
|
- price: item.terminalPrice
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- promoCreateBatch(productArr).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.showProModal = false
|
|
|
|
- // 获取产品列表 有分页
|
|
|
|
- this.$refs.chooseProductList.pageInit()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 选择产品范围
|
|
|
|
- onChangeTree (e) {
|
|
|
|
- deleteByProductType({ promoActiveSn: this.$route.params.sn, productTypeSnList: this.productRangeList || [] }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.$refs.chooseProductList.pageInit()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- // 保存产品范围
|
|
|
|
- const newArr = this.productRangeList.map(item => {
|
|
|
|
- return {
|
|
|
|
- promoActiveSn: this.$route.params.sn,
|
|
|
|
- promoRuleSn: this.form.promoRule.promoRuleSn,
|
|
|
|
- productTypeSn: item
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- saveBatchEntity({ list: newArr, promoActiveSn: this.$route.params.sn }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- console.log('保存产品范围成功')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
// 初始化
|
|
// 初始化
|
|
pageInit () {
|
|
pageInit () {
|
|
- this.pageType = this.$route.params.pageType
|
|
|
|
- if (this.pageType === 'edit') {
|
|
|
|
|
|
+ if (this.$route.params.sn) {
|
|
this.getDetail()
|
|
this.getDetail()
|
|
}
|
|
}
|
|
- console.log('加载产品范围')
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.getTreeData()
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|