Commit 9bfb050b by crushh

Merge branch 'feature/3月迭代' into dev

parents 0edce7ae 8143305d
......@@ -15,7 +15,7 @@
<el-date-picker value-format="timestamp" format="MM-dd" v-model="form.birthDate1" @change="handleDateChange" @blur="minTime = maxTime = null" :picker-options="pickerOptions" type="daterange" placeholder="请选择生日范围" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
</el-form-item>
<el-form-item label="生日范围" prop="birthDate2" v-if="form.birth_type == 2">
<el-date-picker type="monthrange" value-format="timestamp" format="MM月" v-model="form.birthDate2" @change="handleDateMonthChange" @blur="minTimeMonth = maxTimeMonth = null" :picker-options="pickerOptionsMonth" placeholder="请选择生日范围" range-separator="~" start-placeholder="开始月份" end-placeholder="结束月份"> </el-date-picker>
<el-date-picker type="monthrange" value-format="timestamp" format="MM月" v-model="form.birthDate2" @change="handleDateMonthChange" @blur="handleMonthBlur" :picker-options="pickerOptionsMonth" placeholder="请选择生日范围" range-separator="~" start-placeholder="开始月份" end-placeholder="结束月份"> </el-date-picker>
</el-form-item>
<el-form-item label="外呼时段" required>
<el-radio v-model="form.callFlag" :label="0">默认时段</el-radio>
......@@ -101,25 +101,20 @@ export default {
},
pickerOptionsMonth: {
onPick(time) {
console.log(time);
// 起始时间:仅半年范围内 && 结束时间:跨度最多3个月,即所选起始时间往后+90天为上限;
if (!time.maxDate) {
const maxRange = new Date().getMonth() + 5;
const selectRange = new Date(time.minDate).getMonth() + 2;
console.log(new Date(time.minDate).getMonth());
console.log(new Date().getMonth());
// minTimeMonth = new Date(time.minDate).getMonth() - new Date().getMonth() >= 3 ? new Date(time.minDate).getMonth() - 1 : new Date().getMonth() + 1;
minTimeMonth = new Date(time.minDate).getMonth() - new Date().getMonth() >= 3 ? new Date(time.minDate).getMonth() - 1 : new Date().getMonth();
maxTimeMonth = maxRange - selectRange > 0 ? (maxRange - selectRange >= 3 ? selectRange : maxRange - selectRange) : maxRange;
const maxRange = new Date().getMonth() + 6;
const selectRange = new Date(time.minDate).getMonth() + 3;
minTimeMonth = new Date(time.minDate).getMonth() - new Date().getMonth() >= 3 ? new Date(time.minDate).getMonth() - 1 : new Date().getMonth() + 1;
maxTimeMonth = maxRange - selectRange > 0 ? selectRange : maxRange;
}
},
disabledDate: time => {
let month = new Date(time).getMonth();
let month = new Date(time).getMonth() + 1;
if (minTimeMonth && maxTimeMonth) {
return month < minTimeMonth || month > maxTimeMonth || new Date(time).getFullYear() != new Date().getFullYear();
} else {
return month < new Date().getMonth() || month > new Date().getMonth() + 5 || new Date(time).getFullYear() != new Date().getFullYear();
return month < new Date().getMonth() + 1 || month > new Date().getMonth() + 6 || new Date(time).getFullYear() != new Date().getFullYear();
}
}
},
......@@ -138,6 +133,10 @@ export default {
if (val) {
this.form = JSON.parse(JSON.stringify(val));
}
},
form(val) {
console.log(val);
this.$emit('change', val);
}
},
computed: {
......@@ -206,6 +205,10 @@ export default {
});
});
},
handleMonthBlur() {
minTimeMonth = maxTimeMonth = null;
console.log(minTimeMonth, maxTimeMonth);
},
hanldeBirthDaysChange(val) {
if (this.form.birthDate1) {
if (this.currentTime + val * 24 * 60 * 60 * 1000 > this.form.birthDate1[0]) {
......
......@@ -5,6 +5,8 @@
<div class="section">
<el-form-item label="活动场景">
{{ form.scene | sceneFilter }}
<el-button type="text" @click="openTutorial" v-if="form.scene == 3">操作教程</el-button>
</el-form-item>
<el-form-item label="活动名称" prop="activityName">
<el-input class="w340" :maxlength="30" placeholder="请输入活动名称" show-word-limit v-model="form.activityName"></el-input>
......@@ -575,11 +577,9 @@ export default {
async submit() {
const activeTimeData = await this.$refs[`activeTime${[1, 2].includes(this.form.scene) ? this.form.scene : ''}`].submit();
if (!activeTimeData) return;
console.log(activeTimeData);
const { startDate, endDate, callFlag, callTime, birth_type, birth_days, holiday_date, holiday_type, holiday_name } = activeTimeData;
if (new Date(startDate).getMonth() + 1 == new Date().getMonth() + 1 && new Date(startDate).getDate() == new Date().getDate()) {
if (new Date(startDate).getFullYear() == new Date().getFullYear() && new Date(startDate).getMonth() + 1 == new Date().getMonth() + 1 && new Date(startDate).getDate() == new Date().getDate()) {
if (new Date().getHours() >= 16) {
this.$message.error('16:00之后不支持创建当天生效的活动');
return;
......@@ -587,7 +587,6 @@ export default {
if (callFlag == 1) {
let arr = callTime.map(item => item.split('-')[1]);
let endTime = arr.reduce((p, v) => (p < v ? v : p));
console.log(new Date(new Date().toLocaleDateString() + ' ' + endTime).getTime());
if (new Date(new Date().toLocaleDateString() + ' ' + endTime).getTime() < new Date().getTime()) {
this.$message.error('外呼时段的结束时间早于当前时间,今日营销人群无法执行外呼任务,请修改外呼时段');
return;
......@@ -690,7 +689,10 @@ export default {
}
});
},
async getMemberCount() {
async getMemberCount(val) {
// console.log(val);
// return;
const activeTimeData = await this.$refs[`activeTime${[1, 2].includes(this.form.scene) ? this.form.scene : ''}`].submit();
const { startDate, endDate, birth_type, birth_days, holiday_date, holiday_type, holiday_name } = activeTimeData;
const { scene, memberType } = this.form;
......@@ -733,6 +735,9 @@ export default {
const { result } = await getMemberCount(data);
this.form.planMemberCount = result;
},
openTutorial() {
window.open('https://www.yuque.com/exnmlu/hpbb1c/wnud7g');
},
handleLastconsume(val, type) {
if (this.filterFrontShow.find(item => this.hideIdVal.includes(item.esScreeningWidgetChainId))) {
this.form.consume_times_flag = 0;
......@@ -746,12 +751,10 @@ export default {
handleRuleFilterSave(id, data) {
this.memberCrowdWidgetId = id;
this.filterFrontShow = data ? JSON.parse(data.filterFrontShow) : [];
this.getMemberCount();
},
/**客户分组 */
confirmGroupDialog(arr, idStr) {
this.selectedGroupIds = idStr;
this.getMemberCount();
},
/** 根据客户意向发送挂机短信 */
delSmslist(index) {
......
......@@ -35,12 +35,11 @@
<dm-sub-title line>人群规则</dm-sub-title>
<div class="section">
<el-descriptions>
<el-descriptions-item label="参与人群">{{ form.memberType == 0 && !memberCrowdWidgetId ? '全部客户' : '' }} </el-descriptions-item>
<el-descriptions-item label="预计覆盖人数">{{ form.planMemberCount }}</el-descriptions-item>
</el-descriptions>
<el-descriptions-item label="参与人群" v-show="form.memberType == 0" />
<ruleFilter v-show="form.memberType == 0" :memberCrowdWidgetId="memberCrowdWidgetId" onlyRead style="width:100%" />
<el-descriptions-item label="参与人群" v-if="form.memberType == 1"> </el-descriptions-item>
<gic-new-member-group v-show="form.memberType == 1" :selectedIds="form.filterJson" onlyRead style="width:100%" />
<ruleFilter v-show="form.memberType == 0 && memberCrowdWidgetId" :memberCrowdWidgetId="memberCrowdWidgetId" onlyRead style="width:100%" />
<gic-new-member-group v-show="form.memberType == 1" :selectedIds="selectedGroupIds" onlyRead style="width:100%" />
</div>
<dm-sub-title line>外呼规则配置</dm-sub-title>
<div class="section">
......@@ -85,7 +84,10 @@
{{ item.optionsStr }}
</td>
<td class="cell" style="width:50%;">
<el-tag type="mini">{{ item.title }}</el-tag> <el-button type="text">查看短信内容</el-button>
<el-tag type="mini">{{ item.title }}</el-tag>
<el-popover placement="top-start" width="200" trigger="hover" :content="item.smsContent">
<el-button slot="reference" type="text">查看短信内容 </el-button>
</el-popover>
</td>
</tr>
</tbody>
......@@ -137,7 +139,7 @@ import ruleFilter from '@/components/dm-new-rule/ruleFilter.vue';
import gicNewMemberGroup from '@/components/dm-new-member-group/index.vue';
import filterAvater from '@/mixins/filterAvater.js';
import { formatDateTimeByType } from '@/utils/index.js';
import { getActivityDetail, aiDictList, templateList } from '@/service/api/aiApi.js';
import { getActivityDetail, aiDictList, templateList, getSmsTemplateEcho } from '@/service/api/aiApi.js';
export default {
mixins: [filterAvater],
data() {
......@@ -174,7 +176,7 @@ export default {
gradeObject: {}, //客户意向等级
unlinkObject: {}, // 未接通等级
templateObject: {}, //话术模板
selectedGroup: [], // 被选中的客户分组
selectedGroupIds: '', // 被选中的客户分组
memberCrowdWidgetId: '' // 规则筛选器id
};
},
......@@ -227,7 +229,7 @@ export default {
console.log(result);
if (!result) return;
const { activityId, activityName, activityPlanList, analyseAmount, analyseDays, analyseFlag, startDate, endDate, scene } = result;
const { activityEventList, filterJson, memberTagGroupList, memberType, planId, planMemberCount, planName, sceneJson } = activityPlanList[0];
const { activityEventList, filterJson, memberType, planId, planMemberCount, planName, sceneJson } = activityPlanList[0];
const { aiEventId, aiTemplateId, callFlag, callTime, eventId, labelFlag, recallFlag, smsFlag, labelJson, recallJson, smsJson } = activityEventList[0];
const { birth_type, birth_days, holiday_type, holiday_name, holiday_date, consume_days_flag, consume_days, consume_times_flag, consume_times, consume_amount_flag, consume_amount } = JSON.parse(sceneJson);
this.form = {
......@@ -258,7 +260,7 @@ export default {
if (memberType == 0) {
this.memberCrowdWidgetId = filterJson;
} else if (memberType == 1) {
this.selectedGroup = memberTagGroupList;
this.selectedGroupIds = filterJson;
}
let startDateStr = formatDateTimeByType(startDate, 'yyyy-MM-dd');
let endDateStr = formatDateTimeByType(endDate, 'yyyy-MM-dd');
......@@ -295,7 +297,7 @@ export default {
} else {
// 加企微好友||客服复购||其他场景
this.activeTimeData = {
activeTime: [startDate, endDate].join(','), //有效时间
activeTime: [startDateStr, endDateStr].join(','), //有效时间
callFlag, //外呼时段 0 默认 1 自定义
callTime: JSON.parse(callTime).join(',') // 自定义时段
};
......@@ -312,13 +314,16 @@ export default {
}
if (smsFlag) {
this.smsList = JSON.parse(smsJson);
let ids = [];
this.smsList.forEach(item => {
let arr = [];
item.options.forEach(val => {
arr.push(this.gradeObject[val].dict_name);
});
ids.push(item.template);
item.optionsStr = arr.join(',');
});
this.getSmsTemplateEcho(ids);
}
if (recallFlag) {
this.recallList = JSON.parse(recallJson);
......@@ -358,6 +363,20 @@ export default {
this.templateObject[item.aiTemplateId] = item;
});
}
},
async getSmsTemplateEcho(ids) {
const { result } = await getSmsTemplateEcho({ id: ids.join(',') });
if (!result) return;
let obj = {};
result.length &&
result.forEach(item => {
obj[item.gicSmsTemplateId] = item;
});
this.smsList.forEach(item => {
if (obj[item.template]) {
item.smsContent = obj[item.template].smsContent;
}
});
}
}
};
......
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