|
@@ -62,17 +62,12 @@
|
|
|
width="80"
|
|
|
height="80"
|
|
|
v-for="(con,i) in imageSet"
|
|
|
- style="margin-right:10px;"
|
|
|
+ style="margin-right:10px;object-fit: cover;"
|
|
|
:key="i" />
|
|
|
</div>
|
|
|
<span class="upload-desc">说明:单张大小小于10Mb,最多10张;建议尺寸:宽(420px)*高(230px)</span>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="参与客户" prop="contentType">
|
|
|
- 全部数字货架客户
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
<a-form-model-item label="内容类型" prop="contentType">
|
|
|
<v-select
|
|
@@ -151,21 +146,12 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
- </a-form-model>
|
|
|
- <a-form-model
|
|
|
- id="setPromotion-form"
|
|
|
- ref="sellRuleForm"
|
|
|
- :model="sellForm"
|
|
|
- :rules="sellRules"
|
|
|
- class="setPromotion-form"
|
|
|
- :label-col="sellFormItemLayout.labelCol"
|
|
|
- :wrapper-col="sellFormItemLayout.wrapperCol">
|
|
|
<a-row v-if="form.contentType ==='LINK'&&form.linkType==='1'">
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="基本规则" prop="ruleType">
|
|
|
+ <a-form-model-item label="基本规则" prop="promoRule.ruleType">
|
|
|
<v-select
|
|
|
style="width:40%;"
|
|
|
- v-model="sellForm.ruleType"
|
|
|
+ v-model="form.promoRule.ruleType"
|
|
|
placeholder="请选择基本规则"
|
|
|
id="promotionEdit-ruleType"
|
|
|
code="PROMO_ACTIVE_RULE_TYPE"
|
|
@@ -174,12 +160,12 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
|
|
- <a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="ruleName">
|
|
|
+ <a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="promoRule.ruleName">
|
|
|
<a-input
|
|
|
:disabled="isDisabled"
|
|
|
id="promotionEdit-ruleName"
|
|
|
:maxLength="20"
|
|
|
- v-model.trim="sellForm.ruleName"
|
|
|
+ v-model.trim="form.promoRule.ruleName"
|
|
|
placeholder="请输入券名称(最多20个字符)"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
@@ -190,17 +176,16 @@
|
|
|
:disabled="isDisabled"
|
|
|
id="promotionEdit-ruleTitle"
|
|
|
:maxLength="20"
|
|
|
- v-model.trim="sellForm.ruleTitle"
|
|
|
+ v-model.trim="form.promoRule.ruleTitle"
|
|
|
placeholder="请输入券副标题(最多20个字符)"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="生成方式" prop="ruleBaseType">
|
|
|
- <!-- showType="radio" -->
|
|
|
+ <a-form-model-item label="生成方式" prop="promoRule.ruleBaseType">
|
|
|
<v-select
|
|
|
style="width:40%;"
|
|
|
- v-model="sellForm.ruleBaseType"
|
|
|
+ v-model="form.promoRule.ruleBaseType"
|
|
|
id="promotionEdit-ruleBaseType"
|
|
|
code="PROMO_RULE_BASE_TYPE"
|
|
|
:disabled="isDisabled"
|
|
@@ -208,17 +193,18 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="券有效期" prop="validType">
|
|
|
+ <a-form-model-item label="券有效期" prop="promoRule.validType">
|
|
|
<v-select
|
|
|
style="width:40%;"
|
|
|
- v-model="sellForm.validType"
|
|
|
+ v-model="form.promoRule.validType"
|
|
|
placeholder="请选择券有效期"
|
|
|
id="promotionEdit-validType"
|
|
|
code="PROMO_RULE_TICKET_TYPE"
|
|
|
:disabled="isDisabled"
|
|
|
+ @change="handleValidType"
|
|
|
allowClear></v-select>
|
|
|
<a-range-picker
|
|
|
- v-show="sellForm.validType==='FIXED'"
|
|
|
+ v-show="form.promoRule.validType==='FIXED'"
|
|
|
style="width:40%;margin-left:10px;"
|
|
|
v-model="time"
|
|
|
:format="dateFormat"
|
|
@@ -226,10 +212,10 @@
|
|
|
:disabled="isDisabled"
|
|
|
:disabled-date="disabledDate"
|
|
|
:placeholder="['开始时间', '结束时间']" />
|
|
|
- <span style="width:40%;margin-left:10px;" v-show="sellForm.validType==='LIMIT'">
|
|
|
+ <span style="width:40%;margin-left:10px;" v-show="form.promoRule.validType==='LIMIT'">
|
|
|
有效期<a-input-number
|
|
|
style="margin:0 5px;"
|
|
|
- v-model="sellForm.validDays"
|
|
|
+ v-model="form.promoRule.validDays"
|
|
|
:step="1"
|
|
|
:max="99999999"
|
|
|
:min="1"
|
|
@@ -239,14 +225,14 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item class="productName" label="券适用范围" prop="range">
|
|
|
+ <a-form-model-item class="productName" label="券适用范围" prop="promoRule.range">
|
|
|
全部产品
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="使用说明" prop="ruleExplain">
|
|
|
+ <a-form-model-item label="使用说明" prop="promoRule.ruleExplain">
|
|
|
<a-input
|
|
|
- v-model="sellForm.ruleExplain"
|
|
|
+ v-model="form.promoRule.ruleExplain"
|
|
|
:disabled="isDisabled"
|
|
|
type="textarea"
|
|
|
placeholder="请输入使用说明(最多50个字符)"
|
|
@@ -254,52 +240,51 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<div style="text-align:center;" v-if="!isShowNextStep"><a-button type="primary" size="large" :disabled="isDisabled" @click="handleSave('part')" >保存后设置产品</a-button></div>
|
|
|
- </a-row>
|
|
|
- <a-row v-if="form.contentType =='LINK'&&isShowNextStep">
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="产品范围">
|
|
|
- <div id="setPromotion-productRange" style="position:relative;">
|
|
|
- <a-tree-select
|
|
|
- v-model="sellForm.productRangeList"
|
|
|
- :maxTagCount="12"
|
|
|
- :tree-data="productTypeList"
|
|
|
- tree-checkable
|
|
|
- :disabled="isDisabled"
|
|
|
- :getPopupContainer="triggerNode => triggerNode.parentNode"
|
|
|
- :replaceFields="{children:'children',title: 'productTypeName',key: 'productTypeSn',value: 'productTypeSn'}"
|
|
|
- @change="onChangeTree"
|
|
|
- placeholder="请选择产品范围" />
|
|
|
- </div>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="返券产品">
|
|
|
- <div class="productInfo flex-center">
|
|
|
- <div>
|
|
|
- 返券金额<a-input-number
|
|
|
- v-model="sellForm.ruleValue"
|
|
|
- style="margin:0 5px;"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :precision="2"
|
|
|
- :max="99999999"
|
|
|
- size="small"/> 元
|
|
|
- <a-button type="primary" class="button-primary" size="small" @click="handleBatchAdd">批量设置</a-button>
|
|
|
+ <div v-if="form.contentType =='LINK'&&isShowNextStep">
|
|
|
+ <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <a-form-model-item label="产品范围">
|
|
|
+ <div id="setPromotion-productRange" style="position:relative;">
|
|
|
+ <a-tree-select
|
|
|
+ v-model="productRangeList"
|
|
|
+ :maxTagCount="12"
|
|
|
+ :tree-data="productTypeList"
|
|
|
+ tree-checkable
|
|
|
+ :disabled="isDisabled"
|
|
|
+ :getPopupContainer="triggerNode => triggerNode.parentNode"
|
|
|
+ :replaceFields="{children:'children',title: 'productTypeName',key: 'productTypeSn',value: 'productTypeSn'}"
|
|
|
+ @change="onChangeTree"
|
|
|
+ placeholder="请选择产品范围" />
|
|
|
</div>
|
|
|
- <a-button type="primary" v-if="sellForm.productRangeList&&sellForm.productRangeList.length>0" @click="handleAddProduct" size="small">添加产品</a-button>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <a-form-model-item label="返券产品" prop="promoRule.range">
|
|
|
+ <div class="productInfo flex-center">
|
|
|
+ <div>
|
|
|
+ 返券金额<a-input-number
|
|
|
+ v-model="form.promoRule.ruleValue"
|
|
|
+ style="margin:0 5px;"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ :precision="2"
|
|
|
+ :max="99999999"
|
|
|
+ size="small"/> 元
|
|
|
+ <a-button type="primary" class="button-primary" size="small" @click="handleBatchAdd">批量设置</a-button>
|
|
|
+ </div>
|
|
|
+ <a-button v-if="this.productRangeList&&this.productRangeList.length>0" type="primary" @click="handleAddProduct" size="small">添加产品</a-button>
|
|
|
+ </div>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <div style="width: 83%;margin:0 auto 10px;">
|
|
|
+ <productTable ref="chooseProductList" :promoActiveSn="$route.params.sn"></productTable>
|
|
|
</div>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <div style="width: 83%;margin:0 auto 10px;">
|
|
|
- <productTable ref="chooseProduct" :promoActiveSn="$route.params.sn"></productTable>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
+ </a-col>
|
|
|
+ </div>
|
|
|
</a-row>
|
|
|
</a-form-model>
|
|
|
</a-card>
|
|
|
</a-spin>
|
|
|
- <!-- v-if="form.contentType !='LINK'||isShowNextStep" -->
|
|
|
<div class="affix-cont">
|
|
|
<a-button
|
|
|
type="primary"
|
|
@@ -311,12 +296,11 @@
|
|
|
v-if="form.contentType !='LINK'|| isShowNextStep ||(form.contentType ==='LINK'&&form.linkType ==='2')"
|
|
|
style="padding: 0 60px;">保存</a-button>
|
|
|
</div>
|
|
|
- <!-- 预览 -->
|
|
|
- <promotion-show-modal ref="showModal" :openModal="openShowModal" @close="openShowModal = false"></promotion-show-modal>
|
|
|
<!-- 添加产品 -->
|
|
|
<chooseProduct
|
|
|
- ref="chooseProductList"
|
|
|
+ ref="chooseProduct"
|
|
|
:chooseType="chooseTypeList"
|
|
|
+ :itemSn="$route.params.sn"
|
|
|
:openModal="showProModal"
|
|
|
@ok="addProductSuccess"
|
|
|
@close="closeProductModal"></chooseProduct>
|
|
@@ -326,13 +310,15 @@
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import moment from 'moment'
|
|
|
+// 组件
|
|
|
import { VSelect, Upload } from '@/components'
|
|
|
import Editor from '@/components/WEeditor'
|
|
|
import promotionShowModal from './promotionShowModal'
|
|
|
import productTable from './productTable'
|
|
|
import chooseProduct from './chooseProductsModal.vue'
|
|
|
+// 接口
|
|
|
import { productTypeQuery } from '@/api/productType'
|
|
|
-import { promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
|
|
|
+import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
|
|
|
export default {
|
|
|
name: 'ProductBrandEditModal',
|
|
|
mixins: [commonMixin],
|
|
@@ -340,14 +326,13 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
+ // 第一个表单 label 设置
|
|
|
formItemLayout: {
|
|
|
labelCol: { span: 2 },
|
|
|
wrapperCol: { span: 20 }
|
|
|
},
|
|
|
- sellFormItemLayout: {
|
|
|
- labelCol: { span: 2 }, // 文字前距离设置
|
|
|
- wrapperCol: { span: 20 }// 表单后距离设置 数字越大距离越小
|
|
|
- },
|
|
|
+ productRangeList: [], // 产品范围列表
|
|
|
+ // 链接配置内容
|
|
|
form: {
|
|
|
promoActiveSn: undefined, // 促销活动sn
|
|
|
title: '', // 标题
|
|
@@ -356,39 +341,34 @@ export default {
|
|
|
content: '', // 内容
|
|
|
contentLink: '', // 链接内容
|
|
|
sort: undefined, // 排序
|
|
|
- ruleEnableFlag: '1', // 参数配置 1勾选配置 0不能配置
|
|
|
- publishFlag: '0',
|
|
|
+ publishFlag: '0', // 是否发布
|
|
|
+ linkType: '1',
|
|
|
dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
- promoRule: {},
|
|
|
- publishState: 'UNPUBLISH'
|
|
|
- },
|
|
|
- // 参数配置数据
|
|
|
- sellForm: {
|
|
|
- ruleType: 'ticket', // 基本规则类型
|
|
|
- productRangeFlag: '', // 产品范围标记 0无 1有产品范围
|
|
|
- productRangeList: [], // 产品范围列表
|
|
|
- ruleName: '', // 券名称
|
|
|
- ruleTitle: '', // 副标题
|
|
|
- ruleBaseType: 'category', // 券生成方式
|
|
|
- ruleExplain: '', // 使用说明
|
|
|
- validType: undefined, // 券有效期类型
|
|
|
- validStartDate: undefined, // 券生效时间
|
|
|
- validEndDate: undefined, // 券失效时间
|
|
|
- validDays: undefined, // 券有效期天数
|
|
|
- range: '1'
|
|
|
+ promoRule: {
|
|
|
+ ruleType: 'ticket', // 基本规则类型
|
|
|
+ ruleName: '', // 券名称
|
|
|
+ ruleTitle: '', // 副标题
|
|
|
+ ruleBaseType: 'category', // 券生成方式
|
|
|
+ ruleExplain: '', // 使用说明
|
|
|
+ validType: undefined, // 券有效期类型
|
|
|
+ validStartDate: undefined, // 券生效时间
|
|
|
+ validEndDate: undefined, // 券失效时间
|
|
|
+ validDays: undefined, // 券有效期天数
|
|
|
+ dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
+ publishFlag: '0', // 是否发布
|
|
|
+ range: '1'
|
|
|
+ }
|
|
|
},
|
|
|
time: [], // 有效期
|
|
|
- promotionName: '',
|
|
|
- dateFormat: 'YYYY-MM-DD',
|
|
|
+ dateFormat: 'YYYY-MM-DD', // 有效期时间格式
|
|
|
+ promotionName: '', // 促销名称
|
|
|
pageType: undefined, // 页面类型
|
|
|
- showProModal: false,
|
|
|
- isShowNextStep: false, // 是否显示下一步 配置产品
|
|
|
- openShowModal: false,
|
|
|
- isDisabled: false, // 控制是否能编辑
|
|
|
- chooseTypeList: [],
|
|
|
- chooseProductList: [],
|
|
|
+ showProModal: false, // 打开产品弹窗
|
|
|
+ isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
|
|
|
+ isDisabled: false, // 控制页面是否能编辑
|
|
|
+ chooseTypeList: [], // 已选中产品范围
|
|
|
imageSet: [], // 回显显示图片数据
|
|
|
- productTypeList: [],
|
|
|
+ productTypeList: [], // 产品范围 列表数据
|
|
|
rules: {
|
|
|
title: [{ required: true, message: '请输入标题名称', trigger: 'blur' }],
|
|
|
imageSet: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
|
|
@@ -396,15 +376,15 @@ export default {
|
|
|
contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
|
|
|
content: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }],
|
|
|
contentLink: [{ required: true, message: '请输入对应内容', trigger: 'blur' }],
|
|
|
- publishFlag: [{ required: true, message: '请选择是否发布', trigger: 'change' }]
|
|
|
- },
|
|
|
- sellRules: {
|
|
|
- ruleType: [{ required: true, message: '请选择基本规则', trigger: 'change' }],
|
|
|
- ruleName: [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
|
|
|
- ruleBaseType: [{ required: true, message: '请选择生成方式', trigger: 'change' }],
|
|
|
- validType: [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
|
|
|
- ruleDetailList: [{ type: 'array', required: true, message: '请选择券内容', trigger: 'blur' }],
|
|
|
- range: [{ required: true, message: '请选择券适用范围', trigger: 'change' }]
|
|
|
+ publishFlag: [{ required: true, message: '请选择是否发布', trigger: 'change' }],
|
|
|
+ 'promoRule.ruleType': [{ required: true, message: '请选择基本规则', trigger: 'change' }],
|
|
|
+ 'promoRule.ruleName': [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
|
|
|
+ 'promoRule.ruleBaseType': [{ required: true, message: '请选择生成方式', trigger: 'change' }],
|
|
|
+ 'promoRule.validType': [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
|
|
|
+ 'promoRule.publishFlag': [{ required: true, message: '请选择是否发布', trigger: 'change' }],
|
|
|
+ 'promoRule.dealerEditFlag': [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }],
|
|
|
+ 'promoRule.range': [{ required: true, message: '请选择', trigger: 'blur' }],
|
|
|
+ dealerEditFlag: [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -416,20 +396,17 @@ export default {
|
|
|
dateChange (date, dateString) {
|
|
|
this.time = date
|
|
|
if (dateString[0] != '' && dateString[1] != '') {
|
|
|
- this.sellForm.validStartDate = dateString[0] + ' 00:00:00'
|
|
|
- this.sellForm.validEndDate = dateString[1] + ' 23:59:59'
|
|
|
+ this.form.promoRule.validStartDate = dateString[0] + ' 00:00:00'
|
|
|
+ this.form.promoRule.validEndDate = dateString[1] + ' 23:59:59'
|
|
|
}
|
|
|
},
|
|
|
// 打开产品弹窗
|
|
|
insterProduct (obj) {
|
|
|
if (obj && Object.keys(obj).length > 0) {
|
|
|
this.chooseTypeList = obj.typeArr
|
|
|
- this.chooseDataList = obj.productArr
|
|
|
- this.chooseProductList = obj.chooseProductArr
|
|
|
}
|
|
|
this.showProModal = true
|
|
|
},
|
|
|
-
|
|
|
closeProductModal () {
|
|
|
this.showProModal = false
|
|
|
},
|
|
@@ -444,14 +421,17 @@ export default {
|
|
|
if (res.status == 200) {
|
|
|
// 编辑按钮时,publishState 已发布,只能编辑是否发布;publishState已关闭,都可以编辑
|
|
|
if (_this.pageType === 'edit') {
|
|
|
- _this.isDisabled = true
|
|
|
- _this.form.publishFlag = res.data.publishFlag
|
|
|
+ _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.form.imageSet = res.data.images
|
|
|
+ _this.imageSet = res.data.imageSet
|
|
|
if (res.data.images) {
|
|
|
const images = res.data.images.split(',')
|
|
|
_this.imageSet = images
|
|
@@ -473,19 +453,30 @@ export default {
|
|
|
_this.form.linkType = res.data.content != '/pagesB/promoDetail' ? '2' : '1'
|
|
|
if (res.data.promoRule) {
|
|
|
_this.isShowNextStep = true
|
|
|
- _this.sellForm.range = '1'
|
|
|
+ _this.form.promoRule.range = '1'
|
|
|
_this.time = [res.data.promoRule.validStartDate, res.data.promoRule.validEndDate]
|
|
|
- if (res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.productRangeList.length > 0) {
|
|
|
- _this.sellForm.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
|
|
|
+ if (res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.length > 0) {
|
|
|
+ _this.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
|
|
|
}
|
|
|
- _this.sellForm = res.data.promoRule
|
|
|
}
|
|
|
+ _this.form.promoRule = { ..._this.form.promoRule, ...res.data.promoRule }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 确定保存
|
|
|
- handleSave (type) {
|
|
|
+ // 券有效期 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 () {
|
|
|
if (this.form.contentType === 'LINK') {
|
|
|
if (this.$refs.chooseProductList) {
|
|
|
const numInfo = this.$refs.chooseProductList.getDataNum()
|
|
@@ -534,14 +525,12 @@ export default {
|
|
|
content: '', // 内容
|
|
|
contentLink: '', // 链接内容
|
|
|
sort: undefined, // 排序
|
|
|
- ruleEnableFlag: '1', // 参数配置 1勾选配置 0不能配置
|
|
|
- publishState: 'UNPUBLISH', // 是否发布
|
|
|
+ publishFlag: '0', // 是否发布
|
|
|
+ linkType: '1',
|
|
|
dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
- // 参数配置数据
|
|
|
+ productRangeList: [], // 产品范围列表
|
|
|
promoRule: {
|
|
|
ruleType: 'ticket', // 基本规则类型
|
|
|
- productRangeFlag: '', // 产品范围标记 0无 1有产品范围
|
|
|
- productRangeList: [], // 产品范围列表
|
|
|
ruleName: '', // 券名称
|
|
|
ruleTitle: '', // 副标题
|
|
|
ruleBaseType: 'category', // 券生成方式
|
|
@@ -550,15 +539,19 @@ export default {
|
|
|
validStartDate: undefined, // 券生效时间
|
|
|
validEndDate: undefined, // 券失效时间
|
|
|
validDays: undefined, // 券有效期天数
|
|
|
- // 券内容
|
|
|
- ruleDetailList: []
|
|
|
- }
|
|
|
+ dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
+ publishFlag: '0', // 是否发布
|
|
|
+ range: '1'
|
|
|
+ } // 链接配置内容
|
|
|
}
|
|
|
this.isShowNextStep = false
|
|
|
this.isDisabled = false
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
}
|
|
|
+ if (this.$refs.ruleForm) {
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ }
|
|
|
},
|
|
|
// 获取产品范围数据
|
|
|
getTreeData () {
|
|
@@ -598,26 +591,26 @@ export default {
|
|
|
},
|
|
|
// 添加产品
|
|
|
handleAddProduct () {
|
|
|
- this.chooseTypeList = this.sellForm.productRangeList
|
|
|
+ this.chooseTypeList = this.productRangeList
|
|
|
this.showProModal = true
|
|
|
},
|
|
|
// 批量添加
|
|
|
handleBatchAdd () {
|
|
|
- if (!this.sellForm.ruleValue) {
|
|
|
- this.$message.warning('请输入返券金额(需大于零)!')
|
|
|
+ if (!this.form.promoRule.ruleValue) {
|
|
|
+ this.$message.warning('请输入返券金额(需大于0)!')
|
|
|
return
|
|
|
}
|
|
|
- this.$refs.chooseProduct.editMorePrice(this.sellForm.ruleValue)
|
|
|
+ this.$refs.chooseProductList.editMorePrice(this.form.promoRule.ruleValue)
|
|
|
},
|
|
|
// 添加产品成功
|
|
|
addProductSuccess (list) {
|
|
|
const productArr = list.map(item => {
|
|
|
return {
|
|
|
promoActiveSn: this.$route.params.sn,
|
|
|
- promoRuleSn: this.sellForm.promoRuleSn,
|
|
|
+ promoRuleSn: this.form.promoRule.promoRuleSn,
|
|
|
productCode: item.code,
|
|
|
productSn: item.productSn,
|
|
|
- ruleValue: this.sellForm.ruleValue,
|
|
|
+ ruleValue: this.form.promoRule.ruleValue,
|
|
|
price: item.terminalPrice
|
|
|
}
|
|
|
})
|
|
@@ -625,18 +618,25 @@ export default {
|
|
|
if (res.status == 200) {
|
|
|
this.showProModal = false
|
|
|
// 获取产品列表 有分页
|
|
|
- this.$refs.chooseProduct.pageInit()
|
|
|
+ this.$refs.chooseProductList.pageInit()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
onChangeTree (e) {
|
|
|
- deleteByProductType({ promoActiveSn: this.$route.params.sn, productTypeSnList: this.sellForm.productRangeList || [] }).then(res => {
|
|
|
+ deleteByProductType({ promoActiveSn: this.$route.params.sn, productTypeSnList: this.productRangeList || [] }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.$refs.chooseProduct.pageInit()
|
|
|
+ this.$refs.chooseProductList.pageInit()
|
|
|
}
|
|
|
})
|
|
|
// 保存产品范围
|
|
|
- saveBatchEntity({ list: this.sellForm.productRangeList, promoActiveSn: this.$route.params.sn }).then(res => {
|
|
|
+ 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('保存产品范围成功')
|
|
|
}
|
|
@@ -678,8 +678,8 @@ export default {
|
|
|
.promotionEdit-wrap{
|
|
|
position: relative;
|
|
|
height: 100%;
|
|
|
- padding-bottom:51px;
|
|
|
box-sizing: border-box;
|
|
|
+ padding-bottom:51px;
|
|
|
>.ant-spin-nested-loading{
|
|
|
overflow-y: scroll;
|
|
|
height: 100%;
|