|
@@ -19,7 +19,7 @@
|
|
|
<a-card :bordered="false" class="promotionEdit-cont">
|
|
|
<a-row>
|
|
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
|
|
- <a-form-model-item label="标题名称" prop="title">
|
|
|
+ <a-form-model-item label="标题" prop="title">
|
|
|
<a-input
|
|
|
id="promotionEdit-title"
|
|
|
:maxLength="30"
|
|
@@ -89,7 +89,7 @@
|
|
|
class="promotionEdit-editor"
|
|
|
@on-change="editorChange"
|
|
|
:cache="false"></editor>
|
|
|
- <div v-show="(pageType === 'edit'||pageType === 'see')&&isDisabled" class="box" v-html="form.content"></div>
|
|
|
+ <div v-if="(pageType === 'edit'||pageType === 'see')&&isDisabled" class="box" v-html="form.content"></div>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
<Upload
|
|
@@ -208,6 +208,7 @@
|
|
|
:chooseType="chooseTypeList"
|
|
|
:chooseData="chooseDataList"
|
|
|
:openModal="showProModal"
|
|
|
+ v-if="pageType!='see'"
|
|
|
@ok="addProductSuccess"
|
|
|
@close="closeProductModal"></chooseProduct>
|
|
|
</div>
|
|
@@ -241,7 +242,7 @@ export default {
|
|
|
content: '', // 内容
|
|
|
contentLink: '', // 链接内容
|
|
|
sort: undefined, // 排序
|
|
|
- ruleEnableFlag: undefined, // 参数配置 1勾选配置 0不能配置
|
|
|
+ ruleEnableFlag: '0', // 参数配置 1勾选配置 0不能配置
|
|
|
publishState: 'UNPUBLISH',
|
|
|
dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
// 参数配置数据
|
|
@@ -292,9 +293,6 @@ export default {
|
|
|
],
|
|
|
dealerEditFlag: [
|
|
|
{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }
|
|
|
- ],
|
|
|
- showFlag: [
|
|
|
- { required: true, message: '请选择是否显示', trigger: 'change' }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
@@ -302,15 +300,39 @@ export default {
|
|
|
methods: {
|
|
|
// 设置参数
|
|
|
onChangeParams (e) {
|
|
|
- this.isShowParams = e.target.checked
|
|
|
- this.form.ruleEnableFlag = e.target.checked ? '1' : '0'
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.setContent.addCouponCon()
|
|
|
- })
|
|
|
+ const _this = this
|
|
|
+ _this.isShowParams = e.target.checked
|
|
|
+ _this.form.ruleEnableFlag = e.target.checked ? '1' : '0'
|
|
|
+ if (_this.pageType === 'add') {
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ _this.$refs.setContent.addCouponCon()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (!e.target.checked) {
|
|
|
+ _this.$refs.setContent.clearContent()
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ _this.$refs.setContent.addCouponCon()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // _this.$confirm({
|
|
|
+ // title: '提示',
|
|
|
+ // content: '改变参数配置,参数配置内容将清空,确认改变吗?',
|
|
|
+ // centered: true,
|
|
|
+ // onOk () {
|
|
|
+ // },
|
|
|
+ // onCancel () {
|
|
|
+ // _this.isShowParams = !e.target.checked
|
|
|
+ // _this.form.ruleEnableFlag = e.target.checked ? '1' : '0'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
// 打开产品弹窗
|
|
|
- insterProduct (typeList) {
|
|
|
- this.chooseTypeList = typeList
|
|
|
+ insterProduct (obj) {
|
|
|
+ if (obj && Object.keys(obj).length > 0) {
|
|
|
+ this.chooseTypeList = obj.typeArr
|
|
|
+ this.chooseDataList = obj.productArr
|
|
|
+ }
|
|
|
this.showProModal = true
|
|
|
},
|
|
|
// 添加产品成功
|
|
@@ -319,7 +341,6 @@ export default {
|
|
|
return { productCode: item.code,
|
|
|
productSn: item.productSn }
|
|
|
})
|
|
|
- this.chooseDataList = list.map(item => item.productSn)
|
|
|
this.$refs.setContent.setProductSn(productArr)
|
|
|
},
|
|
|
closeProductModal () {
|
|
@@ -352,13 +373,14 @@ export default {
|
|
|
_this.form.promoActiveSn = res.data.promoActiveSn
|
|
|
_this.form.title = res.data.title
|
|
|
_this.form.contentType = res.data.contentType
|
|
|
- _this.form.showFlag = res.data.showFlag
|
|
|
_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
|
|
|
- _this.$refs.imageSet.setFileList(images)
|
|
|
+ if (this.pageType != 'see') {
|
|
|
+ _this.$refs.imageSet.setFileList(images)
|
|
|
+ }
|
|
|
}
|
|
|
_this.form.content = res.data.content
|
|
|
_this.form.dealerEditFlag = res.data.dealerEditFlag
|
|
@@ -376,6 +398,10 @@ export default {
|
|
|
_this.form.ruleEnableFlag = res.data.ruleEnableFlag
|
|
|
if (res.data.promoRule && res.data.promoRule.ruleDetailList && res.data.ruleEnableFlag === '1') {
|
|
|
_this.form.promoRule = res.data.promoRule
|
|
|
+ res.data.promoRule.ruleDetailList.map(val => {
|
|
|
+ val.unit = 'GE'
|
|
|
+ return val
|
|
|
+ })
|
|
|
_this.$nextTick(() => {
|
|
|
_this.$refs.setContent.setDetailData(res.data.promoRule, res.data.promoRule.ruleDetailList)
|
|
|
})
|
|
@@ -392,8 +418,16 @@ export default {
|
|
|
if (_this.form.ruleEnableFlag === '1') {
|
|
|
_this.form.promoRule.ruleDetailList = _this.$refs.setContent.couponList
|
|
|
}
|
|
|
+ // 验证组件必填项
|
|
|
+ _this.$refs.setContent.testAndVerify(function (res) {
|
|
|
+ if (res) {
|
|
|
+ _this.saveInfo()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- _this.$refs.ruleForm.validateField('ruleDetailList')
|
|
|
+ },
|
|
|
+ saveInfo () {
|
|
|
+ const _this = this
|
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
_this.form.promoActiveSn = this.$route.params.sn
|
|
@@ -450,8 +484,8 @@ export default {
|
|
|
content: '', // 内容
|
|
|
contentLink: '', // 链接内容
|
|
|
sort: undefined, // 排序
|
|
|
- ruleEnableFlag: undefined, // 参数配置 1勾选配置 0不能配置
|
|
|
- publishState: 'UNPUBLISH',
|
|
|
+ ruleEnableFlag: '0', // 参数配置 1勾选配置 0不能配置
|
|
|
+ publishState: 'UNPUBLISH', // 是否发布
|
|
|
dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
// 参数配置数据
|
|
|
promoRule: {
|