refactor(api): 重构客户信息接口路径并移除悬浮待办组件
将客户通话、聊天和表单信息的接口路径统一调整至sales_timeline下 移除不再使用的FloatingTodo组件及相关导入 添加客户信息获取逻辑至联系人选择流程
This commit is contained in:
@@ -30,28 +30,11 @@ export const getTimeoutResponseRate = (params) => {
|
|||||||
return https.post('/api/v1/sales/timeout_response_rate', params)
|
return https.post('/api/v1/sales/timeout_response_rate', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 客户通话录音 /api/v1/sales/get_customer_call_info
|
|
||||||
export const getCustomerCallInfo = (params) => {
|
|
||||||
return https.post('/api/v1/customer_list/get_customer_call_info', params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户聊天记录 /api/v1/sales/get_customer_chat_info
|
|
||||||
export const getCustomerChatInfo = (params) => {
|
|
||||||
return https.post('/api/v1/customer_list/get_customer_chat_info', params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 客户表单详情 /api/v1/sales/get_customer_form_info
|
|
||||||
export const getCustomerFormInfo = (params) => {
|
|
||||||
return https.post('/api/v1/customer_list/get_customer_form_info', params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转化率、分配数据量、加微率 /api/v1/sales/conversion_rate_and_allocated_data
|
// 转化率、分配数据量、加微率 /api/v1/sales/conversion_rate_and_allocated_data
|
||||||
export const getConversionRateAndAllocatedData = (params) => {
|
export const getConversionRateAndAllocatedData = (params) => {
|
||||||
return https.post('/api/v1/sales/conversion_rate_and_allocated_data', params)
|
return https.post('/api/v1/sales/conversion_rate_and_allocated_data', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 时间线 /api/v1/customer_list/sales_customers_list
|
// 时间线 /api/v1/customer_list/sales_customers_list
|
||||||
export const getCustomerAttendance = (params ) => {
|
export const getCustomerAttendance = (params ) => {
|
||||||
return https.post('/api/v1/sales_timeline/get_all_customers', params)
|
return https.post('/api/v1/sales_timeline/get_all_customers', params)
|
||||||
@@ -67,6 +50,20 @@ export const getPayMoneyCustomers = (params) => {
|
|||||||
return https.post('/api/v1/sales_timeline/get_pay_money_customers', params)
|
return https.post('/api/v1/sales_timeline/get_pay_money_customers', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 客户聊天记录 /api/v1/sales/get_customer_chat_info
|
||||||
|
export const getCustomerChatInfo = (params) => {
|
||||||
|
return https.post('/api/v1/sales_timeline/get_customer_chat_info', params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 客户表单详情 /api/v1/sales/get_customer_form_info
|
||||||
|
export const getCustomerFormInfo = (params) => {
|
||||||
|
return https.post('/api/v1/sales_timeline/get_customer_form_info', params)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 客户通话录音 /api/v1/sales/get_customer_call_info
|
||||||
|
export const getCustomerCallInfo = (params) => {
|
||||||
|
return https.post('/api/v1/sales_timeline/get_customer_call_info', params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sales-dashboard">
|
<div class="sales-dashboard">
|
||||||
<!-- 悬浮待办组件 -->
|
|
||||||
<FloatingTodo />
|
|
||||||
|
|
||||||
<!-- 页面加载状态 -->
|
<!-- 页面加载状态 -->
|
||||||
<Loading :visible="isPageLoading" text="正在加载数据..." />
|
<Loading :visible="isPageLoading" text="正在加载数据..." />
|
||||||
<!-- 顶部导航栏 -->
|
<!-- 顶部导航栏 -->
|
||||||
@@ -26,6 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<UserDropdown />
|
<UserDropdown />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-content">
|
<div class="section-content">
|
||||||
<!-- 数据分析区域加载状态 -->
|
<!-- 数据分析区域加载状态 -->
|
||||||
<div v-if="isKpiLoading || isStatisticsLoading || isUrgentProblemLoading" class="section-loading">
|
<div v-if="isKpiLoading || isStatisticsLoading || isUrgentProblemLoading" class="section-loading">
|
||||||
@@ -116,7 +114,7 @@ import CustomerDetail from "./components/CustomerDetail.vue";
|
|||||||
import PersonalDashboard from "./components/PersonalDashboard.vue";
|
import PersonalDashboard from "./components/PersonalDashboard.vue";
|
||||||
import SalesTimelineWithTaskList from "./components/SalesTimelineWithTaskList.vue";
|
import SalesTimelineWithTaskList from "./components/SalesTimelineWithTaskList.vue";
|
||||||
import RawDataCards from "./components/RawDataCards.vue";
|
import RawDataCards from "./components/RawDataCards.vue";
|
||||||
import FloatingTodo from "./components/FloatingTodo.vue";
|
// import FloatingTodo from "./components/FloatingTodo.vue";
|
||||||
import UserDropdown from "@/components/UserDropdown.vue";
|
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,
|
||||||
@@ -194,6 +192,13 @@ const courseCustomers = ref({});
|
|||||||
const payMoneyCustomersList = ref([]);
|
const payMoneyCustomersList = ref([]);
|
||||||
const payMoneyCustomersCount = ref(0);
|
const payMoneyCustomersCount = ref(0);
|
||||||
|
|
||||||
|
// 表单信息
|
||||||
|
const formInfo = ref({});
|
||||||
|
// 通话记录
|
||||||
|
const callRecords = ref([]);
|
||||||
|
// 聊天记录
|
||||||
|
const chatRecords = ref([]);
|
||||||
|
|
||||||
// MOCK DATA (Should ideally come from a store or API)
|
// MOCK DATA (Should ideally come from a store or API)
|
||||||
const MOCK_DATA = reactive({
|
const MOCK_DATA = reactive({
|
||||||
contacts: [
|
contacts: [
|
||||||
@@ -328,13 +333,10 @@ async function getTimeline() {
|
|||||||
if (res.data.all_customers_list) {
|
if (res.data.all_customers_list) {
|
||||||
customersList.value = res.data.all_customers_list
|
customersList.value = res.data.all_customers_list
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理客户总数
|
// 处理客户总数
|
||||||
if (res.data.all_customers_count) {
|
if (res.data.all_customers_count) {
|
||||||
customersCount.value = res.data.all_customers_count
|
customersCount.value = res.data.all_customers_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 后4个阶段
|
// 后4个阶段
|
||||||
const classRes = await getCustomerAttendanceAfterClass4(hasParams ? params : undefined)
|
const classRes = await getCustomerAttendanceAfterClass4(hasParams ? params : undefined)
|
||||||
@@ -420,12 +422,10 @@ async function getTimeline() {
|
|||||||
if (payRes.data.pay_money_customers_list) {
|
if (payRes.data.pay_money_customers_list) {
|
||||||
payMoneyCustomersList.value = payRes.data.pay_money_customers_list
|
payMoneyCustomersList.value = payRes.data.pay_money_customers_list
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理成交阶段客户总数
|
// 处理成交阶段客户总数
|
||||||
if (payRes.data.pay_money_customers_count) {
|
if (payRes.data.pay_money_customers_count) {
|
||||||
payMoneyCustomersCount.value = payRes.data.pay_money_customers_count
|
payMoneyCustomersCount.value = payRes.data.pay_money_customers_count
|
||||||
}
|
}
|
||||||
|
|
||||||
// 成交阶段客户数据已存储在payMoneyCustomersList中,不需要合并到customersList
|
// 成交阶段客户数据已存储在payMoneyCustomersList中,不需要合并到customersList
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -440,19 +440,55 @@ async function getCustomerForm() {
|
|||||||
console.warn('无法获取客户表单:客户信息不完整');
|
console.warn('无法获取客户表单:客户信息不完整');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const routeParams = getRequestParams()
|
const routeParams = getRequestParams()
|
||||||
const params = {
|
const params = {
|
||||||
user_name: routeParams.user_name || userStore.userInfo.username,
|
user_name: routeParams.user_name || userStore.userInfo.username,
|
||||||
customer_name: selectedContact.value.name,
|
customer_name: selectedContact.value.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getCustomerFormInfo(params)
|
const res = await getCustomerFormInfo(params)
|
||||||
if(res.code === 200) {
|
if(res.code === 200) {
|
||||||
MOCK_DATA.formFields = res.data
|
formInfo.value = res.data
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 静默处理错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 聊天记录
|
||||||
|
async function getCustomerChat() {
|
||||||
|
if (!selectedContact.value || !selectedContact.value.name) {
|
||||||
|
console.warn('无法获取客户聊天记录:客户信息不完整');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const routeParams = getRequestParams()
|
||||||
|
const params = {
|
||||||
|
user_name: routeParams.user_name || userStore.userInfo.username,
|
||||||
|
customer_name: selectedContact.value.name,
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await getCustomerChatInfo(params)
|
||||||
|
if(res.code === 200) {
|
||||||
|
chatRecords.value = res.data
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 静默处理错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 通话记录
|
||||||
|
async function getCustomerCall() {
|
||||||
|
if (!selectedContact.value || !selectedContact.value.name) {
|
||||||
|
console.warn('无法获取客户通话记录:客户信息不完整');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const routeParams = getRequestParams()
|
||||||
|
const params = {
|
||||||
|
user_name: routeParams.user_name || userStore.userInfo.username,
|
||||||
|
customer_name: selectedContact.value.name,
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await getCustomerCallInfo(params)
|
||||||
|
if(res.code === 200) {
|
||||||
|
callRecords.value = res.data
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -516,7 +552,6 @@ const filteredContacts = computed(() => {
|
|||||||
if (selectedStage.value === '课1-4') {
|
if (selectedStage.value === '课1-4') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有API数据,使用API数据
|
// 如果有API数据,使用API数据
|
||||||
if (formattedCustomersList.value.length > 0) {
|
if (formattedCustomersList.value.length > 0) {
|
||||||
if (selectedStage.value === 'all' || selectedStage.value === '全部') {
|
if (selectedStage.value === 'all' || selectedStage.value === '全部') {
|
||||||
@@ -535,13 +570,13 @@ const filteredContacts = computed(() => {
|
|||||||
// METHODS
|
// METHODS
|
||||||
const selectContact = (id) => {
|
const selectContact = (id) => {
|
||||||
selectedContactId.value = id;
|
selectedContactId.value = id;
|
||||||
|
|
||||||
// 当选中客户后,获取客户表单数据
|
// 当选中客户后,获取客户表单数据
|
||||||
nextTick(async () => {
|
nextTick(async () => {
|
||||||
if (selectedContact.value && selectedContact.value.name) {
|
if (selectedContact.value && selectedContact.value.name) {
|
||||||
await getCustomerForm();
|
await getCustomerForm();
|
||||||
|
await getCustomerChat();
|
||||||
|
await getCustomerCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
contextPanelRef.value?.scrollIntoView({
|
contextPanelRef.value?.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "center",
|
block: "center",
|
||||||
@@ -640,8 +675,13 @@ const handleViewCallData = (contact) => {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
isPageLoading.value = true
|
isPageLoading.value = true
|
||||||
|
await getCoreKpi()
|
||||||
|
await getCustomerForm()
|
||||||
|
await getCustomerChat()
|
||||||
|
await getUrgentProblem()
|
||||||
|
await getCustomerCall()
|
||||||
await getTimeline()
|
await getTimeline()
|
||||||
|
await getCustomerPayMoney()
|
||||||
// 等待数据加载完成后选择默认客户
|
// 等待数据加载完成后选择默认客户
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user