feat(客户数据展示): 实现聊天记录展示功能并优化表单数据显示
- 在RawDataCards组件中添加chatInfo prop用于接收聊天数据 - 实现聊天记录列表展示功能,使用实际API返回的数据格式 - 优化表单数据显示逻辑,合并相关字段提升可读性 - 添加聊天记录查看功能,完善数据加载和错误处理
This commit is contained in:
@@ -97,6 +97,7 @@
|
||||
<RawDataCards
|
||||
:selected-contact="selectedContact"
|
||||
:form-info="formInfo"
|
||||
:chat-info="chatRecords"
|
||||
@view-form-data="handleViewFormData"
|
||||
@view-chat-data="handleViewChatData"
|
||||
@view-call-data="handleViewCallData" />
|
||||
@@ -482,98 +483,6 @@ async function getCustomerForm() {
|
||||
const res = await getCustomerFormInfo(params)
|
||||
if(res.code === 200) {
|
||||
formInfo.value = res.data
|
||||
/**
|
||||
* data
|
||||
:
|
||||
{name: "柏媛媛", child_name: "淼淼", child_gender: "女", occupation: "无业", child_education: "高一",…}
|
||||
additional_info
|
||||
:
|
||||
[{topic: "孩子目前是否能正常上学?", answer: "不稳定:经常请假或迟到,断断续续。"},…]
|
||||
0
|
||||
:
|
||||
{topic: "孩子目前是否能正常上学?", answer: "不稳定:经常请假或迟到,断断续续。"}
|
||||
answer
|
||||
:
|
||||
"不稳定:经常请假或迟到,断断续续。"
|
||||
topic
|
||||
:
|
||||
"孩子目前是否能正常上学?"
|
||||
1
|
||||
:
|
||||
{topic: "您当前最困扰的孩子的问题,更接近以下哪种描述?", answer: "比如手机不离手、激烈争吵、破坏规则。"}
|
||||
answer
|
||||
:
|
||||
"比如手机不离手、激烈争吵、破坏规则。"
|
||||
topic
|
||||
:
|
||||
"您当前最困扰的孩子的问题,更接近以下哪种描述?"
|
||||
2
|
||||
:
|
||||
{topic: "面对上述问题,您和孩子的互动模式通常是?", answer: "几乎零交流,像生活在两个世界。"}
|
||||
answer
|
||||
:
|
||||
"几乎零交流,像生活在两个世界。"
|
||||
topic
|
||||
:
|
||||
"面对上述问题,您和孩子的互动模式通常是?"
|
||||
3
|
||||
:
|
||||
{topic: "您认为造成今天这个局面的主要责任在于?", answer: "各方面原因都有,感觉很复杂。"}
|
||||
answer
|
||||
:
|
||||
"各方面原因都有,感觉很复杂。"
|
||||
topic
|
||||
:
|
||||
"您认为造成今天这个局面的主要责任在于?"
|
||||
4
|
||||
:
|
||||
{topic: "此刻,您内心最强烈的感受是?", answer: "内疚和迷茫"}
|
||||
answer
|
||||
:
|
||||
"内疚和迷茫"
|
||||
topic
|
||||
:
|
||||
"此刻,您内心最强烈的感受是?"
|
||||
5
|
||||
:
|
||||
{topic: "您目前最迫切的期望是?", answer: "让他少玩手机,能跟我好好说话。"}
|
||||
answer
|
||||
:
|
||||
"让他少玩手机,能跟我好好说话。"
|
||||
topic
|
||||
:
|
||||
"您目前最迫切的期望是?"
|
||||
child_education
|
||||
:
|
||||
"高一"
|
||||
child_gender
|
||||
:
|
||||
"女"
|
||||
child_name
|
||||
:
|
||||
"淼淼"
|
||||
child_relation
|
||||
:
|
||||
"母亲"
|
||||
created_at
|
||||
:
|
||||
"2025-08-12T10:41:39.798000"
|
||||
mobile
|
||||
:
|
||||
"15061153145"
|
||||
name
|
||||
:
|
||||
"柏媛媛"
|
||||
occupation
|
||||
:
|
||||
"无业"
|
||||
territory
|
||||
:
|
||||
"江苏省 盐城市 滨海县"
|
||||
updated_at
|
||||
:
|
||||
"2025-08-12T10:41:41.534000"
|
||||
*/
|
||||
}
|
||||
} catch (error) {
|
||||
// 静默处理错误
|
||||
@@ -592,8 +501,56 @@ async function getCustomerChat() {
|
||||
}
|
||||
try {
|
||||
const res = await getCustomerChatInfo(params)
|
||||
/**
|
||||
* message:[
|
||||
* 0:{content
|
||||
:
|
||||
"您好孩子妈妈,我是负责咱们本次课程的王慧老师[玫瑰]"
|
||||
format_add_time
|
||||
:
|
||||
"2天前"
|
||||
format_direction
|
||||
:
|
||||
"我"
|
||||
type
|
||||
:
|
||||
"文本"},
|
||||
1:{
|
||||
content
|
||||
:
|
||||
"嗯,王老师好"
|
||||
format_add_time
|
||||
:
|
||||
"2天前"
|
||||
format_direction
|
||||
:
|
||||
"客户"
|
||||
type
|
||||
:
|
||||
"文本"
|
||||
},
|
||||
3:{
|
||||
content
|
||||
:
|
||||
"孩子妈妈,您好,这个是咱们的青少年成长评估表。您这个抽一分钟的时间填写一下孩子的基本信息。填写完了之后,您跟老师说一声。"
|
||||
format_add_time
|
||||
:
|
||||
"2天前"
|
||||
format_direction
|
||||
:
|
||||
"我"
|
||||
type
|
||||
:
|
||||
"语音"
|
||||
}
|
||||
* ]
|
||||
*/
|
||||
if(res.code === 200) {
|
||||
chatRecords.value = res.data
|
||||
console.log('聊天数据获取成功:', res.data)
|
||||
console.log('chatRecords.value:', chatRecords.value)
|
||||
} else {
|
||||
console.log('聊天数据获取失败:', res)
|
||||
}
|
||||
} catch (error) {
|
||||
// 静默处理错误
|
||||
@@ -790,8 +747,12 @@ const handleViewFormData = async (contact) => {
|
||||
console.log('表单数据已加载:', formInfo.value);
|
||||
};
|
||||
|
||||
const handleViewChatData = (contact) => {
|
||||
// TODO: 实现聊天记录查看逻辑
|
||||
const handleViewChatData = async (contact) => {
|
||||
console.log('查看聊天数据:', contact)
|
||||
await getCustomerChatInfo({
|
||||
customerId: selectedContact.value?.customerId || 1
|
||||
})
|
||||
console.log('聊天数据已更新:', chatRecords.value)
|
||||
};
|
||||
|
||||
const handleViewCallData = (contact) => {
|
||||
|
||||
Reference in New Issue
Block a user