|
@@ -20,13 +20,12 @@
|
|
>
|
|
>
|
|
<a-row>
|
|
<a-row>
|
|
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
- <a-form-model-item label="促销名称" prop="title" :label-col="{span:4}" :wrapper-col="{span:16}">
|
|
|
|
|
|
+ <a-form-model-item label="促销名称" prop="promoName" :label-col="{span:4}" :wrapper-col="{span:16}">
|
|
<a-input
|
|
<a-input
|
|
- id="promotionEdit-title"
|
|
|
|
|
|
+ id="promotionEdit-promoName"
|
|
:maxLength="20"
|
|
:maxLength="20"
|
|
- v-model.trim="form.title"
|
|
|
|
|
|
+ v-model.trim="form.promoName"
|
|
placeholder="请输入促销名称(最多20个字符)"
|
|
placeholder="请输入促销名称(最多20个字符)"
|
|
- :disabled="isDisabled"
|
|
|
|
allowClear/>
|
|
allowClear/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
@@ -56,18 +55,19 @@
|
|
</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="contentType">
|
|
|
|
|
|
+ <a-form-model-item label="参与经销商" prop="allDealerFlag">
|
|
<a-row :gutter="15">
|
|
<a-row :gutter="15">
|
|
<a-col :md="10" :sm="24">
|
|
<a-col :md="10" :sm="24">
|
|
<a-select
|
|
<a-select
|
|
style="width:98%;"
|
|
style="width:98%;"
|
|
- id="promotionList-dealerScope"
|
|
|
|
- v-model="form.dealerScope"
|
|
|
|
|
|
+ id="promotionList-allDealerFlag"
|
|
|
|
+ v-model="form.allDealerFlag"
|
|
placeholder="请选择参与经销商"
|
|
placeholder="请选择参与经销商"
|
|
@change="changeDealerScope"
|
|
@change="changeDealerScope"
|
|
|
|
+ :disabled="true"
|
|
allowClear>
|
|
allowClear>
|
|
- <a-select-option id="promotionList-dealerScope-all" value="ALL_DEALER">全部经销商</a-select-option>
|
|
|
|
- <a-select-option id="promotionList-dealerScope-some" value="SOME_DEALER">部分经销商</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>
|
|
</a-select>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :md="3" :sm="24" v-show="form.dealerScope && form.dealerScope!='ALL_DEALER' ">
|
|
<a-col :md="3" :sm="24" v-show="form.dealerScope && form.dealerScope!='ALL_DEALER' ">
|
|
@@ -87,11 +87,11 @@
|
|
</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" class="promotionEdit-img">
|
|
|
|
|
|
+ <a-form-model-item label="封面图片" prop="imageUrl" class="promotionEdit-img">
|
|
<Upload
|
|
<Upload
|
|
class="upload"
|
|
class="upload"
|
|
- id="promotionEdit-imageSet"
|
|
|
|
- v-model="form.imageSet"
|
|
|
|
|
|
+ id="promotionEdit-imageUrl"
|
|
|
|
+ v-model="form.imageUrl"
|
|
ref="imageSet"
|
|
ref="imageSet"
|
|
:fileSize="10"
|
|
:fileSize="10"
|
|
:maxNums="1"
|
|
:maxNums="1"
|
|
@@ -101,30 +101,29 @@
|
|
</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="promoRule.ruleExplain">
|
|
|
|
|
|
+ <a-form-model-item label="促销描述" prop="description">
|
|
<a-input
|
|
<a-input
|
|
- v-model="form.promoRule.ruleExplain"
|
|
|
|
|
|
+ v-model="form.description"
|
|
:disabled="isDisabled"
|
|
:disabled="isDisabled"
|
|
type="textarea"
|
|
type="textarea"
|
|
- id="promotionEdit-ruleExplain"
|
|
|
|
|
|
+ id="promotionEdit-description"
|
|
placeholder="请输入促销描述(最多500个字符)"
|
|
placeholder="请输入促销描述(最多500个字符)"
|
|
:maxLength="500" />
|
|
:maxLength="500" />
|
|
</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="promoRule.dealerEditFlag">
|
|
|
|
|
|
+ <a-form-model-item label="加盟商开关权限" prop="dealerOpenFlag">
|
|
<v-select
|
|
<v-select
|
|
- v-model="form.contentType"
|
|
|
|
- id="promotion-contentType"
|
|
|
|
|
|
+ v-model="form.dealerOpenFlag"
|
|
|
|
+ id="promotion-dealerOpenFlag"
|
|
code="FLAG"
|
|
code="FLAG"
|
|
showType="radio"
|
|
showType="radio"
|
|
:disabled="true"
|
|
:disabled="true"
|
|
- @change="changeContentType"
|
|
|
|
allowClear></v-select>
|
|
allowClear></v-select>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
<!-- 买产品送代金券 -->
|
|
<!-- 买产品送代金券 -->
|
|
- <div v-if="pageType=='coupon'">
|
|
|
|
|
|
+ <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
|
|
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
<a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="promoRule.ruleName">
|
|
<a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="promoRule.ruleName">
|
|
<a-input
|
|
<a-input
|
|
@@ -211,40 +210,37 @@
|
|
</div>
|
|
</div>
|
|
<div v-if="isShowNextStep">
|
|
<div v-if="isShowNextStep">
|
|
<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="pageType=='product'?'满赠规则': pageType=='special'?'优惠方式':'返券产品'" prop="promoRule.range">
|
|
|
|
|
|
+ <a-form-model-item :label="pageType==='BUY_PROD_GIVE_PROD'?'满赠规则': pageType==='PROMO_PROD'?'优惠方式':'返券产品'">
|
|
<div class="productInfo flex-center">
|
|
<div class="productInfo flex-center">
|
|
<!-- 买产品送产品 -->
|
|
<!-- 买产品送产品 -->
|
|
- <div v-if="pageType=='product'">
|
|
|
|
|
|
+ <div v-if="pageType==='BUY_PROD_GIVE_PROD'">
|
|
同款产品买<a-input-number
|
|
同款产品买<a-input-number
|
|
- v-model="form.promoRule.ruleValue"
|
|
|
|
|
|
+ v-model="conditionValue"
|
|
style="margin:0 5px;"
|
|
style="margin:0 5px;"
|
|
- :min="0"
|
|
|
|
|
|
+ :min="1"
|
|
:step="1"
|
|
:step="1"
|
|
- :precision="2"
|
|
|
|
|
|
+ :precision="0"
|
|
:max="99999999"
|
|
:max="99999999"
|
|
- id="promotionEdit-ruleValue"
|
|
|
|
- :disabled="isDisabled"
|
|
|
|
|
|
+ id="promotionEdit-conditionValue"
|
|
size="small"/>赠
|
|
size="small"/>赠
|
|
<a-input-number
|
|
<a-input-number
|
|
- v-model="form.promoRule.ruleValue"
|
|
|
|
|
|
+ v-model="resultValue"
|
|
style="margin:0 5px;"
|
|
style="margin:0 5px;"
|
|
:min="0"
|
|
:min="0"
|
|
:step="1"
|
|
:step="1"
|
|
- :precision="2"
|
|
|
|
|
|
+ :precision="0"
|
|
:max="99999999"
|
|
:max="99999999"
|
|
- id="promotionEdit-ruleValue"
|
|
|
|
- :disabled="isDisabled"
|
|
|
|
|
|
+ id="promotionEdit-resultValue"
|
|
size="small"/>个(数量叠加)
|
|
size="small"/>个(数量叠加)
|
|
<a-button
|
|
<a-button
|
|
type="primary"
|
|
type="primary"
|
|
id="promotionEdit-addSet-btn"
|
|
id="promotionEdit-addSet-btn"
|
|
- :disabled="isDisabled"
|
|
|
|
class="button-primary"
|
|
class="button-primary"
|
|
size="small"
|
|
size="small"
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- 特价产品 -->
|
|
<!-- 特价产品 -->
|
|
- <div v-if="pageType==='special'" style="width:80%;">
|
|
|
|
|
|
+ <div v-if="pageType==='PROMO_PROD'" style="width:80%;">
|
|
<a-select
|
|
<a-select
|
|
id="promotionList-discountType"
|
|
id="promotionList-discountType"
|
|
default-value="0"
|
|
default-value="0"
|
|
@@ -280,7 +276,7 @@
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
@click="handleBatchAdd">批量设置</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- 买产品返代金券 -->
|
|
<!-- 买产品返代金券 -->
|
|
- <div v-if="pageType=='coupon'">
|
|
|
|
|
|
+ <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
|
|
返券金额
|
|
返券金额
|
|
<a-input-number
|
|
<a-input-number
|
|
v-model="form.promoRule.ruleValue"
|
|
v-model="form.promoRule.ruleValue"
|
|
@@ -306,7 +302,7 @@
|
|
</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">
|
|
<div style="width: 83%;margin:0 auto 10px;">
|
|
<div style="width: 83%;margin:0 auto 10px;">
|
|
- <productTable ref="chooseProductList" :promoActiveSn="$route.params.sn" :disabledVal="isDisabled"></productTable>
|
|
|
|
|
|
+ <productTable ref="chooseProductList" :promoActiveSn="form.promoSn" :disabledVal="isDisabled"></productTable>
|
|
</div>
|
|
</div>
|
|
</a-col>
|
|
</a-col>
|
|
</div>
|
|
</div>
|
|
@@ -357,6 +353,7 @@ import chooseProduct from './chooseProductsModal.vue'
|
|
// 接口
|
|
// 接口
|
|
import { productTypeQuery } from '@/api/productType'
|
|
import { productTypeQuery } from '@/api/productType'
|
|
import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
|
|
import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
|
|
|
|
+import { saveChooseProduct, saveShopPromo, shopPromoDetail } from '@/api/shopPromo'
|
|
export default {
|
|
export default {
|
|
name: 'ProductBrandEditModal',
|
|
name: 'ProductBrandEditModal',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
@@ -372,65 +369,61 @@ export default {
|
|
productRangeList: [], // 产品范围列表
|
|
productRangeList: [], // 产品范围列表
|
|
dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
|
|
dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
|
|
openDealerModal: false,
|
|
openDealerModal: false,
|
|
|
|
+
|
|
|
|
+ pageType: undefined, // 促销类型
|
|
// 链接配置内容
|
|
// 链接配置内容
|
|
form: {
|
|
form: {
|
|
- promoActiveSn: undefined, // 促销活动sn
|
|
|
|
- title: '', // 标题
|
|
|
|
- imageSet: '', // 图片
|
|
|
|
- contentType: 'IMAGE_CONTENT', // 内容类型
|
|
|
|
- content: '', // 内容
|
|
|
|
- contentLink: '', // 链接内容
|
|
|
|
|
|
+ promoType: undefined, // 促销类型
|
|
|
|
+
|
|
|
|
+ promoName: '', // '促销名称'
|
|
|
|
+ time: [], // 促销时间
|
|
|
|
+ promoStartDate: undefined, // 促销时间-开始
|
|
|
|
+ promoEndDate: undefined, // 促销时间-结束
|
|
sort: undefined, // 排序
|
|
sort: undefined, // 排序
|
|
- publishFlag: '0', // 是否发布
|
|
|
|
- linkType: '1',
|
|
|
|
- dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
|
- promoRule: {
|
|
|
|
- ruleType: 'ticket', // 基本规则类型
|
|
|
|
- ruleName: '', // 券名称
|
|
|
|
- ruleTitle: '', // 副标题
|
|
|
|
- ruleBaseType: 'category', // 券生成方式
|
|
|
|
- ruleExplain: '', // 使用说明
|
|
|
|
- validType: undefined, // 券有效期类型
|
|
|
|
- validStartDate: undefined, // 券生效时间
|
|
|
|
- validEndDate: undefined, // 券失效时间
|
|
|
|
- validDays: undefined, // 券有效期天数
|
|
|
|
- dealerEditFlag: '0', // 加盟商编辑 1是 0否
|
|
|
|
- publishFlag: '0', // 是否发布
|
|
|
|
- range: '1'
|
|
|
|
- },
|
|
|
|
- promotionRuleType: 'other'
|
|
|
|
|
|
+ allDealerFlag: '1', // 全部经销商 1 部分经销商0'
|
|
|
|
+ imageUrl: undefined, // 促销封面图
|
|
|
|
+ description: '', // '促销描述'
|
|
|
|
+ dealerEditFlag: '0', // 加盟商编辑 0否 1是
|
|
|
|
+ dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
|
|
|
|
+ rangeList: []// 选择产品列表
|
|
|
|
+ // 'discountType': '特价产品 - 优惠方式',
|
|
|
|
+ // 'validName': '券名称',
|
|
|
|
+ // 'validTitle': '券副标题',
|
|
|
|
+ // 'validBaseType': '券生成方式',
|
|
|
|
+ // 'validType': '券有效期类型',
|
|
|
|
+ // 'validStartDate': '券生效时间',
|
|
|
|
+ // 'validEndDate': '券失效时间',
|
|
|
|
+ // 'validDays': '券有效期天数',
|
|
|
|
+ // 'validScope': '券适用范围标记 1-全部 0-指定 死值 1'
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
+ conditionValue: undefined, // 买产品送产品 买
|
|
|
|
+ resultValue: undefined, // 买产品送产品 赠
|
|
|
|
+
|
|
chooseDealerList: [], // 所选经销商数据
|
|
chooseDealerList: [], // 所选经销商数据
|
|
time: [], // 有效期
|
|
time: [], // 有效期
|
|
promotionName: '', // 促销名称
|
|
promotionName: '', // 促销名称
|
|
- pageType: undefined, // 页面类型
|
|
|
|
showProModal: false, // 打开产品弹窗
|
|
showProModal: false, // 打开产品弹窗
|
|
- isShowNextStep: true, // 是否显示下一步 并提交一半配置产品
|
|
|
|
|
|
+ isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
|
|
isDisabled: false, // 控制页面是否能编辑
|
|
isDisabled: false, // 控制页面是否能编辑
|
|
chooseTypeList: [], // 已选中产品范围
|
|
chooseTypeList: [], // 已选中产品范围
|
|
imageSet: [], // 回显显示图片数据
|
|
imageSet: [], // 回显显示图片数据
|
|
productTypeList: [], // 产品范围 列表数据
|
|
productTypeList: [], // 产品范围 列表数据
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
rules: {
|
|
rules: {
|
|
- title: [{ required: true, message: '请输入标题名称', trigger: 'blur' }],
|
|
|
|
- imageSet: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
|
|
|
|
|
|
+ promoName: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
|
|
|
|
+ time: [{ required: true, message: '请选择促销时间', trigger: 'change' }],
|
|
sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
|
|
sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
|
|
- 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' }],
|
|
|
|
- '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' }]
|
|
|
|
|
|
+ allDealerFlag: [{ required: true, message: '请选择参与经销商', trigger: 'change' }],
|
|
|
|
+ imageUrl: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
|
|
|
|
+ description: [{ required: true, message: '请输入促销描述内容', trigger: 'blur' }],
|
|
|
|
+ dealerOpenFlag: [{ required: true, message: '请选择加盟商开关权限', trigger: 'change' }],
|
|
|
|
+ rangeList: [{ required: true, message: '请选择促销产品', trigger: 'change' }]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ changeDealerScope () {},
|
|
addDealerOk () {},
|
|
addDealerOk () {},
|
|
// 选择经销商
|
|
// 选择经销商
|
|
handleDealerModal () {
|
|
handleDealerModal () {
|
|
@@ -444,12 +437,12 @@ export default {
|
|
disabledDate (current) {
|
|
disabledDate (current) {
|
|
return current && current < moment().startOf('day')
|
|
return current && current < moment().startOf('day')
|
|
},
|
|
},
|
|
- // 日期 change
|
|
|
|
|
|
+ // 促销时间 change
|
|
dateChange (date, dateStrings) {
|
|
dateChange (date, dateStrings) {
|
|
if (dateStrings && dateStrings[0]) {
|
|
if (dateStrings && dateStrings[0]) {
|
|
this.form.time = dateStrings
|
|
this.form.time = dateStrings
|
|
- this.form.activeDateStart = date.length ? dateStrings[0] + ' 00:00:00' : ''
|
|
|
|
- this.form.activeDateEnd = date.length ? dateStrings[1] + ' 23:59:59' : ''
|
|
|
|
|
|
+ this.form.promoStartDate = date.length ? dateStrings[0] + ' 00:00:00' : ''
|
|
|
|
+ this.form.promoEndDate = date.length ? dateStrings[1] + ' 23:59:59' : ''
|
|
} else {
|
|
} else {
|
|
this.form.time = []
|
|
this.form.time = []
|
|
}
|
|
}
|
|
@@ -469,55 +462,27 @@ export default {
|
|
handleBack () {
|
|
handleBack () {
|
|
this.$router.push({ name: 'promotionalActivities', query: { closeLastOldTab: true } })
|
|
this.$router.push({ name: 'promotionalActivities', query: { closeLastOldTab: true } })
|
|
},
|
|
},
|
|
- // 详情 挨个赋值原因:该接口和修理厂促销列表详情用的同一个接口,给后端传值过滤多余参数
|
|
|
|
- getDetail () {
|
|
|
|
|
|
+ // 详情
|
|
|
|
+ async getDetail (ajaxData) {
|
|
const _this = this
|
|
const _this = this
|
|
- promoActiveDetail({ sn: this.$route.params.sn }).then(res => {
|
|
|
|
- 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') {
|
|
|
|
- _this.$refs.editor.setHtml(res.data.content)
|
|
|
|
- } else if (res.data.contentType == 'VIDEO') {
|
|
|
|
- if (res.data.publishState != 'PUBLISH') {
|
|
|
|
- _this.$refs.videoSet.setFileList(res.data.content)
|
|
|
|
- }
|
|
|
|
- } else if (res.data.contentType == 'LINK') {
|
|
|
|
- _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 }
|
|
|
|
- }
|
|
|
|
|
|
+ const res = await shopPromoDetail(ajaxData)
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ if (res.data.promoStartDate && res.data.promoEndDate) {
|
|
|
|
+ const startTime = res.data.promoStartDate.split(' ')[0]
|
|
|
|
+ const endTime = res.data.promoEndDate.split(' ')[0]
|
|
|
|
+ res.data.time = [startTime, endTime]
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ if (res.data.imageUrl) {
|
|
|
|
+ _this.$refs.imageSet.setFileList(res.data.imageUrl)
|
|
|
|
+ }
|
|
|
|
+ _this.form = res.data
|
|
|
|
+ if (_this.$route.params.pageType === 'edit') {
|
|
|
|
+ _this.pageType = res.data.promoType
|
|
|
|
+ _this.promotionName = res.data.promoName
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _this.isShowNextStep = true
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 券有效期 change
|
|
// 券有效期 change
|
|
handleValidType (con) {
|
|
handleValidType (con) {
|
|
@@ -533,12 +498,11 @@ export default {
|
|
// 确定保存 验证必填
|
|
// 确定保存 验证必填
|
|
handleSave (type) {
|
|
handleSave (type) {
|
|
const _this = this
|
|
const _this = this
|
|
- if (_this.form.contentType === 'LINK') {
|
|
|
|
- _this.form.content = _this.form.contentLink
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// 验证组件必填项
|
|
// 验证组件必填项
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ _this.$refs.ruleForm.clearValidate('rangeList')
|
|
_this.savePartInfo(type)
|
|
_this.savePartInfo(type)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -546,47 +510,47 @@ export default {
|
|
// 保存
|
|
// 保存
|
|
savePartInfo (type) {
|
|
savePartInfo (type) {
|
|
const _this = this
|
|
const _this = this
|
|
- _this.form.promoActiveSn = this.$route.params.sn
|
|
|
|
|
|
+ _this.form.promoType = _this.pageType
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
- formData.imageSet = formData.imageSet ? formData.imageSet.split(',') : []
|
|
|
|
- // 跳转链接
|
|
|
|
- if (formData.contentType == 'LINK') {
|
|
|
|
- delete formData.contentLink
|
|
|
|
- if (_this.productRangeList && _this.productRangeList.length > 0) {
|
|
|
|
- formData.promoRule.productRangeList = _this.productRangeList.map(item => { return { productTypeSn: item } })
|
|
|
|
- }
|
|
|
|
- // 促销活动
|
|
|
|
- if (_this.form.linkType === '1') {
|
|
|
|
- if (_this.form.promoRule.validType === 'FIXED') {
|
|
|
|
- if (!_this.form.promoRule.validStartDate || _this.form.promoRule.validStartDate.validEndDate) {
|
|
|
|
- _this.$message.warning('请输入券有效期!')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (!_this.form.promoRule.validDays) {
|
|
|
|
- _this.$message.warning('请输入券有效期!')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- formData.publishFlag = _this.form.promoRule.publishFlag
|
|
|
|
- formData.dealerEditFlag = _this.form.promoRule.dealerEditFlag
|
|
|
|
- } else {
|
|
|
|
- formData.promoRule = undefined
|
|
|
|
- }
|
|
|
|
- if (_this.$refs.chooseProductList) {
|
|
|
|
- const numInfo = _this.$refs.chooseProductList.getDataNum()
|
|
|
|
- if (numInfo == 0) {
|
|
|
|
- _this.$message.warning('请选择返券产品!')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- formData.promoRule = undefined
|
|
|
|
- }
|
|
|
|
|
|
+ delete formData.time
|
|
|
|
+ // // 跳转链接
|
|
|
|
+ // if (formData.contentType == 'LINK') {
|
|
|
|
+ // delete formData.contentLink
|
|
|
|
+ // if (_this.productRangeList && _this.productRangeList.length > 0) {
|
|
|
|
+ // formData.promoRule.productRangeList = _this.productRangeList.map(item => { return { productTypeSn: item } })
|
|
|
|
+ // }
|
|
|
|
+ // // 促销活动
|
|
|
|
+ // if (_this.form.linkType === '1') {
|
|
|
|
+ // if (_this.form.promoRule.validType === 'FIXED') {
|
|
|
|
+ // if (!_this.form.promoRule.validStartDate || _this.form.promoRule.validStartDate.validEndDate) {
|
|
|
|
+ // _this.$message.warning('请输入券有效期!')
|
|
|
|
+ // return false
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // if (!_this.form.promoRule.validDays) {
|
|
|
|
+ // _this.$message.warning('请输入券有效期!')
|
|
|
|
+ // return false
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // formData.publishFlag = _this.form.promoRule.publishFlag
|
|
|
|
+ // formData.dealerEditFlag = _this.form.promoRule.dealerEditFlag
|
|
|
|
+ // } else {
|
|
|
|
+ // formData.promoRule = undefined
|
|
|
|
+ // }
|
|
|
|
+ // if (_this.$refs.chooseProductList) {
|
|
|
|
+ // const numInfo = _this.$refs.chooseProductList.getDataNum()
|
|
|
|
+ // if (numInfo == 0) {
|
|
|
|
+ // _this.$message.warning('请选择返券产品!')
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // formData.promoRule = undefined
|
|
|
|
+ // }
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
-
|
|
|
|
- promoActivePublish(formData).then(res => {
|
|
|
|
|
|
+ saveShopPromo(formData).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
|
|
+ debugger
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
if (type === 'all') {
|
|
if (type === 'all') {
|
|
_this.$nextTick(() => {
|
|
_this.$nextTick(() => {
|
|
@@ -595,7 +559,7 @@ export default {
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
_this.isShowNextStep = true
|
|
_this.isShowNextStep = true
|
|
- _this.getDetail()
|
|
|
|
|
|
+ _this.getDetail({ sn: res.data.shopPromo.promoSn })
|
|
}
|
|
}
|
|
_this.spinning = false
|
|
_this.spinning = false
|
|
} else {
|
|
} else {
|
|
@@ -605,7 +569,7 @@ export default {
|
|
},
|
|
},
|
|
// 图片上传
|
|
// 图片上传
|
|
changeImage (file) {
|
|
changeImage (file) {
|
|
- this.form.imageSet = file
|
|
|
|
|
|
+ this.form.imageUrl = file
|
|
},
|
|
},
|
|
// 视频上传
|
|
// 视频上传
|
|
changeVideo (file) {
|
|
changeVideo (file) {
|
|
@@ -665,15 +629,15 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 获取产品范围数据
|
|
// 获取产品范围数据
|
|
- getTreeData () {
|
|
|
|
- productTypeQuery({}).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.productTypeList = res.data
|
|
|
|
- } else {
|
|
|
|
- this.productTypeList = []
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
|
|
+ // getTreeData () {
|
|
|
|
+ // productTypeQuery({}).then(res => {
|
|
|
|
+ // if (res.status == 200) {
|
|
|
|
+ // this.productTypeList = res.data
|
|
|
|
+ // } else {
|
|
|
|
+ // this.productTypeList = []
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
// 选择内容类型
|
|
// 选择内容类型
|
|
changeContentType (e) {
|
|
changeContentType (e) {
|
|
if (e === 'LINK') {
|
|
if (e === 'LINK') {
|
|
@@ -705,30 +669,28 @@ export default {
|
|
this.chooseTypeList = this.productRangeList
|
|
this.chooseTypeList = this.productRangeList
|
|
this.showProModal = true
|
|
this.showProModal = true
|
|
},
|
|
},
|
|
- // 批量添加
|
|
|
|
|
|
+ // 批量设置
|
|
handleBatchAdd () {
|
|
handleBatchAdd () {
|
|
- if (!this.form.promoRule.ruleValue) {
|
|
|
|
- this.$message.warning('请输入返券金额(需大于0)!')
|
|
|
|
|
|
+ if (!this.conditionValue && !this.resultValue) {
|
|
|
|
+ this.$message.warning('请输入促销优惠规则!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- this.$refs.chooseProductList.editMorePrice(this.form.promoRule.ruleValue)
|
|
|
|
|
|
+ this.$refs.chooseProductList.editMorePrice({ conditionValue: this.conditionValue, resultValue: this.resultValue })
|
|
},
|
|
},
|
|
// 添加产品成功
|
|
// 添加产品成功
|
|
addProductSuccess (list) {
|
|
addProductSuccess (list) {
|
|
const productArr = list.map(item => {
|
|
const productArr = list.map(item => {
|
|
return {
|
|
return {
|
|
- promoActiveSn: this.$route.params.sn,
|
|
|
|
- promoRuleSn: this.form.promoRule.promoRuleSn,
|
|
|
|
- productCode: item.code,
|
|
|
|
|
|
+ promoSn: this.form.promoSn,
|
|
|
|
+ shopProductSn: item.shopProductSn,
|
|
productSn: item.productSn,
|
|
productSn: item.productSn,
|
|
- ruleValue: this.form.promoRule.ruleValue,
|
|
|
|
- price: item.terminalPrice
|
|
|
|
|
|
+ productCode: item.productCode
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- promoCreateBatch(productArr).then(res => {
|
|
|
|
|
|
+ saveChooseProduct(productArr).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.showProModal = false
|
|
this.showProModal = false
|
|
- // 获取产品列表 有分页
|
|
|
|
|
|
+ // // 获取产品列表 有分页
|
|
this.$refs.chooseProductList.pageInit()
|
|
this.$refs.chooseProductList.pageInit()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -756,14 +718,14 @@ export default {
|
|
},
|
|
},
|
|
// 初始化
|
|
// 初始化
|
|
pageInit () {
|
|
pageInit () {
|
|
- this.pageType = this.$route.params.pageType
|
|
|
|
- if (this.pageType === 'edit') {
|
|
|
|
- this.getDetail()
|
|
|
|
|
|
+ if (this.$route.params.pageType === 'edit') {
|
|
|
|
+ this.getDetail({ sn: this.$route.params.sn })
|
|
|
|
+ } else {
|
|
|
|
+ this.pageType = this.$route.params.pageType
|
|
}
|
|
}
|
|
- console.log('加载产品范围')
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.getTreeData()
|
|
|
|
- })
|
|
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
+ // this.getTreeData()
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|