feat(api): 添加获取平均通话时长和有效通话时长的接口

添加了获取平均通话时长的接口 getAvgCallTime 和获取有效通话时长的接口 getGroupCallDuration
更新了相关视图组件以使用新接口数据
This commit is contained in:
2025-08-27 15:35:54 +08:00
parent ecf63b74cb
commit 152f5c2b4a
5 changed files with 34 additions and 10 deletions

View File

@@ -73,6 +73,9 @@ export const getSalesFunnel = (params) => {
export const getGoldContactTime = (params) => { export const getGoldContactTime = (params) => {
return https.post('/api/v1/sales/get_gold_contact_time', params) return https.post('/api/v1/sales/get_gold_contact_time', params)
} }
// 平均通话时长 /api/v1/sales/get_avg_call_time
export const getAvgCallTime = (params) => {
return https.post('/api/v1/sales/get_avg_call_time', params)
}

View File

@@ -40,8 +40,10 @@ export const getGroupRanking = (params) => {
export const getGroupDetail = (params) => { export const getGroupDetail = (params) => {
return https.post('/api/v1/manager/group_detail', params) return https.post('/api/v1/manager/group_detail', params)
} }
// 通话录音 /api/v1/sales/get_call_logs // 有效通话时长 /api/v1/manager/group_call_duration
export const getGroupCallDuration = (params) => {
return https.post('/api/v1/manager/group_call_duration', params)
}

View File

@@ -12,9 +12,9 @@
<div class="report-card"> <div class="report-card">
<div class="card-header"> <div class="card-header">
<span class="card-title">有效通话时长 <i class="info-icon" @mouseenter="showTooltip('callDuration', $event)" @mouseleave="hideTooltip"></i></span> <span class="card-title">有效通话时长 <i class="info-icon" @mouseenter="showTooltip('callDuration', $event)" @mouseleave="hideTooltip"></i></span>
<span class="card-trend negative">{{ weekTotalData.week_total_call?.team_data?.current_rate_last_current || '0%' }} vs 上期</span> <span class="card-trend negative">{{ weekTotalData.group_call_duration?.group_data?.current_rate_last_current || '0%' }} vs 上期</span>
</div> </div>
<div class="card-value">{{ formatDuration(weekTotalData.week_total_call?.team_data?.total_call_duration)||0 }} 小时</div> <div class="card-value">{{ formatDuration(weekTotalData.group_call_duration.group_data?.current_total_call_time_hour)||0 }} 小时</div>
</div> </div>
<div class="report-card"> <div class="report-card">
<div class="card-header"> <div class="card-header">
@@ -70,7 +70,8 @@ const props = defineProps({
week_add_customer_total: {}, week_add_customer_total: {},
week_add_deal_total: {}, week_add_deal_total: {},
week_add_fee_total: {}, week_add_fee_total: {},
pay_deposit_to_money_rate: {} pay_deposit_to_money_rate: {},
group_call_duration: {}
}) })
} }
}) })

View File

@@ -80,7 +80,8 @@ import RawDataCards from "../person/components/RawDataCards.vue";
import CustomerDetail from "../person/components/CustomerDetail.vue"; import CustomerDetail from "../person/components/CustomerDetail.vue";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import {getGroupAbnormalResponse, getWeekTotalCall, getWeekAddCustomerTotal, getWeekAddDealTotal, getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking } from "@/api/manager.js"; import {getGroupAbnormalResponse, getWeekTotalCall, getWeekAddCustomerTotal, getWeekAddDealTotal,
getWeekAddFeeTotal, getGroupFunnel,getPayDepositToMoneyRate,getGroupRanking, getGroupCallDuration} from "@/api/manager.js";
// 缓存系统 // 缓存系统
const cache = new Map() const cache = new Map()
@@ -189,7 +190,7 @@ const weekTotalData = ref({
week_add_fee_total: {}, week_add_fee_total: {},
pay_deposit_to_money_rate: {}, pay_deposit_to_money_rate: {},
group_funnel: {}, group_funnel: {},
week_add_fee_total: {}, group_call_duration: {},
}); });
// 团队异常预警 // 团队异常预警
const groupAbnormalResponse = ref({}) const groupAbnormalResponse = ref({})
@@ -248,6 +249,16 @@ async function TeamGetWeekTotalCall() {
weekTotalData.value.week_total_call = res.data weekTotalData.value.week_total_call = res.data
} }
} }
// 有效通话时长
async function TeamGetGroupCallDuration() {
const params = getRequestParams()
const hasParams = params.user_name
const res = await withCache('getGroupCallDuration', () => getGroupCallDuration(hasParams ? params : undefined), hasParams ? params : {})
console.log(res)
if (res.code === 200) {
weekTotalData.value.group_call_duration = res.data
}
}
// 新增客户 // 新增客户
async function TeamGetWeekAddCustomerTotal() { async function TeamGetWeekAddCustomerTotal() {
const params = getRequestParams() const params = getRequestParams()
@@ -381,6 +392,7 @@ async function forceRefreshAllData() {
await Promise.all([ await Promise.all([
TeamGetGroupAbnormalResponse(), TeamGetGroupAbnormalResponse(),
TeamGetWeekTotalCall(), TeamGetWeekTotalCall(),
TeamGetGroupCallDuration(),
TeamGetWeekAddCustomerTotal(), TeamGetWeekAddCustomerTotal(),
TeamGetWeekAddDealTotal(), TeamGetWeekAddDealTotal(),
TeamGetWeekAddFeeTotal(), TeamGetWeekAddFeeTotal(),
@@ -399,6 +411,7 @@ onMounted(async () => {
await TeamGetGroupAbnormalResponse() await TeamGetGroupAbnormalResponse()
await TeamGetWeekTotalCall() await TeamGetWeekTotalCall()
await TeamGetGroupCallDuration()
await TeamGetWeekAddCustomerTotal() await TeamGetWeekAddCustomerTotal()
await TeamGetWeekAddDealTotal() await TeamGetWeekAddDealTotal()
await TeamGetWeekAddFeeTotal() await TeamGetWeekAddFeeTotal()

View File

@@ -128,7 +128,7 @@ import UserDropdown from "@/components/UserDropdown.vue";
import Loading from "@/components/Loading.vue"; import Loading from "@/components/Loading.vue";
import {getCustomerAttendance,getTodayCall,getProblemDistribution,getTableFillingRate,getAverageResponseTime, import {getCustomerAttendance,getTodayCall,getProblemDistribution,getTableFillingRate,getAverageResponseTime,
getWeeklyActiveCommunicationRate,getTimeoutResponseRate,getCustomerCallInfo,getCustomerChatInfo,getCustomerFormInfo, getWeeklyActiveCommunicationRate,getTimeoutResponseRate,getCustomerCallInfo,getCustomerChatInfo,getCustomerFormInfo,
getConversionRateAndAllocatedData,getCustomerAttendanceAfterClass4,getPayMoneyCustomers,getSalesFunnel,getGoldContactTime} from "@/api/api.js" getConversionRateAndAllocatedData,getCustomerAttendanceAfterClass4,getPayMoneyCustomers,getSalesFunnel,getGoldContactTime,getAvgCallTime} from "@/api/api.js"
// 缓存系统 // 缓存系统
const cache = new Map(); const cache = new Map();
@@ -331,6 +331,11 @@ async function getCoreKpi() {
kpiDataState.wechatAddRate = conversionRes.data.plus_v_conversion_rate || 0 kpiDataState.wechatAddRate = conversionRes.data.plus_v_conversion_rate || 0
} }
// 平均通话时长
const avgCallTimeRes = await withCache('getAvgCallTime', () => getAvgCallTime(hasParams ? params : undefined), hasParams ? params : {})
if (avgCallTimeRes.code === 200) {
kpiDataState.avgDuration = avgCallTimeRes.data.call_time || 0
}
} catch (error) { } catch (error) {
console.error('获取核心KPI数据失败:', error) console.error('获取核心KPI数据失败:', error)
} finally { } finally {