crmLabels.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /** CRM 状态/阶段展示(与 Web 字典语义对齐的常用值) */
  2. const MAPS = {
  3. clueStatus: {
  4. new: { text: '新线索', tag: 'info' },
  5. follow: { text: '跟进中', tag: 'warning' },
  6. invalid: { text: '无效', tag: 'danger' },
  7. converted: { text: '已转化', tag: 'success' }
  8. },
  9. opportunityStage: {
  10. initial: { text: '初步接触', tag: 'info' },
  11. demand: { text: '需求确认', tag: 'info' },
  12. proposal: { text: '方案报价', tag: 'warning' },
  13. negotiation: { text: '商务谈判', tag: 'warning' },
  14. won: { text: '赢单', tag: 'success' },
  15. lost: { text: '输单', tag: 'danger' }
  16. },
  17. opportunityStatus: {
  18. following: { text: '跟进中', tag: 'warning' },
  19. won: { text: '赢单', tag: 'success' },
  20. lost: { text: '输单', tag: 'danger' },
  21. invalid: { text: '无效', tag: 'muted' }
  22. },
  23. customerStatus: {
  24. potential: { text: '潜在', tag: 'info' },
  25. intentional: { text: '意向', tag: 'warning' },
  26. dealing: { text: '洽谈', tag: 'warning' },
  27. dealed: { text: '已成交', tag: 'success' },
  28. lost: { text: '流失', tag: 'danger' },
  29. pool: { text: '公海', tag: 'muted' }
  30. },
  31. quoteStatus: {
  32. draft: { text: '草稿', tag: 'muted' },
  33. pending: { text: '待审批', tag: 'warning' },
  34. approved: { text: '已通过', tag: 'success' },
  35. rejected: { text: '已驳回', tag: 'danger' },
  36. invalid: { text: '已作废', tag: 'muted' },
  37. converted: { text: '已转合同', tag: 'success' }
  38. },
  39. contractStatus: {
  40. draft: { text: '草稿', tag: 'muted' },
  41. pending: { text: '待审批', tag: 'warning' },
  42. approved: { text: '已生效', tag: 'success' },
  43. rejected: { text: '已驳回', tag: 'danger' },
  44. executing: { text: '执行中', tag: 'info' },
  45. completed: { text: '已完成', tag: 'success' },
  46. terminated: { text: '已终止', tag: 'danger' },
  47. expired: { text: '已过期', tag: 'warning' }
  48. },
  49. level: {
  50. A: { text: 'A级', tag: 'danger' },
  51. B: { text: 'B级', tag: 'warning' },
  52. C: { text: 'C级', tag: 'info' },
  53. D: { text: 'D级', tag: 'muted' }
  54. }
  55. }
  56. export function labelOf(mapKey, value) {
  57. if (value == null || value === '') return { text: '—', tag: 'muted' }
  58. const hit = MAPS[mapKey]?.[String(value)]
  59. if (hit) return hit
  60. return { text: String(value), tag: 'muted' }
  61. }
  62. export function formatMoney(val) {
  63. if (val == null || val === '') return '—'
  64. const n = Number(val)
  65. if (Number.isNaN(n)) return String(val)
  66. return `¥${n.toLocaleString('zh-CN', { minimumFractionDigits: 0, maximumFractionDigits: 2 })}`
  67. }
  68. export function dash(val) {
  69. if (val == null || val === '') return '—'
  70. return String(val)
  71. }