Commit 084ced0a by caoyanzhi

update: ai营销-数据统计

parent b0da70ed
......@@ -368,3 +368,18 @@ export const getTimesByReq = (str, type = 1) => {
}
return d.getTime();
};
/**
* @description 给数字添加千位分隔符
* @param {Number} num 需要转换的数据
* @returns {String} 添加千位分隔符后的数字
*/
export const numFormat = function(num) {
if (typeof num != 'number') {
console.error('numFormat Arguments TypeError: Arguments type is not number');
return '--';
}
return num.toString().replace(/\d+/, n => {
// 先提取整数部分
return n.replace(/(\d)(?=(\d{3})+$)/g, '$1,');
});
};
......@@ -25,6 +25,7 @@
</template>
<script>
import { numFormat } from '@/utils/index.js';
import { getOutBound } from '@/service/api/aiApi.js';
import TargetGroup from './target-group.vue';
export default {
......@@ -40,81 +41,94 @@ export default {
return {
activityId: '',
planId: '',
// type number:数字、time:时间、amount:金额、rate:百分比
originTargetList: [
[
{
label: '营销人数',
tips: '根据每天外呼人数累加',
value: '',
key: 'marketingNumber'
key: 'marketingNumber',
type: 'number'
},
{
label: '已外呼数',
value: '',
key: 'outboundNumber'
key: 'outboundNumber',
type: 'number'
}
],
[
{
label: '总接通数',
value: '',
key: 'totalConnectionNumber'
key: 'totalConnectionNumber',
type: 'number'
},
{
label: '电话接通率',
tips: '电话接通率:表示任务中接通号码的占比<br/>计算公式为:接通的电话通数/已经外呼的电话通数',
value: '',
key: 'telephoneConnectionRate'
key: 'telephoneConnectionRate',
type: 'rate'
}
],
[
{
label: 'A/B类客户意向',
value: '',
key: 'customerIntentionsNumber'
key: 'customerIntentionsNumber',
type: 'number'
},
{
label: '接通意向率',
tips: '接通意向率:表示所有已接通的通话中意向客户占比,其中A类和B类客户为意向客户<br/>计算公式为:A/B类客户意向数/已接通的电话数',
value: '',
key: 'connectionIntentionRate'
key: 'connectionIntentionRate',
type: 'rate'
}
],
[
{
label: '总挂机数',
value: '',
key: 'totalHangUps'
key: 'totalHangUps',
type: 'number'
},
{
label: '挂机率',
tips: '挂机率表示接通后5s之内挂断的电话<br/>计算公式为:总挂机数/接通的电话通数',
value: '',
key: 'hangUpRate'
key: 'hangUpRate',
type: 'rate'
}
],
[
{
label: '短信发送总数',
value: '',
key: 'sentMessagesNumber'
key: 'sentMessagesNumber',
type: 'number'
},
{
label: '发送成功数',
value: '',
key: 'sentSuccessfullyNumber'
key: 'sentSuccessfullyNumber',
type: 'number'
}
],
[
{
label: '总通话时长',
value: '',
key: 'totalCallDuration'
key: 'totalCallDuration',
type: 'time'
},
{
label: '平均通话时长',
value: '',
key: 'averageCallDuration'
key: 'averageCallDuration',
type: 'time'
}
],
[
......@@ -123,7 +137,8 @@ export default {
tips: '不包含短信发送失败退回金额',
value: '',
unit: '元',
key: 'activityCost'
key: 'activityCost',
type: 'amount'
}
]
],
......@@ -135,9 +150,29 @@ export default {
return this.originTargetList
.map(el => {
return el.filter(item => {
const value = this.targetData[item.key];
switch (item.type) {
case 'number':
item.value = typeof value == 'number' ? numFormat(value) : '--';
break;
case 'time':
item.value = '--';
if (typeof value == 'number') {
const h = Math.floor(value / 3600);
const m = Math.floor((value % 3600) / 60);
const s = value % 60;
item.value = `${h}:${m}:${s}`;
}
break;
case 'amount':
item.value = typeof value == 'number' ? numFormat(value) : '--';
break;
case 'rate':
item.value = typeof value == 'string' ? value : '--';
break;
}
// 活动不发送挂机短信时,数据指标不展示短信发送总数的字段
// 活动未开启活动分析时,数据指标不展示活动费用
item.value = this.targetData[item.key] == null ? '--' : this.targetData[item.key];
return !((this.aiDataShow.analyseFlag == 0 && item.key == 'sentMessagesNumber') || (this.aiDataShow.smsFlag == 0 && item.key == 'activityCost'));
});
})
......@@ -152,21 +187,6 @@ export default {
methods: {
getOutBound() {
getOutBound({ activityId: this.activityId, planId: this.planId }).then(res => {
res.result = {
marketingNumber: 1,
outboundNumber: 2,
totalConnectionNumber: 3,
telephoneConnectionRate: 4,
customerIntentionsNumber: 5,
connectionIntentionRate: 6,
totalHangUps: 7,
hangUpRate: 8,
sentMessagesNumber: 9,
sentSuccessfullyNumber: 10,
totalCallDuration: 11,
averageCallDuration: 12,
activityCost: 13
};
this.targetData = res.result;
});
}
......
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