Commit 726029b9 by crushh

update: ecm事件限制

parent d2de62d8
......@@ -766,6 +766,12 @@ export default {
return;
}
}
// 时效为触点时:'图文', '文本', '小程序', '图片' 添加事件大于3条时无法创建;时效为重复,单次时:小程序 大于3无法创建
if (this.$refs.marketingEvent.hasEventOverTime()) {
let str = this.form.effectType == 0 ? '受微信客服接口1分钟内最多只支持3次调用影响,图文/文本/小程序/图片事件单次计划最多3条' : '受微信客服接口1分钟内最多只支持3次调用影响,小程序事件单次计划最多3条';
this.$message({ type: 'warning', message: str });
return;
}
if (this.form.effectType == 2) {
// 单次
......
......@@ -384,8 +384,6 @@ export default {
});
let arr = this.delList.map(item => item.ecmMarketingTypeRelationId);
this.list = this.list.filter(item => !arr.includes(item.item.ecmMarketingTypeRelationId));
console.log(this.list);
console.log(this.list.map(item => item.comName));
this.hasReturnCard();
}
});
......@@ -497,10 +495,21 @@ export default {
this.$message({ type: 'warning', message: `最多只能添加${this.maxEventCount}个营销事件` });
return;
}
if (this.isOverThreeTime(v)) {
this.$message({ type: 'warning', message: `受微信客服接口1分钟内最多只支持3次调用影响,图文/文本/小程序/图片事件单次计划最多3条` });
return;
console.log(this.effectType);
if (this.effectType == 0) {
let arr = ['图文', '文本', '小程序', '图片'];
if (this.isOverThreeTime(v, arr)) {
this.$message({ type: 'warning', message: `受微信客服接口1分钟内最多只支持3次调用影响,图文/文本/小程序/图片事件单次计划最多3条` });
return;
}
} else {
let arr = ['小程序'];
if (this.isOverThreeTime(v, arr)) {
this.$message({ type: 'warning', message: `受微信客服接口1分钟内最多只支持3次调用影响,小程序事件单次计划最多3条` });
return;
}
}
// if (v.value === 'grade' && this.list.some(item => item.comName === 'item-grade')) {
// this.$message({ type: 'warning', message: `已添加会员卡升级营销事件` });
// return;
......@@ -607,8 +616,7 @@ export default {
return this.list.length >= this.maxEventCount;
},
// 营销事件为“图文/文本/小程序/图片时,添加内容大于3条时无法创建
isOverThreeTime(v) {
let arr = ['图文', '文本', '小程序', '图片'];
isOverThreeTime(v, arr) {
let i = 0;
this.list.forEach(item => {
if (arr.includes(item.name)) {
......@@ -620,6 +628,7 @@ export default {
}
return false;
},
//判断营销列表里是否有短信 提供给父级使用
hasMessageInList() {
return this.list.some(v => v.comName === 'item-message' && v.item.type === 1);
......@@ -628,6 +637,36 @@ export default {
hasIntegralMultiple() {
return this.list.some(v => v.comName === 'item-integral' && v.item.integralType === 2);
},
// 时效为触点时:'图文', '文本', '小程序', '图片' 添加事件大于3条时无法创建;时效为重复,单次时:小程序 大于3无法创建
hasEventOverTime() {
let obj = {};
this.list.forEach(item => {
if (obj[item.name]) {
obj[item.name] = ++obj[item.name];
} else {
obj[item.name] = 1;
}
});
if (this.effectType == 0) {
let arr = ['图文', '文本', '小程序', '图片'];
let i = 0;
arr.forEach(key => {
if (obj[key]) {
i = obj[key] + i;
}
});
return i > 3;
} else {
let arr = ['小程序'];
let i = 0;
arr.forEach(key => {
if (obj[key]) {
i = obj[key] + i;
}
});
return i > 3;
}
},
//判断营销列表里是否有卡券 提供给父级使用
hasReturnCard() {
let item = {};
......
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