Commit 1c649d65 by crushh

update: 消费触发配置

parent df486de2
......@@ -87,7 +87,8 @@ export default {
order_store_new: '',
storedLowest: 0,
storedMax: 0,
consum_type: 1
consum_type: 1,
gift_flag: 0
},
template: {
headerColor: '#173177',
......@@ -463,6 +464,8 @@ export default {
});
// 处理消费触发
if (consumTrigger) {
// 消费触发配置 单笔触发,当天累计实付触发
this.form.consum_type = consumTrigger.consum_type;
// 触发门店初始化
this.consumeChecked.store = Boolean(consumTrigger.store_mode) || false; /** 门店类型: 0: 所有门店, 1: 部分(包含部分门店, 部分分组等) **/
this.form.consumerStoreType = result.consumerStoreType || 0; /** 消费门店类型 **/
......@@ -484,6 +487,7 @@ export default {
this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
}
this.form.gift_flag = consumTrigger.gift_flag;
}
// 处理适用商品折扣
......@@ -753,39 +757,41 @@ export default {
this.$tips({ type: 'warning', message: '请填写消费金额区间值' });
return;
}
if (this.consumeChecked.cost && this.form.lowest_cost && this.form.max_cost && this.form.lowest_cost > this.form.max_cost) {
this.$tips({ type: 'warning', message: '消费金额区间值填写错误' });
return;
}
// 填一个就行
if (this.consumeChecked.count && !this.form.lowest_cost_count && !this.form.max_cost_count) {
this.$tips({ type: 'warning', message: '请填写消费件数区间值' });
return;
}
if (this.consumeChecked.count && this.form.lowest_cost_count && this.form.max_cost_count && this.form.lowest_cost_count > this.form.max_cost_count) {
this.$tips({ type: 'warning', message: '消费件数区间值填写错误' });
return;
}
if (this.form.lowest_cost_count && !/^\d+$/.test(this.form.lowest_cost_count)) {
this.$tips({ type: 'warning', message: '消费件数为正整数' });
return;
}
if (this.form.max_cost_count && !/^\d+$/.test(this.form.max_cost_count)) {
this.$tips({ type: 'warning', message: '消费件数为正整数' });
return;
}
if (this.discount_limit.flag && this.discount_limit.type == 6 && (isNaN(this.discount_limit.count) || isNaN(this.discount_limit.count2))) {
this.$tips({ type: 'warning', message: '适用商品折扣区间未填写完整' });
return;
}
// 验证适用商品折扣 discount_limit
if (this.discount_limit.flag && isNaN(this.discount_limit.count)) {
this.$tips({ type: 'warning', message: '适用商品折扣额度未填写' });
return;
}
if (this.consumeChecked.payment && !this.checkList.length) {
this.$tips({ type: 'warning', message: '请至少选择一种支付方式' });
return;
if (this.form.consum_type == 1) {
if (this.consumeChecked.cost && this.form.lowest_cost && this.form.max_cost && this.form.lowest_cost > this.form.max_cost) {
this.$tips({ type: 'warning', message: '消费金额区间值填写错误' });
return;
}
// 填一个就行
if (this.consumeChecked.count && !this.form.lowest_cost_count && !this.form.max_cost_count) {
this.$tips({ type: 'warning', message: '请填写消费件数区间值' });
return;
}
if (this.consumeChecked.count && this.form.lowest_cost_count && this.form.max_cost_count && this.form.lowest_cost_count > this.form.max_cost_count) {
this.$tips({ type: 'warning', message: '消费件数区间值填写错误' });
return;
}
if (this.form.lowest_cost_count && !/^\d+$/.test(this.form.lowest_cost_count)) {
this.$tips({ type: 'warning', message: '消费件数为正整数' });
return;
}
if (this.form.max_cost_count && !/^\d+$/.test(this.form.max_cost_count)) {
this.$tips({ type: 'warning', message: '消费件数为正整数' });
return;
}
if (this.discount_limit.flag && this.discount_limit.type == 6 && (isNaN(this.discount_limit.count) || isNaN(this.discount_limit.count2))) {
this.$tips({ type: 'warning', message: '适用商品折扣区间未填写完整' });
return;
}
// 验证适用商品折扣 discount_limit
if (this.discount_limit.flag && isNaN(this.discount_limit.count)) {
this.$tips({ type: 'warning', message: '适用商品折扣额度未填写' });
return;
}
if (this.consumeChecked.payment && !this.checkList.length) {
this.$tips({ type: 'warning', message: '请至少选择一种支付方式' });
return;
}
}
}
// 如果是储值触发
......@@ -878,14 +884,16 @@ export default {
}
// 如果是消费触发数据处理 - 保存
// 全部则不传该字段
// 单笔订单触发 或 累计消费订单触发
if (this.form.effectType == 0) {
if (this.form.effectAction === 'consume') {
if (this.form.effectAction === 'consume' && this.form.consum_type == 1) {
// 门店
let consumeObj = {
store_mode: this.consumeChecked.store ? 1 : 0,
consumerStoreType: this.form.consumerStoreType,
order_store: this.consumeChecked.store ? (this.form.consumerStoreType === 0 ? this.form.order_store : this.form.order_store_new) : ''
};
consumeObj.consum_type = 1;
// 勾选消费金额 --不填代表没有上下限,不传该字段
if (this.consumeChecked.cost) {
if (this.form.lowest_cost) {
......@@ -927,6 +935,26 @@ export default {
} else {
params.gic_payment_flag = 0;
}
// 消费
params = Object.assign(params, consumeObj); // 合并消费触发数据
} else if (this.form.effectAction === 'consume' && this.form.consum_type == 2) {
// 门店
let consumeObj = {
store_mode: this.consumeChecked.store ? 1 : 0,
consumerStoreType: this.form.consumerStoreType,
order_store: this.consumeChecked.store ? (this.form.consumerStoreType === 0 ? this.form.order_store : this.form.order_store_new) : ''
};
consumeObj.consum_type = 2;
consumeObj['lowest_cost'] = this.form.lowest_cost;
// 勾选消费商品
if (this.consumeChecked.good && this.xxSysp.goodsFilterId) {
consumeObj.goods_filter_id = this.xxSysp.goodsFilterId;
consumeObj.goodsSearchDetail = JSON.stringify({
conditionList: this.isEdit ? this.xxSysp.conditionList_copy : this.xxSysp.conditionList, // 编辑保存备份数据
filterAbbrInfo: this.xxSysp.filterAbbrInfo
});
consumeObj.gift_flag = this.form.gift_flag;
}
params = Object.assign(params, consumeObj); // 合并消费触发数据
}
if (this.form.effectAction === 'stored' && this.storedChecked) {
......@@ -1059,6 +1087,9 @@ export default {
// console.log(this.gradeList )
});
}
if (!isInit) {
this.form.consum_type = 1;
}
},
// 消费触发
handleLowestCost() {
......@@ -1092,6 +1123,18 @@ export default {
},
/* ----------------辅助方法--------------- */
// 消费金额触发修改
handleConsumTypeChange(val) {
if (val == 1) {
this.form.marketingTimesType = 0;
this.form.expireType = 0;
} else if (val == 2) {
this.form.marketingTimesType = 1;
this.form.expireType = 1;
this.consumeChecked.cost = true;
}
// this.form.lowest_cost = '';
},
// 对比开始时间结束时间
checkBeginEndTime() {
let beginDate = this.form.beginDate && new Date(this.form.beginDate);
......
......@@ -108,11 +108,11 @@
<p class="fz14 gray mb20 ml10">同时满足以下条件即可触发</p>
<div class="ecm-title">消费触发配置</div>
<div class="ecm-content">
<el-radio :label="1" v-model="form.consum_type" @change="form.marketingTimesType = 0"
<el-radio :label="1" :disabled="!isAdd" v-model="form.consum_type" @change="handleConsumTypeChange"
>按照单笔订金实付金额触发
<span class="gray fz13 ml58"> 仅适用于线下单笔消费;仅限对当天线下的单笔购买消费订单进行触发;重导订单、非购买订单均不触发</span>
</el-radio>
<el-radio :label="2" style="margin-left:0" v-model="form.consum_type" @change="form.marketingTimesType = 1"
<el-radio :label="2" :disabled="!isAdd" style="margin-left:0" v-model="form.consum_type" @change="handleConsumTypeChange"
>按照当天累计订单实付金额触发
<span class="gray fz13 ml58">仅适用于线下当天累计消费,请保证订单实时同步;重导订单、非购买订单均不触发</span>
</el-radio>
......@@ -177,9 +177,9 @@
<el-button type="primary" @click="handleXxSyspClick" class="fl mt5" size="mini">{{ !isAdd ? '查看' : '编辑' }}</el-button>
<el-button v-show="xxSysp.filterAbbrInfo.length && isAdd" @click="handleXxSyspReset" class="fl mt5" size="mini">清空</el-button>
</div>
<div v-show="consumeChecked.good">
<div v-show="consumeChecked.good && form.consum_type == 2">
<span style="margin-left: 38px;">赠品是否支持触发</span>
<el-radio-group v-model="form.gift_flag">
<el-radio-group :disabled="!isAdd" v-model="form.gift_flag">
<el-radio :label="1" style="width: auto;">支持</el-radio>
<el-radio :label="0" style="width: auto;">不支持</el-radio>
</el-radio-group>
......@@ -344,8 +344,8 @@
<el-form-item label="营销次数配置" prop="marketingTimesType" v-else>
<div class="ecm-content" style="margin:8px 0 0 0;">
<el-radio :label="1" v-model="form.marketingTimesType">每天触发一次 <span class="gray fz13 ml58">客户当天累计消费金额满足所配置的消费金额就会触发,只触发一次</span></el-radio>
<el-radio style="margin-left:0" :label="-1" v-model="form.marketingTimesType">每天叠加触发 <span class="gray fz13 ml58">客户当天累计消费金额每满足所配置的消费金额就会触发,不限制次数。(例如消费金额为2000触发,则客户当天累计消费金额达2000会触发一次,达到4000还会触发一次)</span></el-radio>
<el-radio :disabled="!isAdd" :label="1" v-model="form.marketingTimesType">每天触发一次 <span class="gray fz13 ml58">客户当天累计消费金额满足所配置的消费金额就会触发,只触发一次</span></el-radio>
<el-radio :disabled="!isAdd" style="margin-left:0" :label="-1" v-model="form.marketingTimesType">每天叠加触发 <span class="gray fz13 ml58">客户当天累计消费金额每满足所配置的消费金额就会触发,不限制次数。(例如消费金额为2000触发,则客户当天累计消费金额达2000会触发一次,达到4000还会触发一次)</span></el-radio>
</div>
</el-form-item>
</section>
......@@ -353,12 +353,16 @@
<!-- 有效时间 -->
<section class="dm-form__wrap" v-if="form.effectType == 0 || form.effectType == 1">
<h3 class="dm-title__label">有效时间</h3>
<el-form-item label="有效时间" prop="endDate" :show-message="showMessage">
<el-form-item label="有效时间" prop="endDate" :show-message="showMessage" v-if="form.consum_type == 1">
<el-radio :disabled="isEdit && onlineStatus != 0 && form.expireType == 1" v-model="form.expireType" :label="0">长期有效</el-radio>
<el-radio :disabled="isEdit && onlineStatus != 0 && form.expireType == 0" v-model="form.expireType" :label="1">固定期限</el-radio>
<el-date-picker class="ml10" v-if="form.expireType" v-model="form.beginDate" :disabled="isEdit && onlineStatus != 0" type="datetime" placeholder="开始时间" @change="checkBeginEndTime"> </el-date-picker>
<el-date-picker v-if="form.expireType" v-model="form.endDate" :disabled="isEdit && onlineStatus == 2" type="datetime" :picker-options="endDatePickerOptions" placeholder="结束时间" @change="checkBeginEndTime"> </el-date-picker>
</el-form-item>
<el-form-item label="固定期限" prop="endDate" :show-message="showMessage" v-else>
<el-date-picker class="ml10" v-model="form.beginDate" :disabled="isEdit && onlineStatus != 0" type="datetime" placeholder="开始时间" @change="checkBeginEndTime"> </el-date-picker>
<el-date-picker v-model="form.endDate" :disabled="isEdit && onlineStatus == 2" type="datetime" :picker-options="endDatePickerOptions" placeholder="结束时间" @change="checkBeginEndTime"> </el-date-picker>
</el-form-item>
</section>
<!-- 人群筛选器 -->
<section class="dm-form__wrap">
......@@ -414,7 +418,7 @@
</div>
</h3>
<!-- 只有实时才是单图文 -->
<marketing-event :effectType="form.effectType" :readOnly="isInfo || onlineStatus == 2" :show-delete-tooltip="isEdit && analyseConfig.open_flag == 1" show-out-coupon-icon ref="marketingEvent" @has-card="hasCard" v-if="ecmPlanId" :singleFlag="form.effectType === 0" :integralMultiple="form.effectAction === 'consume'" :ecmPlanId="ecmPlanId" :isSupportVar="form.effectType === 0" :code="code" :enabledMessageState="enabledMessageState" :cardLimitType="-1" :use-stored="useStoredFlag && ['consume', 'stored'].includes(form.effectAction) && form.effectType == 0 && form.consum_type == 1" :use-qfxx="form.effectType !== 0" :totalConsume="form.effectType == 0 && form.consum_type == 2"> </marketing-event>
<marketing-event :effectType="form.effectType" :readOnly="isInfo || onlineStatus == 2" :show-delete-tooltip="isEdit && analyseConfig.open_flag == 1" show-out-coupon-icon ref="marketingEvent" @has-card="hasCard" v-if="ecmPlanId" :singleFlag="form.effectType === 0" :integralMultiple="form.effectAction === 'consume'" :ecmPlanId="ecmPlanId" :isSupportVar="form.effectType === 0" :code="code" :enabledMessageState="enabledMessageState" :cardLimitType="-1" :use-stored="useStoredFlag && ['consume', 'stored'].includes(form.effectAction) && form.effectType == 0 && form.consum_type == 1" :use-qfxx="form.effectType !== 0" :consumType="form.consum_type"> </marketing-event>
<!-- 只有非实时&&选择卡券了展示提示 -->
<div v-if="currentCard.comName && form.effectType != 0 && couponAutoGetFlag" class="fz13 regular-font-color line-height2" style="margin-left:120px;margin-top:30px;">
* 用户在领取卡券后需要<b class="bold">同步至ERP</b>,如果关闭用户<b class="bold">手动领取</b>,卡券在<b class="bold">批量投放</b>时会需要将卡券信息批量同步至ERP。 <br />
......@@ -743,7 +747,7 @@ export default ecmForm;
margin-right: 4px;
}
.ecm-title {
margin-left: 20px;
margin-left: 24px;
// display: inline;
}
.ecm-content {
......@@ -751,6 +755,6 @@ export default ecmForm;
flex-wrap: wrap;
width: 200px;
gap: 20px;
margin: 20px;
margin: 20px 20px 20px 24px;
}
</style>
......@@ -159,7 +159,7 @@ export default {
},
useQfxx: Boolean,
showDeleteTooltip: Boolean,
totalConsume: Boolean // 是否是累计消费触发
consumType: 1 // 1 单笔订单金额触发,2 累计订单金额触发
},
data() {
return {
......@@ -184,7 +184,7 @@ export default {
},
computed: {
showOptionList() {
if (this.totalConsume) {
if (this.consumType == 2 && this.effectType == 0) {
const arr = ['card', 'integral'];
this.options.forEach(item => {
if (arr.includes(item.value)) {
......@@ -237,9 +237,6 @@ export default {
}
});
}
console.log(this.totalConsume);
console.log(this.options.filter(item => item.show == true));
return this.options.filter(item => item.show == true);
}
},
......@@ -248,7 +245,6 @@ export default {
// 触点切换成单次或重复,清空已选择的图文;
// 单次和重复间切换时,不需要清空操作;
// 单次切换触点或者重复切换触点,清空已选择的图文;
// 0:触点 1:重复 2:单次
if (oldType == 0 || newType == 0) {
this.list.forEach(el => {
......@@ -267,6 +263,14 @@ export default {
});
}
},
consumType(val) {
console.log('-------consumType');
console.log(val);
this.list.forEach(el => {
this.delItem(el);
});
},
// useStored: {
// handler() {
// console.log('useStored');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment