Files
template-10560/src/utils/customerStatus.ts
赵忠林 0b43a3bc92 feat(dealer): 添加客户列表功能并优化邀请流程
- 新增客户列表页面,实现客户数据获取和筛选功能
- 添加客户状态管理工具函数
- 优化邀请流程,支持绑定推荐关系
- 调整提现功能,增加调试组件
- 修复申请经销商功能中的推荐人ID逻辑
2025-09-03 10:41:06 +08:00

70 lines
1.6 KiB
TypeScript

/**
* 客户状态管理工具函数
*/
// 客户状态类型定义
export type CustomerStatus = 'all' | 'pending' | 'signed' | 'cancelled';
// 客户状态配置
export const CUSTOMER_STATUS_CONFIG = {
all: {
label: '全部',
color: '#666666',
tagType: 'default' as const
},
pending: {
label: '跟进中',
color: '#ff8800',
tagType: 'warning' as const
},
signed: {
label: '已签约',
color: '#52c41a',
tagType: 'success' as const
},
cancelled: {
label: '已取消',
color: '#ff4d4f',
tagType: 'danger' as const
}
};
/**
* 获取状态文本
*/
export const getStatusText = (status: CustomerStatus): string => {
return CUSTOMER_STATUS_CONFIG[status]?.label || '';
};
/**
* 获取状态标签类型
*/
export const getStatusTagType = (status: CustomerStatus) => {
return CUSTOMER_STATUS_CONFIG[status]?.tagType || 'default';
};
/**
* 获取状态颜色
*/
export const getStatusColor = (status: CustomerStatus): string => {
return CUSTOMER_STATUS_CONFIG[status]?.color || '#666666';
};
/**
* 获取所有状态选项
*/
export const getStatusOptions = () => {
return Object.entries(CUSTOMER_STATUS_CONFIG).map(([value, config]) => ({
value: value as CustomerStatus,
label: config.label
}));
};
/**
* 临时函数:生成随机状态(实际项目中应该删除,从数据库获取真实状态)
*/
export const getRandomStatus = (): CustomerStatus => {
const statuses: CustomerStatus[] = ['pending', 'signed', 'cancelled'];
return statuses[Math.floor(Math.random() * statuses.length)];
};