feat(销售时间轴): 添加子时间轴阶段选择功能

实现子时间轴各阶段的点击选择功能,将筛选后的客户数据转换为统一格式并传递给父组件
This commit is contained in:
2025-08-30 17:19:53 +08:00
parent d204c7befe
commit c10b514779
2 changed files with 107 additions and 19 deletions

View File

@@ -42,6 +42,7 @@
v-else
:data="timelineData"
@stage-select="handleStageSelect"
@sub-stage-select="handleSubStageSelect"
:selected-stage="selectedStage"
:contacts="filteredContacts"
:selected-contact-id="selectedContactId"
@@ -772,6 +773,44 @@ const handleStageSelect = (stage, extraData = null) => {
currentFilteredCustomers.value = [];
}
};
// 处理子时间轴阶段选择
const handleSubStageSelect = (eventData) => {
console.log('子时间轴选择事件:', eventData);
// 将筛选后的客户数据转换为contacts格式
const filteredContacts = eventData.filteredCustomers.map(customer => ({
id: customer.customer_name || customer.id,
name: customer.customer_name || customer.name,
phone: customer.phone,
profession: customer.customer_occupation || customer.profession,
education: customer.customer_child_education || customer.education,
lastMessageTime: customer.latest_message_time || customer.time,
avatarUrl: customer.customer_avatar_url || customer.avatar,
avatar: customer.customer_avatar_url || customer.avatar || '/default-avatar.svg',
type: customer.type || eventData.originalStageType,
classNum: customer.class_num,
class_num: customer.class_num,
salesStage: eventData.stageType,
priority: customer.type === '待联系' ? 'high' : 'normal',
time: customer.latest_message_time || customer.time || '未知',
health: customer.health || 75,
// 保留原始数据
customer_name: customer.customer_name,
customer_occupation: customer.customer_occupation,
customer_child_education: customer.customer_child_education,
scrm_user_main_code: customer.scrm_user_main_code,
weChat_avatar: customer.weChat_avatar,
class_situation: customer.class_situation,
records: customer.records
}));
// 更新当前筛选的客户数据但保持selectedStage不变保持子时间轴显示
currentFilteredCustomers.value = filteredContacts;
console.log(`已筛选出${eventData.originalStageType}阶段的${filteredContacts.length}位客户`);
};
const handleViewFormData = async (contact) => {
// 获取客户表单数据
await getCustomerForm();