From 2b75f1b56855ecf7ae9ed878b905c8be866edf7d Mon Sep 17 00:00:00 2001
From: lbw_9527443 <780139497@qq.com>
Date: Tue, 19 Aug 2025 21:45:15 +0800
Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=96=B0=E5=A2=9E=E9=94=80?=
=?UTF-8?q?=E5=94=AE=E6=BC=8F=E6=96=97=E5=92=8C=E9=BB=84=E9=87=91=E8=81=94?=
=?UTF-8?q?=E7=BB=9C=E6=97=B6=E6=AE=B5API=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
feat(views): 添加销售漏斗和黄金联络时段数据展示功能
refactor(views): 优化客户详情组件的数据处理逻辑
fix(views): 修复业绩数据显示字段不一致问题
style(views): 调整路由导航顶栏样式
---
my-vue-app/src/api/api.js | 10 ++
my-vue-app/src/views/maneger/manager.vue | 62 +----------
.../person/components/CustomerDetail.vue | 104 +++++++++++++++---
.../person/components/PersonalDashboard.vue | 34 +++---
.../views/person/components/RawDataCards.vue | 102 ++++++++++++++++-
my-vue-app/src/views/person/sale.vue | 101 +++++++++++++----
my-vue-app/src/views/secondTop/secondTop.vue | 44 +++++---
.../src/views/senorManger/seniorManager.vue | 7 +-
8 files changed, 326 insertions(+), 138 deletions(-)
diff --git a/my-vue-app/src/api/api.js b/my-vue-app/src/api/api.js
index f46ac81..6e71259 100644
--- a/my-vue-app/src/api/api.js
+++ b/my-vue-app/src/api/api.js
@@ -66,4 +66,14 @@ export const getCustomerCallInfo = (params) => {
return https.post('/api/v1/sales_timeline/get_customer_call_info', params)
}
+// 销售漏斗 /api/v1/sales/sales_funnel
+export const getSalesFunnel = (params) => {
+ return https.post('/api/v1/sales/sales_funnel', params)
+}
+// 黄金联络 /api/v1/sales/get_gold_contact_time
+export const getGoldContactTime = (params) => {
+ return https.post('/api/v1/sales/get_gold_contact_time', params)
+}
+
+
diff --git a/my-vue-app/src/views/maneger/manager.vue b/my-vue-app/src/views/maneger/manager.vue
index 09df780..7112a8d 100644
--- a/my-vue-app/src/views/maneger/manager.vue
+++ b/my-vue-app/src/views/maneger/manager.vue
@@ -143,67 +143,7 @@ const teamMembers = [
newClients: 1,
deals: 0,
avgDealValue: 0,
- },
- {
- id: 6,
- name: "陈雨",
- rank: 6,
- performance: 45000,
- conversion: 3.2,
- calls: 98,
- callTime: 4.1,
- newClients: 4,
- deals: 1,
- avgDealValue: 45000,
- },
- {
- id: 7,
- name: "周杰",
- rank: 7,
- performance: 38000,
- conversion: 2.8,
- calls: 115,
- callTime: 5.3,
- newClients: 5,
- deals: 1,
- avgDealValue: 38000,
- },
- {
- id: 8,
- name: "吴梅",
- rank: 8,
- performance: 22000,
- conversion: 1.9,
- calls: 87,
- callTime: 3.7,
- newClients: 3,
- deals: 1,
- avgDealValue: 22000,
- },
- {
- id: 9,
- name: "孙涛",
- rank: 9,
- performance: 15000,
- conversion: 1.2,
- calls: 92,
- callTime: 4.0,
- newClients: 2,
- deals: 1,
- avgDealValue: 15000,
- },
- {
- id: 10,
- name: "马丽",
- rank: 10,
- performance: 8000,
- conversion: 0.8,
- calls: 68,
- callTime: 2.5,
- newClients: 1,
- deals: 1,
- avgDealValue: 8000,
- },
+ }
];
// 路由实例
diff --git a/my-vue-app/src/views/person/components/CustomerDetail.vue b/my-vue-app/src/views/person/components/CustomerDetail.vue
index 0b0355b..13c63b8 100644
--- a/my-vue-app/src/views/person/components/CustomerDetail.vue
+++ b/my-vue-app/src/views/person/components/CustomerDetail.vue
@@ -15,17 +15,17 @@
-
+ -->
@@ -65,8 +65,7 @@
-
-
+
@@ -101,6 +100,18 @@ const props = defineProps({
selectedContact: {
type: Object,
default: null
+ },
+ formInfo: {
+ type: Object,
+ default: () => ({})
+ },
+ chatRecords: {
+ type: Array,
+ default: () => []
+ },
+ callRecords: {
+ type: Array,
+ default: () => []
}
});
@@ -115,8 +126,8 @@ const isSopAnalysisLoading = ref(false); // SOP分析加载状态
const isDemandAnalysisLoading = ref(false); // 诉求分析加载状态
// Dify API配置
-const DIFY_API_KEY_01 = 'app-wbR1P1j6kvdBK8Q1qXzdswzP';
-const DIFY_API_KEY = 'app-37VXHRieOnq17BSury9ONavG';
+const DIFY_API_KEY_01 = 'app-h4uBo5kOGoiYhjuBF1AHZi8b'; //基础信息分析
+const DIFY_API_KEY = 'app-ZIJSFWbcdZLufkwCp9RrvpUR';
// 初始化ChatService
const chatService_01 = new SimpleChatService(DIFY_API_KEY_01);
const chatService = new SimpleChatService(DIFY_API_KEY);
@@ -174,17 +185,82 @@ const startBasicAnalysis = async () => {
isBasicAnalysisLoading.value = true;
basicAnalysisResult.value = '';
+ // 构建表单信息
+ const formData = props.formInfo || {};
+ let formInfoText = '暂无表单信息';
+
+ if (Object.keys(formData).length > 0) {
+ const basicInfo = [];
+ const additionalInfo = [];
+
+ // 处理基础信息字段
+ const basicFields = {
+ name: '姓名',
+ mobile: '手机号',
+ occupation: '职业',
+ territory: '地区',
+ child_name: '孩子姓名',
+ child_gender: '孩子性别',
+ child_education: '孩子教育阶段',
+ child_relation: '与孩子关系'
+ };
+
+ Object.entries(basicFields).forEach(([key, label]) => {
+ if (formData[key] && formData[key] !== '暂无' && formData[key] !== '') {
+ basicInfo.push(`${label}: ${formData[key]}`);
+ }
+ });
+
+ // 处理 additional_info 数组
+ if (formData.additional_info && Array.isArray(formData.additional_info)) {
+ formData.additional_info.forEach(item => {
+ if (item.topic && item.answer) {
+ additionalInfo.push(`${item.topic}\n答案: ${item.answer}`);
+ }
+ });
+ }
+
+ // 组合所有信息
+ const allInfo = [];
+ if (basicInfo.length > 0) {
+ allInfo.push('=== 基础信息 ===');
+ allInfo.push(...basicInfo);
+ }
+ if (additionalInfo.length > 0) {
+ allInfo.push('\n=== 问卷信息 ===');
+ allInfo.push(...additionalInfo);
+ }
+
+ formInfoText = allInfo.length > 0 ? allInfo.join('\n') : '暂无表单信息';
+ }
+
+ // 构建聊天记录信息
+ const chatData = props.chatRecords || [];
+ const chatInfoText = chatData.messages.length > 0 ?
+ `聊天记录数量: ${chatData.messages.length}条\n最近聊天内容: ${JSON.stringify(chatData.messages.slice(-3), null, 2)}` :
+ '暂无聊天记录';
+
+ // 构建通话记录信息
+ const callData = props.callRecords || [];
+ const callInfoText = callData.length > 0 ?
+ `通话记录数量: ${callData.length}次\n通话记录详情: ${JSON.stringify(callData, null, 2)}` :
+ '暂无通话记录';
+
const query = `请对客户进行基础信息分析:
客户姓名:${props.selectedContact.name}
联系电话:${props.selectedContact.phone || '未提供'}
-邮箱:${props.selectedContact.email || '未提供'}
-公司:${props.selectedContact.company || '未提供'}
-职位:${props.selectedContact.position || '未提供'}
销售阶段:${props.selectedContact.salesStage || '未知'}
-健康度:${props.selectedContact.health || '未知'}%
-请分析客户的基本情况、背景信息和初步画像。`;
-
+=== 表单信息 ===
+${formInfoText}
+
+=== 聊天记录 ===
+${chatInfoText}
+
+=== 通话记录 ===
+${callInfoText}
+
+请基于以上客户的表单信息、聊天记录和通话记录,分析客户的基本情况、背景信息和初步画像。`;
try {
await chatService_01.sendMessage(
query,
diff --git a/my-vue-app/src/views/person/components/PersonalDashboard.vue b/my-vue-app/src/views/person/components/PersonalDashboard.vue
index 58558d3..19092ca 100644
--- a/my-vue-app/src/views/person/components/PersonalDashboard.vue
+++ b/my-vue-app/src/views/person/components/PersonalDashboard.vue
@@ -99,7 +99,7 @@