|
@@ -6,8 +6,42 @@
|
|
|
<template slot="subTitle">
|
|
|
<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>
|
|
|
+ <a-button
|
|
|
+ type="link"
|
|
|
+ class="button-primary"
|
|
|
+ id="promotionEdit-edit-btn"
|
|
|
+ @click.stop="handleEdit">
|
|
|
+ <a-icon type="edit"/>编辑
|
|
|
+ </a-button>
|
|
|
+ <a-button type="link" size="small" class="button-default" @click="showDetail=!showDetail">
|
|
|
+ <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
|
|
|
+ </a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
+ <a-card size="small" :bordered="false" class="promotionEditInfo" v-show="showDetail">
|
|
|
+ <div slot="title">
|
|
|
+ <span>基础信息</span>
|
|
|
+ </div>
|
|
|
+ <div v-if="form">
|
|
|
+ <a-descriptions :column="{ xs: 2, sm: 3, md: 3}">
|
|
|
+ <a-descriptions-item label="促销名称">{{ form.promoName || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="促销时间">
|
|
|
+ {{ form.promoStartDate }}{{ form.promoStartDate?' ~ ':'' }}{{ form.promoEndDate }}
|
|
|
+ </a-descriptions-item>
|
|
|
+ <a-descriptions-item label="排序">{{ form.sort || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item span="3" label="参与经销商" v-if="form.allDealerFlag=='1'">全部经销商</a-descriptions-item>
|
|
|
+ <a-descriptions-item span="3" label="参与经销商" v-else>
|
|
|
+ <span v-if="!form.shopPromoDealerList||(form.shopPromoDealerList&&form.shopPromoDealerList.length==0)">--</span>
|
|
|
+ <a-tag v-else v-for="con in form.shopPromoDealerList" :id="'promotionEdit-dealerSn'+con.dealerSn" :key="con.dealerSn">
|
|
|
+ {{ con.dealerName }}
|
|
|
+ </a-tag>
|
|
|
+ </a-descriptions-item>
|
|
|
+ <a-descriptions-item span="3" label="封面图片"><img :src="form.imageUrl" alt="图片走丢了" width="60" height="60" /></a-descriptions-item>
|
|
|
+ <a-descriptions-item span="3" label="促销描述">{{ form.description || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="加盟商开关权限">{{ form.dealerOpenFlag=='0'?'否':'是' }}</a-descriptions-item>
|
|
|
+ </a-descriptions>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
<!-- 表单 -->
|
|
|
<a-card :bordered="false" class="promotionEdit-cont">
|
|
|
<a-form-model
|
|
@@ -19,107 +53,6 @@
|
|
|
:wrapper-col="formItemLayout.wrapperCol"
|
|
|
>
|
|
|
<a-row>
|
|
|
- <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
- <a-form-model-item label="促销名称" prop="promoName" :label-col="{span:4}" :wrapper-col="{span:16}">
|
|
|
- <a-input
|
|
|
- id="promotionEdit-promoName"
|
|
|
- :maxLength="20"
|
|
|
- v-model.trim="form.promoName"
|
|
|
- placeholder="请输入促销名称(最多20个字符)"
|
|
|
- allowClear/>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
- <a-form-model-item label="促销时间" prop="time" :label-col="{span:4}" :wrapper-col="{span:16}">
|
|
|
- <a-range-picker
|
|
|
- style="width:100%"
|
|
|
- id="promotionAdd-time"
|
|
|
- v-model="form.time"
|
|
|
- :format="dateFormat"
|
|
|
- :disabled-date="disabledDate"
|
|
|
- @change="dateChange"
|
|
|
- :placeholder="['开始时间', '结束时间']" />
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
- <a-form-model-item label="排序" prop="sort" :label-col="{span:4}" :wrapper-col="{span:16}">
|
|
|
- <a-input-number
|
|
|
- style="width:100%"
|
|
|
- id="promotionEdit-sort"
|
|
|
- allowClear
|
|
|
- placeholder="请输入排序数字(数字越大越靠后)"
|
|
|
- v-model="form.sort"
|
|
|
- :min="0"
|
|
|
- :max="99999999"/>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="参与经销商" prop="allDealerFlag">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :md="10" :sm="24">
|
|
|
- <a-select
|
|
|
- style="width:98%;"
|
|
|
- id="promotionList-allDealerFlag"
|
|
|
- v-model="form.allDealerFlag"
|
|
|
- placeholder="请选择参与经销商"
|
|
|
- @change="changeDealerScope"
|
|
|
- allowClear>
|
|
|
- <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-col>
|
|
|
- <a-col :md="3" :sm="24" v-show="form.allDealerFlag && form.allDealerFlag!='1' ">
|
|
|
- <a-button id="promotionList-basicInfo-dealerScope" type="primary" :loading="spinning" @click="handleDealerModal">选择</a-button>
|
|
|
- </a-col>
|
|
|
- <a-col :md="5" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
|
- 已 {{ chooseDealerList.length }} 选项
|
|
|
- </a-col>
|
|
|
- <a-col :md="24" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
|
- <div class="buyerBox">
|
|
|
- <a-tag closable v-for="con in chooseDealerList" id="promotionList-dealerSn" :key="con.dealerSn" @close="delBuyerName(con)">
|
|
|
- {{ con.dealerName }}
|
|
|
- </a-tag>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="封面图片" prop="imageUrl">
|
|
|
- <div style="display:flex;">
|
|
|
- <Upload
|
|
|
- class="upload"
|
|
|
- id="promotionEdit-imageUrl"
|
|
|
- v-model="form.imageUrl"
|
|
|
- ref="imageSet"
|
|
|
- :fileSize="10"
|
|
|
- :maxNums="1"
|
|
|
- @change="changeImage"
|
|
|
- listType="picture-card"></Upload>
|
|
|
- <span class="upload-desc">说明:单张大小小于10Mb;建议尺寸:宽(420px)*高(230px)</span>
|
|
|
- </div>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="促销描述" prop="description">
|
|
|
- <a-input
|
|
|
- v-model="form.description"
|
|
|
- type="textarea"
|
|
|
- id="promotionEdit-description"
|
|
|
- placeholder="请输入促销描述(最多500个字符)"
|
|
|
- :maxLength="500" />
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item label="加盟商开关权限" prop="dealerOpenFlag">
|
|
|
- <v-select
|
|
|
- v-model="form.dealerOpenFlag"
|
|
|
- id="promotion-dealerOpenFlag"
|
|
|
- code="FLAG"
|
|
|
- showType="radio"
|
|
|
- allowClear></v-select>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
<!-- 买产品送代金券 -->
|
|
|
<div v-if="pageType=='BUY_PROD_GIVE_VALID'">
|
|
|
<a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
|
|
@@ -142,17 +75,6 @@
|
|
|
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="validBaseType">
|
|
|
- <v-select
|
|
|
- style="width:40%;"
|
|
|
- v-model="form.validBaseType"
|
|
|
- id="promotionEdit-ruleBaseType"
|
|
|
- code="SHOP_PROMO_VALID_BASE_TYPE"
|
|
|
- placeholder="请选择生成方式"
|
|
|
- allowClear></v-select>
|
|
|
- </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">
|
|
|
<v-select
|
|
@@ -185,7 +107,7 @@
|
|
|
</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="validScope">
|
|
|
+ <a-form-model-item class="productName" label="券适用范围">
|
|
|
全部产品
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -200,99 +122,101 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</div>
|
|
|
- <div v-if="isShowNextStep">
|
|
|
- <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <a-form-model-item prop="productNum" :label="pageType==='BUY_PROD_GIVE_PROD'?'满赠规则': pageType==='PROMO_PROD'?'优惠方式':'返券产品'">
|
|
|
- <div class="productInfo flex-center">
|
|
|
- <div style="display:flex;">
|
|
|
- <!-- 买产品送产品 -->
|
|
|
- <div v-if="pageType==='BUY_PROD_GIVE_PROD'">
|
|
|
- 同款产品买<a-input-number
|
|
|
- v-model="conditionValue"
|
|
|
- style="margin:0 5px;"
|
|
|
- :min="1"
|
|
|
- :step="1"
|
|
|
- :precision="0"
|
|
|
- :max="99999999"
|
|
|
- id="promotionEdit-conditionValue"
|
|
|
- size="small"/>赠
|
|
|
- <a-input-number
|
|
|
- v-model="resultValue"
|
|
|
- style="margin:0 5px;"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :precision="0"
|
|
|
- :max="99999999"
|
|
|
- id="promotionEdit-resultValue"
|
|
|
- size="small"/>个(数量叠加)
|
|
|
- <a-button
|
|
|
- type="primary"
|
|
|
- id="promotionEdit-addSet-btn"
|
|
|
- class="button-primary"
|
|
|
- size="small"
|
|
|
- @click="handleBatchAdd">批量设置</a-button>
|
|
|
- </div>
|
|
|
- <!-- 特价产品 -->
|
|
|
- <div v-if="pageType==='PROMO_PROD'" style="width:80%;">
|
|
|
- <v-select
|
|
|
- v-model="form.discountType"
|
|
|
- ref="promoState"
|
|
|
- id="promotionList-discountType"
|
|
|
- code="SHOP_PROMO_DISCOUNT_TYPE"
|
|
|
- size="small"
|
|
|
- style="width:15%;margin-right:5px;"
|
|
|
- @change="handleDiscountType"
|
|
|
- placeholder="请选择"
|
|
|
- allowClear></v-select>
|
|
|
- <span v-show="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '直降':'折扣' }}</span>
|
|
|
- <a-input-number
|
|
|
- v-model="resultValue"
|
|
|
- v-show="form.discountType"
|
|
|
- style="width:15%;margin:0 5px;"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :precision="2"
|
|
|
- :max="99999999"
|
|
|
- id="promotionEdit-resultValue"
|
|
|
- size="small"/><span v-show="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '元':'%' }}</span>
|
|
|
- <a-button
|
|
|
- type="primary"
|
|
|
- id="promotionEdit-addSet-btn"
|
|
|
- class="button-primary"
|
|
|
- size="small"
|
|
|
- @click="handleBatchAdd">批量设置</a-button>
|
|
|
- </div>
|
|
|
- <!-- 买产品返代金券 -->
|
|
|
- <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
|
|
|
- 返券金额
|
|
|
- <a-input-number
|
|
|
- v-model="resultValue"
|
|
|
- style="margin:0 5px;"
|
|
|
- :min="0"
|
|
|
- :step="1"
|
|
|
- :precision="2"
|
|
|
- :max="99999999"
|
|
|
- id="promotionEdit-resultValue"
|
|
|
- size="small"/>元
|
|
|
- <a-button
|
|
|
- type="primary"
|
|
|
- id="promotionEdit-addSet-btn"
|
|
|
- class="button-primary"
|
|
|
- size="small"
|
|
|
- @click="handleBatchAdd">批量设置</a-button>
|
|
|
- </div>
|
|
|
+ <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <a-form-model-item prop="productNum" :label="pageType==='BUY_PROD_GIVE_PROD'?'满赠规则': pageType==='PROMO_PROD'?'优惠方式':'返券产品'">
|
|
|
+ <div class="productInfo flex-center">
|
|
|
+ <div style="width:80%;">
|
|
|
+ <!-- 买产品送产品 -->
|
|
|
+ <div v-if="pageType==='BUY_PROD_GIVE_PROD'">
|
|
|
+ 同款产品买<a-input-number
|
|
|
+ v-model="conditionValue"
|
|
|
+ style="margin:0 5px;"
|
|
|
+ :min="1"
|
|
|
+ :step="1"
|
|
|
+ :precision="0"
|
|
|
+ :max="99999999"
|
|
|
+ id="promotionEdit-conditionValue"
|
|
|
+ size="small"/>赠
|
|
|
+ <a-input-number
|
|
|
+ v-model="resultValue"
|
|
|
+ style="margin:0 5px;"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ :precision="0"
|
|
|
+ :max="99999999"
|
|
|
+ id="promotionEdit-resultValue"
|
|
|
+ size="small"/>个(数量叠加)
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ id="promotionEdit-addSet-btn"
|
|
|
+ class="button-primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleBatchAdd">批量设置</a-button>
|
|
|
+ <span>已选 {{ porductChooseTotal || 0 }} 项</span>
|
|
|
+ </div>
|
|
|
+ <!-- 特价产品 -->
|
|
|
+ <div v-if="pageType==='PROMO_PROD'">
|
|
|
+ <v-select
|
|
|
+ v-model="form.discountType"
|
|
|
+ ref="promoState"
|
|
|
+ id="promotionList-discountType"
|
|
|
+ code="SHOP_PROMO_DISCOUNT_TYPE"
|
|
|
+ size="small"
|
|
|
+ style="width:20%;margin-right:5px;"
|
|
|
+ @change="handleDiscountType"
|
|
|
+ placeholder="请选择"
|
|
|
+ allowClear></v-select>
|
|
|
+ <span v-if="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '直降':'折扣' }}</span>
|
|
|
+ <a-input-number
|
|
|
+ v-model="resultValue"
|
|
|
+ v-if="form.discountType"
|
|
|
+ style="width:20%;margin:0 5px;"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ :precision="2"
|
|
|
+ :max="99999999"
|
|
|
+ id="promotionEdit-resultValue"
|
|
|
+ size="small"/><span v-show="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '元':'%' }}</span>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ id="promotionEdit-addSet-btn"
|
|
|
+ class="button-primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleBatchAdd">批量设置</a-button>
|
|
|
+ <span>已选 {{ porductChooseTotal || 0 }} 项</span>
|
|
|
+ </div>
|
|
|
+ <!-- 买产品返代金券 -->
|
|
|
+ <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
|
|
|
+ 返券金额
|
|
|
+ <a-input-number
|
|
|
+ v-model="resultValue"
|
|
|
+ style="margin:0 5px;"
|
|
|
+ :min="0"
|
|
|
+ :step="1"
|
|
|
+ :precision="2"
|
|
|
+ :max="99999999"
|
|
|
+ id="promotionEdit-resultValue"
|
|
|
+ size="small"/>元
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ id="promotionEdit-addSet-btn"
|
|
|
+ class="button-primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleBatchAdd">批量设置</a-button>
|
|
|
<span>已选 {{ porductChooseTotal || 0 }} 项</span>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ <div style="width:20%;text-align:right;" >
|
|
|
<a-button type="primary" id="promotionEdit-add-btn" @click="handleChooseProduct" 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" @changeSel="v=>porductChooseTotal=v" :promoActiveSn="form.promoSn" :discountType="form.discountType" :activeType="pageType"></productTable>
|
|
|
</div>
|
|
|
- </a-col>
|
|
|
- </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" @changeSel="v=>porductChooseTotal=v" :promoActiveSn="form.promoSn" :discountType="form.discountType" :activeType="pageType"></productTable>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
</a-row>
|
|
|
</a-form-model>
|
|
|
</a-card>
|
|
@@ -304,16 +228,8 @@
|
|
|
:disabled="spinning"
|
|
|
id="productInfoEdit-submit-btn"
|
|
|
size="large"
|
|
|
- @click="handleSave('all')"
|
|
|
- v-if="isShowNextStep"
|
|
|
+ @click="handleSaveAll"
|
|
|
style="padding: 0 60px;">保存</a-button>
|
|
|
- <a-button
|
|
|
- type="primary"
|
|
|
- class="button-primary"
|
|
|
- style="padding: 0 30px;"
|
|
|
- size="large"
|
|
|
- v-if="!isShowNextStep"
|
|
|
- @click="handleSave('part')">保存后设置产品</a-button>
|
|
|
</div>
|
|
|
<!-- 添加产品 -->
|
|
|
<chooseProduct
|
|
@@ -321,8 +237,15 @@
|
|
|
:openModal="showProModal"
|
|
|
@ok="addProductSuccess"
|
|
|
@close="closeProductModal"></chooseProduct>
|
|
|
- <!-- 选择经销商 -->
|
|
|
- <chooseDealer ref="chooseDearler" :openModal="openDealerModal" :chooseInfo="chooseSnList" @close="closeDealerModal" @ok="addDealerOk"></chooseDealer>
|
|
|
+ <!--编辑 促销活动 基础信息 -->
|
|
|
+ <add-promotion-modal
|
|
|
+ ref="promotionAddModal"
|
|
|
+ :openModal="openAddModal"
|
|
|
+ typeVal="edit"
|
|
|
+ :chooseProductNum="form.productNum"
|
|
|
+ :itemSn="$route.params.sn"
|
|
|
+ @close="openAddModal=false"
|
|
|
+ @ok="promotionAddOk" ></add-promotion-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -332,15 +255,15 @@ import moment from 'moment'
|
|
|
// 组件
|
|
|
import { VSelect, Upload } from '@/components'
|
|
|
import Editor from '@/components/WEeditor'
|
|
|
-import chooseDealer from '@/views/easyPassManagement/homepageCarouselImg/chooseDealer'
|
|
|
import productTable from './productTable'
|
|
|
import chooseProduct from './chooseProductsModal.vue'
|
|
|
+import addPromotionModal from './addPromotionModal'
|
|
|
// 接口
|
|
|
import { saveChooseProduct, saveShopPromo, shopPromoDetail } from '@/api/shopPromo'
|
|
|
export default {
|
|
|
name: 'ProductBrandEditModal',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { VSelect, Upload, Editor, productTable, chooseDealer, chooseProduct },
|
|
|
+ components: { VSelect, Upload, Editor, productTable, chooseProduct, addPromotionModal },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -349,10 +272,11 @@ export default {
|
|
|
labelCol: { span: 2 },
|
|
|
wrapperCol: { span: 20 }
|
|
|
},
|
|
|
- productRangeList: [], // 产品范围列表
|
|
|
dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
|
|
|
openDealerModal: false, // 打开选择经销商弹窗
|
|
|
pageType: undefined, // 促销类型
|
|
|
+ showDetail: true, // 是否显示基础信息
|
|
|
+ openAddModal: false, // 基础信息编辑弹窗
|
|
|
// 链接配置内容
|
|
|
form: {
|
|
|
promoType: undefined, // 促销类型
|
|
@@ -381,119 +305,37 @@ export default {
|
|
|
},
|
|
|
conditionValue: undefined, // 买产品送产品 买
|
|
|
resultValue: undefined, // 买产品送产品 赠 返券金额
|
|
|
- chooseDealerList: [], // 所选经销商数据
|
|
|
- chooseSnList: [], // 已选经销商sn
|
|
|
porductChooseTotal: 0, // 已选产品总数
|
|
|
timeLimit: [], // 有效期
|
|
|
promotionName: '', // 促销名称
|
|
|
showProModal: false, // 打开产品弹窗
|
|
|
- isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
|
|
|
// 表单验证规则
|
|
|
rules: {
|
|
|
- promoName: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
|
|
|
- time: [{ required: true, message: '请选择促销时间', trigger: 'change' }],
|
|
|
- sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
|
|
|
- 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' }],
|
|
|
validName: [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
|
|
|
validBaseType: [{ required: true, message: '请选择生成方式', trigger: 'change' }],
|
|
|
validType: [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
|
|
|
- validScope: [{ required: true, message: '请选择券适用范围', trigger: 'blur' }],
|
|
|
+ // validScope: [{ required: true, message: '请选择券适用范围', trigger: 'blur' }],
|
|
|
productNum: [{ required: true, message: '选择产品不能为空', trigger: 'blur' }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 部分经销商 删除
|
|
|
- delBuyerName (row) {
|
|
|
- const pos = this.chooseDealerList.findIndex(item => item.dealerSn == row.dealerSn)
|
|
|
- if (pos >= 0) {
|
|
|
- this.chooseDealerList.splice(pos, 1)
|
|
|
- }
|
|
|
- },
|
|
|
- // 参与经销商 change
|
|
|
- changeDealerScope (val) {
|
|
|
- const _this = this
|
|
|
- if (_this.$refs.chooseProductList) {
|
|
|
- const hasProduct = _this.$refs.chooseProductList.getChooseProductNum()
|
|
|
- if (hasProduct > 0) {
|
|
|
- _this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
|
|
|
- centered: true,
|
|
|
- onOk () {
|
|
|
- _this.form.allDealerFlag = val
|
|
|
- if (val == '1') {
|
|
|
- _this.chooseDealerList = []
|
|
|
- }
|
|
|
- // 情况产品列表
|
|
|
- _this.$refs.chooseProductList.clearTable()
|
|
|
- },
|
|
|
- onCancel () {
|
|
|
- _this.form.allDealerFlag = val == '1' ? '0' : '1'
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- _this.form.allDealerFlag = val
|
|
|
- if (val == '1' || !val) {
|
|
|
- _this.chooseDealerList = []
|
|
|
- }
|
|
|
- },
|
|
|
- // 部分 打开选择经销商弹窗
|
|
|
- handleDealerModal () {
|
|
|
- this.chooseSnList = this.chooseDealerList.map(item => item.dealerSn)
|
|
|
- this.openDealerModal = true
|
|
|
- },
|
|
|
- // 关闭 选择经销商弹窗
|
|
|
- closeDealerModal () {
|
|
|
- this.chooseSnList = []
|
|
|
- this.openDealerModal = false
|
|
|
+ // 编辑
|
|
|
+ handleEdit () {
|
|
|
+ this.openAddModal = true
|
|
|
+ this.form.productNum = this.$refs.chooseProductList.getChooseProductNum()
|
|
|
+ this.$refs.promotionAddModal.getDetail()
|
|
|
},
|
|
|
- // 部分经销商 选择经销商成功
|
|
|
- addDealerOk (list) {
|
|
|
+ promotionAddOk () {
|
|
|
const _this = this
|
|
|
- if (_this.$refs.chooseProductList) {
|
|
|
- const hasProduct = _this.$refs.chooseProductList.getChooseProductNum()
|
|
|
- const hasEq = list.filter(item => !this.chooseDealerList.map(k => k.dealerSn).includes(item.dealerSn))
|
|
|
- if (hasEq.length > 0 && hasProduct > 0) {
|
|
|
- _this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
|
|
|
- centered: true,
|
|
|
- onOk () {
|
|
|
- _this.chooseDealerList = list
|
|
|
- _this.openDealerModal = false
|
|
|
- // 清空产品列表
|
|
|
- _this.$refs.chooseProductList.clearTable()
|
|
|
- },
|
|
|
- onCancel () {
|
|
|
- _this.$refs.chooseDearler.pageFlag = false
|
|
|
- _this.$refs.chooseDearler.searchForm()
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- _this.chooseDealerList = list
|
|
|
- _this.openDealerModal = false
|
|
|
+ // 情况产品列表
|
|
|
+ _this.$refs.chooseProductList.clearTable()
|
|
|
},
|
|
|
// 禁用日期时间
|
|
|
disabledDate (current) {
|
|
|
return current && current < moment().startOf('day')
|
|
|
},
|
|
|
- // 促销时间 change
|
|
|
- dateChange (date, dateStrings) {
|
|
|
- if (dateStrings && dateStrings[0]) {
|
|
|
- this.form.time = dateStrings
|
|
|
- this.form.promoStartDate = date.length ? dateStrings[0] + ' 00:00:00' : ''
|
|
|
- this.form.promoEndDate = date.length ? dateStrings[1] + ' 23:59:59' : ''
|
|
|
- } else {
|
|
|
- this.form.time = []
|
|
|
- }
|
|
|
- },
|
|
|
// 有效期
|
|
|
dateLimitChange (date, dateStrings) {
|
|
|
if (dateStrings && dateStrings[0]) {
|
|
@@ -571,25 +413,12 @@ export default {
|
|
|
const _this = this
|
|
|
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
|
|
|
_this.form.productNum = 0
|
|
|
- _this.isShowNextStep = true
|
|
|
if (_this.$route.params.pageType === 'edit') {
|
|
|
_this.pageType = res.data.promoType
|
|
|
_this.promotionName = res.data.promoName
|
|
|
}
|
|
|
- // 部分经销商
|
|
|
- if (_this.form.allDealerFlag == 0) {
|
|
|
- _this.chooseDealerList = _this.form.shopPromoDealerList
|
|
|
- }
|
|
|
_this.$nextTick(() => {
|
|
|
_this.$refs.chooseProductList.pageInit()
|
|
|
})
|
|
@@ -607,12 +436,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 确定保存 验证必填
|
|
|
- handleSave (type) {
|
|
|
+ handleSaveAll () {
|
|
|
const _this = this
|
|
|
// 验证组件必填项
|
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
- _this.savePartInfo(type)
|
|
|
+ _this.savePartInfo()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -621,14 +450,6 @@ export default {
|
|
|
const _this = this
|
|
|
_this.form.promoType = _this.pageType
|
|
|
var formData = JSON.parse(JSON.stringify(_this.form))
|
|
|
- // 部分经销商
|
|
|
- if (formData.allDealerFlag == '0') {
|
|
|
- if (_this.chooseDealerList && _this.chooseDealerList.length == 0) {
|
|
|
- _this.$message.warning('请选择参与经销商!')
|
|
|
- return
|
|
|
- }
|
|
|
- formData.dealerSnList = _this.chooseDealerList.map(con => con.dealerSn)
|
|
|
- }
|
|
|
if (formData.promoType === 'BUY_PROD_GIVE_VALID') {
|
|
|
if (formData.validType === 'FIXED') {
|
|
|
if (!formData.validStartDate || !formData.validEndDate) {
|
|
@@ -642,16 +463,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (type === 'all') {
|
|
|
- formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
|
|
|
- if (formData.productNum && formData.productNum == 0) {
|
|
|
- _this.$message.warning('请先选择产品!')
|
|
|
- return
|
|
|
- }
|
|
|
- delete formData.productNum
|
|
|
+ formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
|
|
|
+ if (formData.productNum && formData.productNum == 0) {
|
|
|
+ _this.$message.warning('请先选择产品!')
|
|
|
+ return
|
|
|
}
|
|
|
- delete formData.time
|
|
|
- delete formData.shopPromoDealerList
|
|
|
+ delete formData.productNum
|
|
|
_this.spinning = true
|
|
|
saveShopPromo(formData).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -675,24 +492,15 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
_this.$message.success(res.message)
|
|
|
- if (type === 'all') {
|
|
|
- _this.$nextTick(() => {
|
|
|
- _this.handleBack()
|
|
|
- _this.resetSearchForm()
|
|
|
- })
|
|
|
- } else {
|
|
|
- _this.isShowNextStep = true
|
|
|
- _this.getDetail({ sn: res.data.shopPromo.promoSn })
|
|
|
- }
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ _this.handleBack()
|
|
|
+ _this.resetSearchForm()
|
|
|
+ })
|
|
|
} else {
|
|
|
_this.spinning = false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 封面图片上传
|
|
|
- changeImage (file) {
|
|
|
- this.form.imageUrl = file
|
|
|
- },
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
this.form = {
|
|
@@ -720,10 +528,6 @@ export default {
|
|
|
validInfo: '', // 使用说明
|
|
|
productNum: 0
|
|
|
}
|
|
|
- if (this.$refs.imageSet) {
|
|
|
- this.$refs.imageSet.setFileList('')
|
|
|
- }
|
|
|
- this.isShowNextStep = false
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
}
|
|
@@ -739,11 +543,7 @@ export default {
|
|
|
// 初始化
|
|
|
pageInit () {
|
|
|
this.form.discountType = ''
|
|
|
- if (this.$route.params.pageType === 'edit') {
|
|
|
- this.getDetail({ sn: this.$route.params.sn })
|
|
|
- } else {
|
|
|
- this.pageType = this.$route.params.pageType
|
|
|
- }
|
|
|
+ this.getDetail({ sn: this.$route.params.sn })
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
@@ -773,6 +573,9 @@ export default {
|
|
|
height: 100%;
|
|
|
box-sizing: border-box;
|
|
|
padding-bottom:51px;
|
|
|
+ .promotionEditInfo{
|
|
|
+ margin-bottom:10px;
|
|
|
+ }
|
|
|
.buyerBox{
|
|
|
border:1px solid #d9d9d9;
|
|
|
margin-top:10px;
|
|
@@ -831,13 +634,22 @@ export default {
|
|
|
}
|
|
|
|
|
|
.productInfo{
|
|
|
+ width:100%;
|
|
|
display:flex;
|
|
|
- justify-content: space-between;
|
|
|
}
|
|
|
#setPromotion-productRange{
|
|
|
/deep/.ant-select-dropdown{
|
|
|
max-height:30vh !important;
|
|
|
}
|
|
|
}
|
|
|
+ /deep/.productName .ant-form-item-label::before{
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 4px;
|
|
|
+ color: #f5222d;
|
|
|
+ font-size: 12px;
|
|
|
+ font-family: SimSun, sans-serif;
|
|
|
+ line-height: 1;
|
|
|
+ content: '*';
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|