feat(api): 新增销售漏斗和黄金联络时段API接口
feat(views): 添加销售漏斗和黄金联络时段数据展示功能 refactor(views): 优化客户详情组件的数据处理逻辑 fix(views): 修复业绩数据显示字段不一致问题 style(views): 调整路由导航顶栏样式
This commit is contained in:
@@ -15,17 +15,17 @@
|
||||
<button
|
||||
@click="startSopAnalysis"
|
||||
class="analysis-button sop-button"
|
||||
:disabled="isSopAnalysisLoading"
|
||||
:disabled="true"
|
||||
>
|
||||
{{ isSopAnalysisLoading ? 'SOP分析中...' : 'SOP通话分析' }}
|
||||
</button>
|
||||
<button
|
||||
<!-- <button
|
||||
@click="startDemandAnalysis"
|
||||
class="analysis-button demand-button"
|
||||
:disabled="isDemandAnalysisLoading"
|
||||
>
|
||||
{{ isDemandAnalysisLoading ? '诉求分析中...' : '客户诉求分析' }}
|
||||
</button>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,8 +65,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 下方整行区域 -->
|
||||
<div class="bottom-row">
|
||||
<!-- 客户诉求分析 -->
|
||||
<!-- <div class="bottom-row">
|
||||
<div class="analysis-section demand-analysis">
|
||||
<div class="section-header">
|
||||
<h4>客户诉求分析</h4>
|
||||
@@ -80,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user