|
@@ -63,17 +63,16 @@
|
|
|
v-model="form.allDealerFlag"
|
|
|
placeholder="请选择参与经销商"
|
|
|
@change="changeDealerScope"
|
|
|
- :disabled="true"
|
|
|
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.dealerScope && form.dealerScope!='ALL_DEALER' ">
|
|
|
+ <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 }}选项
|
|
|
+ 已 {{ chooseDealerList.length }} 选项
|
|
|
</a-col>
|
|
|
<a-col :md="24" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
|
|
|
<div class="buyerBox">
|
|
@@ -86,17 +85,19 @@
|
|
|
</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" class="promotionEdit-img">
|
|
|
- <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>
|
|
|
+ <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">
|
|
@@ -203,81 +204,84 @@
|
|
|
<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 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 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>
|
|
|
+ <span>已选 {{ porductChooseTotal || 0 }} 项</span>
|
|
|
</div>
|
|
|
<a-button type="primary" id="promotionEdit-add-btn" @click="handleChooseProduct" size="small">选择产品</a-button>
|
|
|
</div>
|
|
@@ -285,7 +289,7 @@
|
|
|
</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="form.promoSn" :discountType="form.discountType" :activeType="pageType"></productTable>
|
|
|
+ <productTable ref="chooseProductList" @changeSel="v=>porductChooseTotal=v" :promoActiveSn="form.promoSn" :discountType="form.discountType" :activeType="pageType"></productTable>
|
|
|
</div>
|
|
|
</a-col>
|
|
|
</div>
|
|
@@ -318,7 +322,7 @@
|
|
|
@ok="addProductSuccess"
|
|
|
@close="closeProductModal"></chooseProduct>
|
|
|
<!-- 选择经销商 -->
|
|
|
- <chooseDealer :openModal="openDealerModal" @close="closeDealerModal" @ok="addDealerOk"></chooseDealer>
|
|
|
+ <chooseDealer ref="chooseDearler" :openModal="openDealerModal" :chooseInfo="chooseSnList" @close="closeDealerModal" @ok="addDealerOk"></chooseDealer>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -378,6 +382,8 @@ export default {
|
|
|
conditionValue: undefined, // 买产品送产品 买
|
|
|
resultValue: undefined, // 买产品送产品 赠 返券金额
|
|
|
chooseDealerList: [], // 所选经销商数据
|
|
|
+ chooseSnList: [], // 已选经销商sn
|
|
|
+ porductChooseTotal: 0, // 已选产品总数
|
|
|
timeLimit: [], // 有效期
|
|
|
promotionName: '', // 促销名称
|
|
|
showProModal: false, // 打开产品弹窗
|
|
@@ -401,18 +407,77 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 参与经销商 change
|
|
|
- changeDealerScope () {},
|
|
|
+ // 部分经销商 删除
|
|
|
+ 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
|
|
|
+ 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'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.form.allDealerFlag = val
|
|
|
+ if (val == '1') {
|
|
|
+ _this.chooseDealerList = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 部分 打开选择经销商弹窗
|
|
|
handleDealerModal () {
|
|
|
+ this.chooseSnList = this.chooseDealerList.map(item => item.dealerSn)
|
|
|
this.openDealerModal = true
|
|
|
},
|
|
|
- // 添加参与经销商成功
|
|
|
- addDealerOk () {},
|
|
|
- // 关闭经销商弹窗
|
|
|
+ // 关闭 选择经销商弹窗
|
|
|
closeDealerModal () {
|
|
|
+ this.chooseSnList = []
|
|
|
this.openDealerModal = false
|
|
|
},
|
|
|
+ // 部分经销商 选择经销商成功
|
|
|
+ addDealerOk (list) {
|
|
|
+ const _this = this
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.chooseDealerList = list
|
|
|
+ _this.openDealerModal = false
|
|
|
+ }
|
|
|
+ },
|
|
|
// 禁用日期时间
|
|
|
disabledDate (current) {
|
|
|
return current && current < moment().startOf('day')
|
|
@@ -441,17 +506,10 @@ export default {
|
|
|
async handleDiscountType (val) {
|
|
|
this.form.discountType = val
|
|
|
this.resultValue = undefined
|
|
|
- // const res = await clearByPromoSn({ promoSn: this.$route.params.sn })
|
|
|
- // if (res.status == '200') {
|
|
|
- // this.$refs.chooseProductList.pageInit()
|
|
|
- // }
|
|
|
},
|
|
|
// 添加产品
|
|
|
handleChooseProduct () {
|
|
|
this.showProModal = true
|
|
|
- // this.$nextTick(() => {
|
|
|
- // this.$refs.chooseProduct.resetSearchForm()
|
|
|
- // })
|
|
|
},
|
|
|
// 添加产品成功
|
|
|
addProductSuccess (list) {
|
|
@@ -526,10 +584,12 @@ export default {
|
|
|
_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()
|
|
|
- _this.form.productNum = _this.$refs.chooseProductList.getChooseProductNum()
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -548,7 +608,6 @@ export default {
|
|
|
handleSave (type) {
|
|
|
const _this = this
|
|
|
// 验证组件必填项
|
|
|
- console.log('_this.form.productNum ', _this.form.productNum)
|
|
|
_this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
_this.savePartInfo(type)
|
|
@@ -560,6 +619,14 @@ 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) {
|
|
@@ -582,6 +649,7 @@ export default {
|
|
|
delete formData.productNum
|
|
|
}
|
|
|
delete formData.time
|
|
|
+ delete formData.shopPromoDealerList
|
|
|
_this.spinning = true
|
|
|
saveShopPromo(formData).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -722,9 +790,6 @@ export default {
|
|
|
.promotionEdit-cont{
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
- .upload{
|
|
|
- width: 100%!important;
|
|
|
- }
|
|
|
// 文本编辑器 工具栏样式换行
|
|
|
.promotionEdit-editor{
|
|
|
.w-e-toolbar{
|