|
@@ -10,63 +10,65 @@
|
|
|
>
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
<!-- 批量操作 -->
|
|
|
- <div v-if="salesBillDetailSnList.length">
|
|
|
+ <div style="padding: 0 30px;" v-if="salesBillDetailSnList.length">
|
|
|
<div>
|
|
|
- <span>产品范围</span>
|
|
|
+ <span>产品范围:</span>
|
|
|
<aRadioGroup v-model="productType">
|
|
|
- <aRadio value="0">选中产品</aRadio>
|
|
|
- <aRadio value="1">全部产品</aRadio>
|
|
|
+ <aRadio :style="radioStyle0" value="0">选中产品</aRadio>
|
|
|
+ <aRadio :style="radioStyle0" value="1">全部产品</aRadio>
|
|
|
</aRadioGroup>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span>规则范围</span>
|
|
|
- <aRadioGroup v-model="ruleType">
|
|
|
- <aRadio value="0">选中规则</aRadio>
|
|
|
- <aRadio value="1">全部规则</aRadio>
|
|
|
+ <span>规则范围:</span>
|
|
|
+ <aRadioGroup v-model="ruleType" @change="(e)=>{upActiveValArr=[];upActiveVal=null}">
|
|
|
+ <aRadio :style="radioStyle0" value="0">选中规则</aRadio>
|
|
|
+ <aRadio :style="radioStyle0" value="1">全部规则</aRadio>
|
|
|
</aRadioGroup>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div style="padding: 0 30px;" v-if="total">
|
|
|
- <!-- 非叠加活动 -->
|
|
|
- <div>
|
|
|
- <aRadioGroup v-model="upActiveVal" @change="(e)=>{upActiveValArr=[]}">
|
|
|
- <aRadio :style="radioStyle" value="-1" v-if="pageType">
|
|
|
- 不参加促销
|
|
|
- </aRadio>
|
|
|
- <div v-if="noStackActiveList&&noStackActiveList.length">
|
|
|
- <strong >非叠加活动</strong>
|
|
|
- </div>
|
|
|
- <aRadio
|
|
|
- :style="radioStyle"
|
|
|
- v-for="(item,sindex) in noStackActiveList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.salesPromoSn">
|
|
|
- {{ sindex+1 }}、{{ item.promotionRule.promotionRuleTypeDictValue }} — {{ item.promotion.title }}({{ item.description }})
|
|
|
- </aRadio>
|
|
|
- </aRadioGroup>
|
|
|
- </div>
|
|
|
- <!-- 叠加活动 -->
|
|
|
- <div v-if="stackActiveList&&stackActiveList.length">
|
|
|
+ <div v-if="ruleType==0">
|
|
|
+ <div style="padding: 10px 30px;" v-if="total">
|
|
|
+ <!-- 非叠加活动 -->
|
|
|
<div>
|
|
|
- <strong >叠加活动</strong>
|
|
|
+ <aRadioGroup v-model="upActiveVal" @change="(e)=>{upActiveValArr=[]}">
|
|
|
+ <aRadio :style="radioStyle" value="-1" v-if="pageType">
|
|
|
+ 不参加促销
|
|
|
+ </aRadio>
|
|
|
+ <div v-if="noStackActiveList&&noStackActiveList.length">
|
|
|
+ <strong >非叠加活动</strong>
|
|
|
+ </div>
|
|
|
+ <aRadio
|
|
|
+ :style="radioStyle"
|
|
|
+ v-for="(item,sindex) in noStackActiveList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.salesPromoSn">
|
|
|
+ {{ sindex+1 }}、{{ item.promotionRule.promotionRuleTypeDictValue }} — {{ item.promotion.title }}({{ item.promotionRule.description }})
|
|
|
+ </aRadio>
|
|
|
+ </aRadioGroup>
|
|
|
+ </div>
|
|
|
+ <!-- 叠加活动 -->
|
|
|
+ <div v-if="stackActiveList&&stackActiveList.length">
|
|
|
+ <div>
|
|
|
+ <strong >叠加活动</strong>
|
|
|
+ </div>
|
|
|
+ <a-checkbox-group v-model="upActiveValArr" @change="(e)=>{upActiveVal=null}">
|
|
|
+ <a-checkbox
|
|
|
+ :style="radioStyle"
|
|
|
+ v-for="(item,sindex) in stackActiveList"
|
|
|
+ :value="item.salesPromoSn"
|
|
|
+ :key="item.id">
|
|
|
+ {{ sindex+1 }}、{{ item.promotionRule.promotionRuleTypeDictValue }} — {{ item.promotion.title }}({{ item.promotionRule.description }})
|
|
|
+ </a-checkbox>
|
|
|
+ </a-checkbox-group>
|
|
|
</div>
|
|
|
- <a-checkbox-group v-model="upActiveValArr" @change="(e)=>{upActiveVal=null}">
|
|
|
- <a-checkbox
|
|
|
- :style="radioStyle"
|
|
|
- v-for="(item,sindex) in stackActiveList"
|
|
|
- :value="item.salesPromoSn"
|
|
|
- :key="item.id">
|
|
|
- {{ sindex+1 }}、{{ item.promotionRule.promotionRuleTypeDictValue }} — {{ item.promotion.title }}({{ item.description }})
|
|
|
- </a-checkbox>
|
|
|
- </a-checkbox-group>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div style="padding: 10px 30px;text-align:center;" v-else>
|
|
|
- 没有可参与的【启用状态】的促销规则
|
|
|
+ <div style="padding: 10px 30px;text-align:center;" v-else>
|
|
|
+ 没有可参与的【启用状态】的促销规则
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div style="padding: 30px 0 0;text-align: center;">
|
|
|
<a-button @click="cancel" style="margin-right: 15px" :type="total?'default':'primary'" id="chooseCustom-btn-back">{{ total?'取消':'知道了' }}</a-button>
|
|
|
- <a-button v-if="total" type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
|
|
|
+ <a-button v-if="total" type="primary" :loading="confirmLoading" @click="salesBillDetailSnList.length?handleBatchSubmit():handleSubmit()" id="chooseCustom-btn-submit">确定</a-button>
|
|
|
</div>
|
|
|
</a-spin>
|
|
|
</a-modal>
|
|
@@ -93,6 +95,7 @@ export default {
|
|
|
upActiveVal: null,
|
|
|
upActiveValArr: [],
|
|
|
radioStyle: "display:block;height: '30px';lineHeight: '30px';padding:5px 0;margin:0;",
|
|
|
+ radioStyle0: "height: '30px';lineHeight: '30px';padding:5px 0;margin:0;",
|
|
|
activeList: [],
|
|
|
editRow: null,
|
|
|
salesBillDetailSnList: [],
|
|
@@ -105,6 +108,9 @@ export default {
|
|
|
if (this.total == 0) {
|
|
|
return '提示'
|
|
|
}
|
|
|
+ if (this.salesBillDetailSnList.length) {
|
|
|
+ return '批量匹配促销'
|
|
|
+ }
|
|
|
return this.pageType ? '确定换促销活动?' : '确定参加促销活动?'
|
|
|
},
|
|
|
total () {
|
|
@@ -112,10 +118,16 @@ export default {
|
|
|
},
|
|
|
// 叠加活动
|
|
|
stackActiveList () {
|
|
|
+ if (this.salesBillDetailSnList.length) {
|
|
|
+ return this.activeList.filter(item => item.promotionRule && item.promotionRule.stackFlag == 1)
|
|
|
+ }
|
|
|
return this.activeList.filter(item => item.stackFlag == 1)
|
|
|
},
|
|
|
// 非叠加活动
|
|
|
noStackActiveList () {
|
|
|
+ if (this.salesBillDetailSnList.length) {
|
|
|
+ return this.activeList.filter(item => item.promotionRule && item.promotionRule.stackFlag == 0)
|
|
|
+ }
|
|
|
return this.activeList.filter(item => item.stackFlag == 0)
|
|
|
}
|
|
|
},
|
|
@@ -136,7 +148,7 @@ export default {
|
|
|
this.upActiveValArr = resultSnArr
|
|
|
}
|
|
|
} else {
|
|
|
- this.upActiveVal = '-1'
|
|
|
+ this.upActiveVal = this.pageType ? '-1' : null
|
|
|
}
|
|
|
this.spinning = false
|
|
|
})
|
|
@@ -148,8 +160,8 @@ export default {
|
|
|
},
|
|
|
// 保存
|
|
|
handleSubmit (e) {
|
|
|
- e.preventDefault()
|
|
|
const _this = this
|
|
|
+ console.log(_this.upActiveVal, this.upActiveValArr.length)
|
|
|
if (_this.upActiveVal || this.upActiveValArr.length) {
|
|
|
let salesPromoSnList = []
|
|
|
// 不参与
|
|
@@ -164,11 +176,42 @@ export default {
|
|
|
_this.$message.info('请选择活动规则!')
|
|
|
}
|
|
|
},
|
|
|
+ // 批量操作
|
|
|
+ handleBatchSubmit (e) {
|
|
|
+ const _this = this
|
|
|
+ // 选中规则
|
|
|
+ if (_this.ruleType == 0) {
|
|
|
+ if (_this.upActiveVal || this.upActiveValArr.length) {
|
|
|
+ let salesPromoSnList = []
|
|
|
+ // 不参与
|
|
|
+ if (this.upActiveVal == '-1') {
|
|
|
+ salesPromoSnList = []
|
|
|
+ } else {
|
|
|
+ salesPromoSnList = this.upActiveVal ? [this.upActiveVal] : this.upActiveValArr
|
|
|
+ }
|
|
|
+ _this.confirmLoading = true
|
|
|
+ _this.$emit('batchOk', { salesPromoSnList, salesBillDetailSnList: this.productType == 0 ? this.salesBillDetailSnList : undefined })
|
|
|
+ } else {
|
|
|
+ _this.$message.info('请选择活动规则!')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 全部规则
|
|
|
+ _this.confirmLoading = true
|
|
|
+ const salesPromoSnList = this.activeList.map(item => item.salesPromoSn)
|
|
|
+ _this.$emit('batchOk', { salesPromoSnList, salesBillDetailSnList: this.productType == 0 ? this.salesBillDetailSnList : undefined })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetData () {
|
|
|
+ this.upActiveVal = null
|
|
|
+ this.upActiveValArr = []
|
|
|
+ this.salesBillDetailSnList = []
|
|
|
+ this.productType = '0'
|
|
|
+ this.ruleType = '0'
|
|
|
+ },
|
|
|
cancel () {
|
|
|
if (!this.confirmLoading) {
|
|
|
this.opened = false
|
|
|
- this.upActiveVal = null
|
|
|
- this.upActiveValArr = []
|
|
|
+ this.resetData()
|
|
|
this.$emit('cancel')
|
|
|
} else {
|
|
|
this.$message.info('正在更换促销,请勿关闭!')
|