Commit f427480c by crushh

udpate: bugfix

parent 382194fc
......@@ -570,4 +570,11 @@ img::after {
&:hover {
background: #f6e1e5;
}
}
.tips {
font-size: 12px;
font-weight: 400;
color: #909399;
line-height: 17px;
margin-left: 20px;
}
\ No newline at end of file
......@@ -56,6 +56,8 @@ export const getActivityInfo = params => requests('/api-marketing/statistics/get
// 获取短信模板内容
export const getSmsTemplateEcho = params => requests('/api-marketing/get-sms-template-echo', params, true, false, 'get');
// 是否可以新建
export const aiAccountCheck = params => requests('/api-marketing/ai/ai-account-check', params, true, false, 'get');
// 获取AI数据统计外呼数据
export const getOutBound = params => requests('/api-marketing/statistics/out-bound', params, true, false, 'get');
export const getIntentionLabel = params => requests('/api-marketing/statistics/intention-label', params, true, false, 'get');
......
......@@ -138,7 +138,6 @@ const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false,
.then(res => {
clearTimeout(_timer);
popRequest(_random);
if (res.data.errorCode !== 0 && res.data.code != 0) {
reject(res);
if (res.data.message.indexOf('抱歉') >= 0) {
......
......@@ -10,6 +10,7 @@
</el-form-item>
<el-form-item label="活动有效期" required>
<el-date-picker value-format="timestamp" format="yyyy-MM-dd" :picker-options="pickerOptions" @blur="minTime = maxTime = null" v-model="form.activeTime" @change="handleDateChange" type="daterange" placeholder="请选择生日范围" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
<span class="tips">由于外呼线路有限,为保证外呼触达率,建议外呼时间周期不小于5天</span>
</el-form-item>
</el-form>
</template>
......@@ -55,6 +56,10 @@ export default {
data: {
type: Object,
default: () => {}
},
scene: {
type: Number,
default: 0
}
},
watch: {
......
......@@ -20,7 +20,7 @@
<div class="section">
<birthSense ref="activeTime1" :data="birthTimeData" v-show="form.scene == 1" />
<holidaySense ref="activeTime2" :data="holidayTimeData" v-show="form.scene == 2" />
<activeTime ref="activeTime" :data="activeTimeData" v-show="form.scene == 3 || form.scene == 4 || form.scene == 0" />
<activeTime ref="activeTime" :data="activeTimeData" v-show="form.scene == 3 || form.scene == 4 || form.scene == 0" :scene="scene" />
</div>
<dm-sub-title line>人群规则<span class="tips">针对选择的客户仅会执行一次外呼任务。</span></dm-sub-title>
<div class="section">
......@@ -28,7 +28,7 @@
<el-radio v-model="form.memberType" :label="0">客户筛选</el-radio>
<el-radio v-model="form.memberType" :label="1">客户分组</el-radio>
<div>
<div class="tips" style="margin:0 0 12px 0; " v-if="form.memberType == 0">默认为权限范围内的全部客户</div>
<div class="tips" style="margin:0 0 12px 0; " v-if="form.memberType == 0">{{ this.form.sence == 3 ? '默认为全部未添加企微好友的客户' : '默认为权限范围内的全部客户' }}</div>
<el-button v-if="form.memberType == 0 && !memberCrowdWidgetId && form.scene != 4" size="small" @click="ruleVisible = true">添加其他条件</el-button>
<ruleFilter v-show="form.memberType == 0 && form.scene != 4" :visiable.sync="ruleVisible" @save="handleRuleFilterSave" :memberCrowdWidgetId="memberCrowdWidgetId" />
<el-button v-if="form.memberType == 1 && !selectedGroupIds" size="small" @click="groupVisible = true">添加分组</el-button>
......@@ -488,7 +488,7 @@ export default {
labelFlag, //是否根据客户意向打标签
smsFlag, //是否根据客户意向发送挂机短信
recallFlag, //是否根据未接通状态设置重拨
planMemberCount, //覆盖人数
planMemberCount: this.isCopy ? 0 : planMemberCount, //覆盖人数
analyseDays, //分析天数
analyseAmount, //销售额
planId,
......@@ -578,9 +578,21 @@ export default {
console.log(activeTimeData);
const { startDate, endDate, callFlag, callTime, birth_type, birth_days, holiday_date, holiday_type, holiday_name } = activeTimeData;
if (new Date().getHours() >= 15 && new Date(startDate).getMonth() + 1 == new Date().getMonth() + 1 && new Date(startDate).getDate() == new Date().getDate()) {
this.$message.error('16:00之后不支持创建当天生效的活动');
return;
if (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;
}
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;
}
}
}
this.$refs.form.validate(async (val, obj) => {
console.log(val, obj);
......@@ -836,13 +848,6 @@ export default {
.content {
margin: 10px 20px;
}
.tips {
font-size: 12px;
font-weight: 400;
color: #909399;
line-height: 17px;
margin-left: 20px;
}
.bold {
font-size: 14px;
font-weight: bold;
......
......@@ -202,7 +202,7 @@ export default {
}
},
methods: {
async getActivityDetail(activityId) {
async getActivityDetail(id) {
this.loading = true;
const res1 = await aiDictList({ dictType: 'ai_member_label' });
const res2 = await aiDictList({ dictType: 'ai_recall_status' });
......@@ -222,10 +222,11 @@ export default {
this.templateObject[item.aiTemplateId] = item;
});
}
const { result } = await getActivityDetail({ activityId });
console.log(result);
if (result) {
let { activityId, activityName, activityPlanList, analyseAmount, analyseDays, analyseFlag, startDate, endDate, scene } = result;
try {
const { result } = await getActivityDetail({ activityId: id });
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 { 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);
......@@ -259,19 +260,19 @@ export default {
} else if (memberType == 1) {
this.selectedGroup = memberTagGroupList;
}
startDate = formatDateTimeByType(startDate, 'yyyy-MM-dd');
endDate = formatDateTimeByType(endDate, 'yyyy-MM-dd');
let startDateStr = formatDateTimeByType(startDate, 'yyyy-MM-dd');
let endDateStr = formatDateTimeByType(endDate, 'yyyy-MM-dd');
if (scene == 1) {
// 不同场景的活动时间回显
if (birth_type == 2) {
startDate = formatDateTimeByType(startDate, 'yyyy-MM');
endDate = formatDateTimeByType(endDate, 'yyyy-MM');
startDateStr = formatDateTimeByType(startDate, 'yyyy-MM');
endDateStr = formatDateTimeByType(endDate, 'yyyy-MM');
}
this.birthTimeData = {
//客户生日
birth_days, // 生日前xx天
birthDate1: [startDate, endDate].join(','), //生日范围 当天
birthDate2: [startDate, endDate].join(','), //生日范围 当月
birthDate1: [startDateStr, endDateStr].join(','), //生日范围 当天
birthDate2: [startDateStr, endDateStr].join(','), //生日范围 当月
birth_type, //外呼时间 1当天 2当月 3生日前
callFlag, //外呼时段 0 默认 1 自定义
callTime: JSON.parse(callTime).join(',') // 自定义时段
......@@ -285,9 +286,12 @@ export default {
holiday_day: '', // 节日时间
callFlag, //外呼时段 0 默认 1 自定义
callTime: JSON.parse(callTime).join(','), // 自定义时段
startDate, //有效时间
endDate //有效时间
startDate: startDateStr, //有效时间
endDate: endDateStr //有效时间
};
console.log(new Date(`${holiday_date} 00:00:00`).getTime());
console.log(startDate);
this.holidayTimeData.holiday_day = (new Date(`${holiday_date} 00:00:00`).getTime() - startDate) / 86400000;
} else {
// 加企微好友||客服复购||其他场景
this.activeTimeData = {
......@@ -326,8 +330,9 @@ export default {
item.optionsStr = arr.join(',');
});
}
} finally {
this.loading = false;
}
this.loading = false;
},
async getAiDictList(dictType) {
// 营销场景=marketing_activity_scene ,客户意向等级=ai_member_label , 重拨状态=ai_recall_status
......
<template>
<div class="contain">
<div class="contain" v-loding="loading">
<div class="cardList">
<div class="card" v-for="item in cardContent" :key="item.title">
<div class="cardTitle">
......@@ -9,7 +9,7 @@
<div class="cardBody">
{{ item.content }}
</div>
<el-button size="small" type="primary" @click="create(item)">立即新建</el-button>
<el-button size="small" type="primary" @click="create(item.scene)">立即新建</el-button>
</div>
</div>
<div class="account">
......@@ -35,7 +35,7 @@
</el-form-item>
</el-form>
</div>
<el-table :data="tableData" v-loading="loading" style="width:100%">
<el-table :data="tableData" style="width:100%">
<el-table-column prop="activityName" label="活动名称" show-overflow-tooltip />
<el-table-column prop="scene" label="活动场景" show-overflow-tooltip>
<template slot-scope="{ row }">
......@@ -89,7 +89,7 @@
</template>
<script>
import { page, rechargeCenter, stopActivityPlan, startActivityPlan, pageStatistics } from '@/service/api/aiApi.js';
import { page, rechargeCenter, stopActivityPlan, startActivityPlan, pageStatistics, aiAccountCheck } from '@/service/api/aiApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
import filterAvater from '@/mixins/filterAvater.js';
import dmDropdown from '@/components/dm-drop-down/dm-drop-down';
......@@ -153,7 +153,7 @@ export default {
limitCode: ''
},
handler: row => {
this.$router.push('/ai/copy/' + row.activityId);
this.create('', row.activityId);
}
},
{
......@@ -264,12 +264,14 @@ export default {
label: '欠费暂停'
}
],
money: 0 //是否开启多账户计费模式
money: 0,
disableCreate: 1
};
},
mounted() {
this.getTableData();
this.getRechargeCenter();
this.getAiAccountCheck();
},
components: {
dmDropdown
......@@ -317,9 +319,9 @@ export default {
}
},
methods: {
create({ scene }) {
if (this.money == 0) {
this.$confirm('当前账户已无可用余额,请充值后再创建外呼任务', '提示', {
create(scene, id) {
if (this.disableCreate) {
this.$confirm(`当前账户已无可用余额,请充值后再${id ? '复制' : '创建'}外呼任务`, '提示', {
confirmButtonText: '去充值',
cancelButtonText: '取消',
type: 'warning'
......@@ -327,9 +329,10 @@ export default {
this.recharge();
});
} else {
this.$router.push('/ai/add/' + scene);
id ? this.$router.push('/ai/copy/' + id) : this.$router.push('/ai/add/' + scene);
}
},
recharge() {
window.open(`${window.location.origin}/marketing/#/recharge/do`, '_blank');
},
......@@ -347,6 +350,11 @@ export default {
this.form.pageNum = 1;
this.getTableData();
},
async getAiAccountCheck() {
const { result } = await aiAccountCheck();
console.log(result);
this.disableCreate = result;
},
async getTableData() {
this.loading = true;
const params = Object.assign({}, this.form);
......@@ -355,31 +363,35 @@ export default {
params.endTime = params.time[1];
}
delete params.time;
const { result } = await page(params);
if (result) {
try {
const { result } = await page(params);
if (!result) return;
this.tableData = result.list || [];
const ids = this.tableData.map(item => item.activityId).join(',');
this.total = result.total;
console.log(this.tableData);
this.pageStatistics(ids);
} else {
} finally {
this.loading = false;
}
},
async pageStatistics(ids) {
const { result } = await pageStatistics({ ids }).finally(() => (this.loading = false));
const { result } = await pageStatistics({ ids });
if (!result) return;
let obj = {};
result.forEach(element => {
obj[element.activityId] = element;
});
this.tableData.forEach(item => {
if (obj[item.activityPlanStatus]) {
const { marketingNumber, outboundNumber, totalConnectionNumber, telephoneConnectionRate, connectionIntentionRate } = obj[item.activityPlanStatus];
item.marketingNumber = marketingNumber;
item.outboundNumber = outboundNumber;
item.totalConnectionNumber = totalConnectionNumber;
item.telephoneConnectionRate = telephoneConnectionRate;
item.connectionIntentionRate = connectionIntentionRate;
}
});
if (result) {
result.forEach(element => {
let obj = this.tableData.find(item => item.activityId == element.activityId);
const { marketingNumber, outboundNumber, totalConnectionNumber, telephoneConnectionRate, connectionIntentionRate } = element;
obj.marketingNumber = marketingNumber;
obj.outboundNumber = outboundNumber;
obj.totalConnectionNumber = totalConnectionNumber;
obj.telephoneConnectionRate = telephoneConnectionRate;
obj.connectionIntentionRate = connectionIntentionRate;
});
}
this.tableData = this.tableData.splice(0);
},
stopTask(row) {
......
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