|
@@ -4,7 +4,7 @@
|
|
<a-page-header :ghost="false" :backIcon="false" class="promotionEdit-cont" >
|
|
<a-page-header :ghost="false" :backIcon="false" class="promotionEdit-cont" >
|
|
<!-- 自定义的二级文字标题 -->
|
|
<!-- 自定义的二级文字标题 -->
|
|
<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>
|
|
</template>
|
|
</template>
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
@@ -43,18 +43,8 @@
|
|
</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="imageSet" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
|
- <Upload
|
|
|
|
- v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
|
|
|
|
- class="upload"
|
|
|
|
- id="promotionEdit-imageSet"
|
|
|
|
- v-model="form.imageSet"
|
|
|
|
- ref="imageSet"
|
|
|
|
- :fileSize="10"
|
|
|
|
- :maxNums="10"
|
|
|
|
- @change="changeImage"
|
|
|
|
- listType="picture-card"></Upload>
|
|
|
|
- <div v-else>
|
|
|
|
|
|
+ <a-form-model-item label="封面图片" prop="images" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
|
|
+ <div>
|
|
<img
|
|
<img
|
|
:src="con"
|
|
:src="con"
|
|
alt="图片走丢了"
|
|
alt="图片走丢了"
|
|
@@ -82,28 +72,10 @@
|
|
</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'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
<a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
- <editor
|
|
|
|
- v-show="pageType === 'add'||(pageType === 'edit'&&!isDisabled)"
|
|
|
|
- id="promotionEdit-editor"
|
|
|
|
- ref="editor"
|
|
|
|
- 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 class="box" 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'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
<a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:2}" :wrapper-col="{span:20}">
|
|
- <Upload
|
|
|
|
- v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
|
|
|
|
- class="upload"
|
|
|
|
- id="promotionEdit-imageSet"
|
|
|
|
- v-model="form.content"
|
|
|
|
- fileType="video/mp4"
|
|
|
|
- ref="videoSet"
|
|
|
|
- :fileSize="100"
|
|
|
|
- :maxNums="1"
|
|
|
|
- @change="changeVideo"
|
|
|
|
- ></Upload>
|
|
|
|
- <div v-else>
|
|
|
|
|
|
+ <div>
|
|
<video width="230" height="150" controls loop controlsList="nodownload">
|
|
<video width="230" height="150" controls loop controlsList="nodownload">
|
|
<source :src="form.content" type="video/mp4">
|
|
<source :src="form.content" type="video/mp4">
|
|
</video>
|
|
</video>
|
|
@@ -120,7 +92,13 @@
|
|
placeholder="请输入跳转链接"
|
|
placeholder="请输入跳转链接"
|
|
@blur="handleLink"
|
|
@blur="handleLink"
|
|
allowClear />
|
|
allowClear />
|
|
- <a-select id="promotionEdit-title" default-value="货架促销" @change="handleLinkType" style="width: 120px;margin-left:10px;" v-model="form.linkType">
|
|
|
|
|
|
+ <a-select
|
|
|
|
+ id="promotionEdit-title"
|
|
|
|
+ :disabled="isDisabled"
|
|
|
|
+ default-value="货架促销"
|
|
|
|
+ @change="handleLinkType"
|
|
|
|
+ style="width: 120px;margin-left:10px;"
|
|
|
|
+ v-model="form.linkType">
|
|
<a-select-option value="1">
|
|
<a-select-option value="1">
|
|
货架促销
|
|
货架促销
|
|
</a-select-option>
|
|
</a-select-option>
|
|
@@ -134,7 +112,7 @@
|
|
<!-- 参数配置 -->
|
|
<!-- 参数配置 -->
|
|
<a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'&&form.linkType!='2'">
|
|
<a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'&&form.linkType!='2'">
|
|
<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-checkbox @change="onChangeParams" :disabled="isDisabled">参数配置</a-checkbox>
|
|
|
|
|
|
+ <a-checkbox @change="onChangeParams" :disabled="isDisabled" v-model="isShowParams">参数配置</a-checkbox>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col
|
|
<a-col
|
|
:xs="24"
|
|
:xs="24"
|
|
@@ -144,11 +122,19 @@
|
|
:xl="24"
|
|
:xl="24"
|
|
v-show="isShowParams">
|
|
v-show="isShowParams">
|
|
<!-- 参数配置内容 -->
|
|
<!-- 参数配置内容 -->
|
|
- <setPromotion style="margin-top:20px;" :disabledVal="isDisabled" @addProduct="insterProduct"></setPromotion>
|
|
|
|
|
|
+ <setPromotion ref="setContent" :pageType="pageType" style="margin-top:20px;" :disabledVal="isDisabled" @addProduct="insterProduct"></setPromotion>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
</a-card>
|
|
</a-card>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
|
|
+ <!-- <div class="btn-cont">
|
|
|
|
+ <a-button id="product-brand-edit-modal-back" @click="isShow = false" style="margin-right:15px;">取消</a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ style="margin-right:15px;color: #fff;background-color: #39f;border-color: #39f;"
|
|
|
|
+ @click="handleSee"
|
|
|
|
+ v-if="form.contentType !='LINK'">预览</a-button>
|
|
|
|
+ <a-button type="primary" id="product-brand-edit-modal-save" @click="handleSave">确定</a-button>
|
|
|
|
+ </div> -->
|
|
</a-spin>
|
|
</a-spin>
|
|
<div class="affix-cont">
|
|
<div class="affix-cont">
|
|
<a-button
|
|
<a-button
|
|
@@ -157,28 +143,34 @@
|
|
:disabled="spinning"
|
|
:disabled="spinning"
|
|
id="productInfoEdit-submit-btn"
|
|
id="productInfoEdit-submit-btn"
|
|
size="large"
|
|
size="large"
|
|
|
|
+ v-if="pageType!='see'"
|
|
@click="handleSave"
|
|
@click="handleSave"
|
|
style="padding: 0 60px;">保存</a-button>
|
|
style="padding: 0 60px;">保存</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- 预览 -->
|
|
<!-- 预览 -->
|
|
<promotion-show-modal ref="showModal" :openModal="openShowModal" @close="openShowModal = false"></promotion-show-modal>
|
|
<promotion-show-modal ref="showModal" :openModal="openShowModal" @close="openShowModal = false"></promotion-show-modal>
|
|
<!-- 添加产品 -->
|
|
<!-- 添加产品 -->
|
|
- <chooseProduct ref="chooseProduct" :openModal="showProModal" @close="closeProductModal"></chooseProduct>
|
|
|
|
|
|
+ <chooseProduct
|
|
|
|
+ ref="chooseProduct"
|
|
|
|
+ :chooseType="chooseTypeList"
|
|
|
|
+ :chooseData="chooseDataList"
|
|
|
|
+ :openModal="showProModal"
|
|
|
|
+ @ok="addProductSuccess"
|
|
|
|
+ @close="closeProductModal"></chooseProduct>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
-import { VSelect, Upload } from '@/components'
|
|
|
|
-import Editor from '@/components/WEeditor'
|
|
|
|
-// import { saveActive, promoTerminalDetail } from '@/api/promoTerminal'
|
|
|
|
|
|
+import { VSelect } from '@/components'
|
|
|
|
+import { promoActivePublish, promoActiveDetail } from '@/api/promoActive'
|
|
import promotionShowModal from './promotionShowModal'
|
|
import promotionShowModal from './promotionShowModal'
|
|
import setPromotion from './setPromotion'
|
|
import setPromotion from './setPromotion'
|
|
import chooseProduct from './chooseProductsModal.vue'
|
|
import chooseProduct from './chooseProductsModal.vue'
|
|
export default {
|
|
export default {
|
|
name: 'ProductBrandEditModal',
|
|
name: 'ProductBrandEditModal',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
- components: { VSelect, Upload, Editor, promotionShowModal, setPromotion, chooseProduct },
|
|
|
|
|
|
+ components: { VSelect, promotionShowModal, setPromotion, chooseProduct },
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
isShow: this.openModal, // 是否打开弹框
|
|
isShow: this.openModal, // 是否打开弹框
|
|
@@ -188,28 +180,45 @@ export default {
|
|
wrapperCol: { span: 16 }
|
|
wrapperCol: { span: 16 }
|
|
},
|
|
},
|
|
form: {
|
|
form: {
|
|
- promoActiveSn: undefined,
|
|
|
|
- title: '',
|
|
|
|
- contentType: 'IMAGE_CONTENT',
|
|
|
|
- imageSet: '',
|
|
|
|
- showFlag: '0',
|
|
|
|
- content: '',
|
|
|
|
- enabledFlag: '0',
|
|
|
|
- sort: undefined,
|
|
|
|
- contentLink: '',
|
|
|
|
- linkType: undefined
|
|
|
|
|
|
+ promoActiveSn: undefined, // 促销活动sn
|
|
|
|
+ title: '', // 标题
|
|
|
|
+ images: '', // 图片
|
|
|
|
+ contentType: 'IMAGE_CONTENT', // 内容类型
|
|
|
|
+ content: '', // 内容
|
|
|
|
+ contentLink: '', // 链接内容
|
|
|
|
+ sort: undefined, // 排序
|
|
|
|
+ ruleEnableFlag: '0', // 参数配置 1勾选配置 0不能配置
|
|
|
|
+ publishState: 'UNPUBLISH',
|
|
|
|
+ promoRuleSn: undefined, // 券内容sn
|
|
|
|
+ // 参数配置数据
|
|
|
|
+ promoRule: {
|
|
|
|
+ ruleType: undefined, // 基本规则类型
|
|
|
|
+ productRangeFlag: '', // 产品范围标记 0无 1有产品范围
|
|
|
|
+ productRangeList: [], // 产品范围列表
|
|
|
|
+ ruleName: '', // 券名称
|
|
|
|
+ ruleTitle: '', // 副标题
|
|
|
|
+ ruleBaseType: undefined, // 券生成方式
|
|
|
|
+ ruleExplain: '', // 使用说明
|
|
|
|
+ validType: undefined, // 券有效期类型
|
|
|
|
+ validStartDate: undefined, // 券生效时间
|
|
|
|
+ validEndDate: undefined, // 券失效时间
|
|
|
|
+ validDays: undefined, // 券有效期天数
|
|
|
|
+ ruleDetailList: [] // 券内容
|
|
|
|
+ }
|
|
},
|
|
},
|
|
pageType: undefined, // 页面类型
|
|
pageType: undefined, // 页面类型
|
|
showProModal: false,
|
|
showProModal: false,
|
|
- images: [],
|
|
|
|
isShowParams: false, // 是否显示参数配置内容
|
|
isShowParams: false, // 是否显示参数配置内容
|
|
openShowModal: false,
|
|
openShowModal: false,
|
|
isDisabled: false, // 控制是否能编辑
|
|
isDisabled: false, // 控制是否能编辑
|
|
|
|
+ chooseTypeList: [],
|
|
|
|
+ chooseDataList: [],
|
|
|
|
+ images: [], // 回显显示图片数据
|
|
rules: {
|
|
rules: {
|
|
title: [
|
|
title: [
|
|
{ required: true, message: '请输入标题名称', trigger: 'blur' }
|
|
{ required: true, message: '请输入标题名称', trigger: 'blur' }
|
|
],
|
|
],
|
|
- imageSet: [
|
|
|
|
|
|
+ images: [
|
|
{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }
|
|
{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }
|
|
],
|
|
],
|
|
sort: [
|
|
sort: [
|
|
@@ -224,11 +233,8 @@ export default {
|
|
contentLink: [
|
|
contentLink: [
|
|
{ required: true, message: '请输入对应内容', trigger: 'blur' }
|
|
{ required: true, message: '请输入对应内容', trigger: 'blur' }
|
|
],
|
|
],
|
|
- enabledFlag: [
|
|
|
|
|
|
+ publishState: [
|
|
{ required: true, message: '请选择是否发布', trigger: 'change' }
|
|
{ required: true, message: '请选择是否发布', trigger: 'change' }
|
|
- ],
|
|
|
|
- showFlag: [
|
|
|
|
- { required: true, message: '请选择是否显示', trigger: 'change' }
|
|
|
|
]
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -236,84 +242,139 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// 设置参数
|
|
// 设置参数
|
|
onChangeParams (e) {
|
|
onChangeParams (e) {
|
|
- this.isShowParams = e.target.checked
|
|
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '改变参数配置,参数配置内容将清空,确认改变吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.isShowParams = e.target.checked
|
|
|
|
+ _this.form.ruleEnableFlag = e.target.checked ? '1' : '0'
|
|
|
|
+ if (!e.target.checked) {
|
|
|
|
+ _this.$refs.setContent.clearContent()
|
|
|
|
+ _this.$nextTick(() => {
|
|
|
|
+ _this.$refs.setContent.addCouponCon()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onCancel () {
|
|
|
|
+ _this.isShowParams = e.target.checked
|
|
|
|
+ _this.form.ruleEnableFlag = e.target.checked ? '1' : '0'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- // 打开弹窗
|
|
|
|
- insterProduct (flag) {
|
|
|
|
|
|
+ // 打开产品弹窗
|
|
|
|
+ insterProduct (obj) {
|
|
|
|
+ if (obj && Object.keys(obj).length > 0) {
|
|
|
|
+ this.chooseTypeList = obj.typeArr
|
|
|
|
+ this.chooseDataList = obj.productArr
|
|
|
|
+ }
|
|
this.showProModal = true
|
|
this.showProModal = true
|
|
},
|
|
},
|
|
|
|
+ // 添加产品成功
|
|
|
|
+ addProductSuccess (list) {
|
|
|
|
+ const productArr = list.map(item => {
|
|
|
|
+ return { productCode: item.code,
|
|
|
|
+ productSn: item.productSn }
|
|
|
|
+ })
|
|
|
|
+ this.$refs.setContent.setProductSn(productArr)
|
|
|
|
+ },
|
|
|
|
+ closeProductModal () {
|
|
|
|
+ this.showProModal = false
|
|
|
|
+ },
|
|
// 返回列表
|
|
// 返回列表
|
|
handleBack () {
|
|
handleBack () {
|
|
- this.resetSearchForm()
|
|
|
|
this.$router.push({ name: 'promotionInfoList', query: { closeLastOldTab: true } })
|
|
this.$router.push({ name: 'promotionInfoList', query: { closeLastOldTab: true } })
|
|
},
|
|
},
|
|
// 预览
|
|
// 预览
|
|
- handleSee () {
|
|
|
|
- if (this.form.content) {
|
|
|
|
- this.openShowModal = true
|
|
|
|
- this.$refs.showModal.pageInit({ type: this.form.contentType, con: this.form.content })
|
|
|
|
- } else {
|
|
|
|
- this.$message.error('请输入预览内容!')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // handleSee () {
|
|
|
|
+ // if (this.form.content) {
|
|
|
|
+ // this.openShowModal = true
|
|
|
|
+ // this.$refs.showModal.pageInit({ type: this.form.contentType, con: this.form.content })
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$message.error('请输入预览内容!')
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
// 详情
|
|
// 详情
|
|
getDetail () {
|
|
getDetail () {
|
|
- // 查看按钮时,所有按钮不能编辑 编辑按钮时,state 已发布,只能编辑是否发布;state已关闭,都可以编辑
|
|
|
|
- promoTerminalDetail({ sn: this.$route.params.sn }).then(res => {
|
|
|
|
|
|
+ // 查看按钮时,所有按钮不能编辑 编辑按钮时,只可编辑券内容
|
|
|
|
+ const _this = this
|
|
|
|
+ promoActiveDetail({ sn: this.$route.params.sn }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- if (this.pageType === 'edit') {
|
|
|
|
- this.isDisabled = res.data.state === 'PUBLISH'
|
|
|
|
- } else {
|
|
|
|
- this.isDisabled = true
|
|
|
|
|
|
+ if (_this.pageType === 'edit' || _this.pageType === 'see') {
|
|
|
|
+ _this.isDisabled = true
|
|
|
|
+ }
|
|
|
|
+ _this.form.promoActiveSn = res.data.promoActiveSn
|
|
|
|
+ _this.form.promoRuleSn = (res.data.promoRule && res.data.promoRule.promoRuleSn) ? res.data.promoRule.promoRuleSn : undefined // 规则sn
|
|
|
|
+ _this.form.title = res.data.title
|
|
|
|
+ _this.form.contentType = res.data.contentType
|
|
|
|
+ _this.form.sort = res.data.sort
|
|
|
|
+ _this.form.images = res.data.images
|
|
|
|
+ if (res.data.images) {
|
|
|
|
+ const imageSet = res.data.images.split(',')
|
|
|
|
+ _this.images = imageSet
|
|
}
|
|
}
|
|
- 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.enabledFlag = res.data.enabledFlag
|
|
|
|
- this.form.sort = res.data.sort
|
|
|
|
- this.images = res.data.imageSet
|
|
|
|
- this.form.imageSet = res.data.images
|
|
|
|
- this.form.content = res.data.content
|
|
|
|
- this.$refs.imageSet.setFileList(res.data.images)
|
|
|
|
- if (res.data.contentType == 'IMAGE_CONTENT') {
|
|
|
|
- this.$refs.editor.setHtml(res.data.content)
|
|
|
|
- } else if (res.data.contentType == 'VIDEO') {
|
|
|
|
- if (res.data.state != 'PUBLISH') {
|
|
|
|
- this.$refs.videoSet.setFileList(res.data.content)
|
|
|
|
|
|
+ _this.form.content = res.data.content
|
|
|
|
+ _this.form.publishState = res.data.publishState
|
|
|
|
+ if (res.data.contentType == 'LINK') {
|
|
|
|
+ _this.form.contentLink = res.data.content
|
|
|
|
+ _this.form.linkType = '1'
|
|
|
|
+ _this.isShowParams = res.data.ruleEnableFlag === '1'
|
|
|
|
+ _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)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- } else if (res.data.contentType == 'LINK') {
|
|
|
|
- this.form.contentLink = res.data.content
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- closeProductModal () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 确定
|
|
|
|
|
|
+ // 确定保存
|
|
handleSave () {
|
|
handleSave () {
|
|
const _this = this
|
|
const _this = this
|
|
if (_this.form.contentType == 'LINK') {
|
|
if (_this.form.contentType == 'LINK') {
|
|
_this.form.content = _this.form.contentLink
|
|
_this.form.content = _this.form.contentLink
|
|
|
|
+ if (_this.form.ruleEnableFlag === '1') {
|
|
|
|
+ _this.form.promoRule.ruleDetailList = _this.$refs.setContent.couponList
|
|
|
|
+ }
|
|
|
|
+ // 验证组件必填项
|
|
|
|
+ _this.$refs.setContent.testAndVerify(function (res) {
|
|
|
|
+ if (res) {
|
|
|
|
+ _this.saveInfo()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ saveInfo () {
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.$refs.ruleForm.validateField('ruleDetailList')
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- _this.form.promoActiveSn = this.itemId
|
|
|
|
- const formData = JSON.parse(JSON.stringify(_this.form))
|
|
|
|
- formData.imageSet = formData.imageSet ? formData.imageSet.split(',') : []
|
|
|
|
- formData.showFlag = formData.enabledFlag == 0 ? '0' : formData.showFlag
|
|
|
|
|
|
+ _this.form.promoActiveSn = this.$route.params.sn
|
|
|
|
+ var formData = JSON.parse(JSON.stringify(_this.form))
|
|
|
|
+ var ajaxData = {}
|
|
if (formData.contentType == 'LINK') {
|
|
if (formData.contentType == 'LINK') {
|
|
delete formData.contentLink
|
|
delete formData.contentLink
|
|
|
|
+ formData.promoRule = _this.$refs.setContent.getPromotionVal()
|
|
|
|
+ ajaxData.promoRuleSn = formData.promoRuleSn
|
|
|
|
+ ajaxData.ruleDetailList = formData.promoRule.ruleDetailList
|
|
}
|
|
}
|
|
|
|
+ ajaxData.promoActiveSn = formData.promoActiveSn
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
- saveActive(formData).then(res => {
|
|
|
|
|
|
+ promoActivePublish(ajaxData).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
|
|
+ _this.$nextTick(() => {
|
|
|
|
+ _this.handleBack()
|
|
|
|
+ _this.resetSearchForm()
|
|
|
|
+ })
|
|
_this.spinning = false
|
|
_this.spinning = false
|
|
- _this.isShow = false
|
|
|
|
- _this.$emit('ok')
|
|
|
|
} else {
|
|
} else {
|
|
_this.spinning = false
|
|
_this.spinning = false
|
|
}
|
|
}
|
|
@@ -323,41 +384,37 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 图片上传
|
|
|
|
- changeImage (file) {
|
|
|
|
- this.form.imageSet = file
|
|
|
|
- },
|
|
|
|
- // 视频上传
|
|
|
|
- changeVideo (file) {
|
|
|
|
- this.form.content = file
|
|
|
|
- },
|
|
|
|
- // 文本编辑器
|
|
|
|
- editorChange (html, text) {
|
|
|
|
- this.form.content = html
|
|
|
|
- },
|
|
|
|
// 重置
|
|
// 重置
|
|
resetSearchForm () {
|
|
resetSearchForm () {
|
|
- if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
|
|
|
|
- this.$refs.imageSet.setFileList('')
|
|
|
|
- this.$refs.videoSet.setFileList('')
|
|
|
|
- }
|
|
|
|
- if (this.$refs.editor) {
|
|
|
|
- this.$refs.editor.setHtml('')
|
|
|
|
- }
|
|
|
|
this.form = {
|
|
this.form = {
|
|
- promoActiveSn: undefined,
|
|
|
|
- title: '',
|
|
|
|
- contentType: 'IMAGE_CONTENT',
|
|
|
|
- imageSet: '',
|
|
|
|
- showFlag: '0',
|
|
|
|
- content: '',
|
|
|
|
- enabledFlag: '0',
|
|
|
|
- sort: undefined,
|
|
|
|
- contentLink: '',
|
|
|
|
- linkType: undefined
|
|
|
|
|
|
+ promoActiveSn: undefined, // 促销活动sn
|
|
|
|
+ title: '', // 标题
|
|
|
|
+ images: '', // 图片
|
|
|
|
+ contentType: 'IMAGE_CONTENT', // 内容类型
|
|
|
|
+ content: '', // 内容
|
|
|
|
+ contentLink: '', // 链接内容
|
|
|
|
+ sort: undefined, // 排序
|
|
|
|
+ ruleEnableFlag: '0', // 参数配置 1勾选配置 0不能配置
|
|
|
|
+ publishState: 'UNPUBLISH',
|
|
|
|
+ promoRuleSn: undefined, // 券内容sn
|
|
|
|
+ // 参数配置数据
|
|
|
|
+ promoRule: {
|
|
|
|
+ ruleType: undefined, // 基本规则类型
|
|
|
|
+ productRangeFlag: '', // 产品范围标记 0无 1有产品范围
|
|
|
|
+ productRangeList: [], // 产品范围列表
|
|
|
|
+ ruleName: '', // 券名称
|
|
|
|
+ ruleTitle: '', // 副标题
|
|
|
|
+ ruleBaseType: undefined, // 券生成方式
|
|
|
|
+ ruleExplain: '', // 使用说明
|
|
|
|
+ validType: undefined, // 券有效期类型
|
|
|
|
+ validStartDate: undefined, // 券生效时间
|
|
|
|
+ validEndDate: undefined, // 券失效时间
|
|
|
|
+ validDays: undefined, // 券有效期天数
|
|
|
|
+ ruleDetailList: [] // 券内容
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- this.images = []
|
|
|
|
this.isDisabled = false
|
|
this.isDisabled = false
|
|
|
|
+ // this.$refs.setContent.clearContent()
|
|
this.$refs.ruleForm.resetFields()
|
|
this.$refs.ruleForm.resetFields()
|
|
},
|
|
},
|
|
// 选择内容类型
|
|
// 选择内容类型
|
|
@@ -385,17 +442,24 @@ export default {
|
|
this.form.contentLink = val === '2' ? '' : '/pagesB/promoDetail'
|
|
this.form.contentLink = val === '2' ? '' : '/pagesB/promoDetail'
|
|
},
|
|
},
|
|
pageInit () {
|
|
pageInit () {
|
|
- this.pageType = this.$route.params.pageType ? this.$route.params.pageType : 'add'
|
|
|
|
- if (this.pageType === 'edit' || this.pageType === 'see') {
|
|
|
|
- this.getDetail()
|
|
|
|
- }
|
|
|
|
|
|
+ this.pageType = this.$route.params.pageType
|
|
|
|
+ this.getDetail()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
- this.pageInit()
|
|
|
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
|
+ this.pageInit()
|
|
|
|
+ }
|
|
},
|
|
},
|
|
activated () {
|
|
activated () {
|
|
- this.pageInit()
|
|
|
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ }
|
|
|
|
+ // 仅刷新列表,不重置页面
|
|
|
|
+ if (this.$store.state.app.updateList) {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ }
|
|
},
|
|
},
|
|
beforeRouteEnter (to, from, next) {
|
|
beforeRouteEnter (to, from, next) {
|
|
next(vm => {})
|
|
next(vm => {})
|
|
@@ -420,12 +484,12 @@ export default {
|
|
width: 100%!important;
|
|
width: 100%!important;
|
|
}
|
|
}
|
|
// 文本编辑器 工具栏样式换行
|
|
// 文本编辑器 工具栏样式换行
|
|
- .promotionEdit-editor{
|
|
|
|
- .w-e-toolbar{
|
|
|
|
- flex-wrap: wrap;
|
|
|
|
- z-index: 0;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // .promotionEdit-editor{
|
|
|
|
+ // .w-e-toolbar{
|
|
|
|
+ // flex-wrap: wrap;
|
|
|
|
+ // z-index: 0;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
// /deep/.upload-file .ant-upload-list-item-info{
|
|
// /deep/.upload-file .ant-upload-list-item-info{
|
|
// padding:2px !important;
|
|
// padding:2px !important;
|
|
// }
|
|
// }
|