refactor(销售时间线): 优化客户数据管理和展示逻辑
重构销售时间线组件,分离不同阶段的客户数据管理: 1. 不再将后三个阶段和成交阶段的客户合并到customersList 2. 为各阶段客户数据添加独立处理逻辑 3. 优化课程显示逻辑,优先使用class_num字段 4. 简化总数计算逻辑
This commit is contained in:
@@ -324,7 +324,6 @@ async function getTimeline() {
|
||||
value: parseInt(count) || 0
|
||||
}))
|
||||
}
|
||||
|
||||
// 处理客户列表数据
|
||||
if (res.data.all_customers_list) {
|
||||
customersList.value = res.data.all_customers_list
|
||||
@@ -409,15 +408,7 @@ async function getTimeline() {
|
||||
pay_status: customer.pay_status
|
||||
})
|
||||
|
||||
// 将后三个阶段的客户添加到customersList中
|
||||
const additionalCustomers = [
|
||||
...unpaidCustomers.map(customer => formatCustomerForList(customer, '点击未支付')),
|
||||
...depositCustomers.map(customer => formatCustomerForList(customer, '付定金')),
|
||||
...conversionCustomers.map(customer => formatCustomerForList(customer, '定金转化'))
|
||||
]
|
||||
|
||||
// 合并到现有的customersList中
|
||||
customersList.value = [...customersList.value, ...additionalCustomers]
|
||||
// 后三个阶段的客户数据已存储在courseCustomers['课1-4']中,不需要合并到customersList
|
||||
|
||||
|
||||
}
|
||||
@@ -435,21 +426,7 @@ async function getTimeline() {
|
||||
payMoneyCustomersCount.value = payRes.data.pay_money_customers_count
|
||||
}
|
||||
|
||||
// 将成交阶段客户添加到总的客户列表中
|
||||
if (payRes.data.pay_money_customers_list) {
|
||||
const payMoneyCustomers = payRes.data.pay_money_customers_list.map(customer => ({
|
||||
customer_name: customer.customer_name,
|
||||
phone: customer.phone,
|
||||
customer_occupation: customer.customer_occupation,
|
||||
customer_child_education: customer.customer_child_education,
|
||||
latest_message_time: customer.latest_message_time,
|
||||
customer_avatar_url: customer.customer_avatar_url,
|
||||
type: '成交'
|
||||
}))
|
||||
|
||||
// 合并到现有的customersList中
|
||||
customersList.value = [...customersList.value, ...payMoneyCustomers]
|
||||
}
|
||||
// 成交阶段客户数据已存储在payMoneyCustomersList中,不需要合并到customersList
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取时间线数据失败:', error)
|
||||
@@ -519,7 +496,6 @@ const formattedCustomersList = computed(() => {
|
||||
lastMessageTime: customer.latest_message_time,
|
||||
avatarUrl: customer.customer_avatar_url,
|
||||
type: customer.type,
|
||||
classNum: customer.class_num,
|
||||
class_num: customer.class_num, // 确保字段名一致
|
||||
// 添加一些默认值以兼容现有组件
|
||||
salesStage: customer.type || '待联系',
|
||||
|
||||
Reference in New Issue
Block a user