76 lines
2.6 KiB
JavaScript
76 lines
2.6 KiB
JavaScript
/** CRM 状态/阶段展示(与 Web 字典语义对齐的常用值) */
|
|
|
|
const MAPS = {
|
|
clueStatus: {
|
|
new: { text: '新线索', tag: 'info' },
|
|
follow: { text: '跟进中', tag: 'warning' },
|
|
invalid: { text: '无效', tag: 'danger' },
|
|
converted: { text: '已转化', tag: 'success' }
|
|
},
|
|
opportunityStage: {
|
|
initial: { text: '初步接触', tag: 'info' },
|
|
demand: { text: '需求确认', tag: 'info' },
|
|
proposal: { text: '方案报价', tag: 'warning' },
|
|
negotiation: { text: '商务谈判', tag: 'warning' },
|
|
won: { text: '赢单', tag: 'success' },
|
|
lost: { text: '输单', tag: 'danger' }
|
|
},
|
|
opportunityStatus: {
|
|
following: { text: '跟进中', tag: 'warning' },
|
|
won: { text: '赢单', tag: 'success' },
|
|
lost: { text: '输单', tag: 'danger' },
|
|
invalid: { text: '无效', tag: 'muted' }
|
|
},
|
|
customerStatus: {
|
|
potential: { text: '潜在', tag: 'info' },
|
|
intentional: { text: '意向', tag: 'warning' },
|
|
dealing: { text: '洽谈', tag: 'warning' },
|
|
dealed: { text: '已成交', tag: 'success' },
|
|
lost: { text: '流失', tag: 'danger' },
|
|
pool: { text: '公海', tag: 'muted' }
|
|
},
|
|
quoteStatus: {
|
|
draft: { text: '草稿', tag: 'muted' },
|
|
pending: { text: '待审批', tag: 'warning' },
|
|
approved: { text: '已通过', tag: 'success' },
|
|
rejected: { text: '已驳回', tag: 'danger' },
|
|
invalid: { text: '已作废', tag: 'muted' },
|
|
converted: { text: '已转合同', tag: 'success' }
|
|
},
|
|
contractStatus: {
|
|
draft: { text: '草稿', tag: 'muted' },
|
|
pending: { text: '待审批', tag: 'warning' },
|
|
approved: { text: '已生效', tag: 'success' },
|
|
rejected: { text: '已驳回', tag: 'danger' },
|
|
executing: { text: '执行中', tag: 'info' },
|
|
completed: { text: '已完成', tag: 'success' },
|
|
terminated: { text: '已终止', tag: 'danger' },
|
|
expired: { text: '已过期', tag: 'warning' }
|
|
},
|
|
level: {
|
|
A: { text: 'A级', tag: 'danger' },
|
|
B: { text: 'B级', tag: 'warning' },
|
|
C: { text: 'C级', tag: 'info' },
|
|
D: { text: 'D级', tag: 'muted' }
|
|
}
|
|
}
|
|
|
|
export function labelOf(mapKey, value) {
|
|
if (value == null || value === '') return { text: '—', tag: 'muted' }
|
|
const hit = MAPS[mapKey]?.[String(value)]
|
|
if (hit) return hit
|
|
return { text: String(value), tag: 'muted' }
|
|
}
|
|
|
|
export function formatMoney(val) {
|
|
if (val == null || val === '') return '—'
|
|
const n = Number(val)
|
|
if (Number.isNaN(n)) return String(val)
|
|
return `¥${n.toLocaleString('zh-CN', { minimumFractionDigits: 0, maximumFractionDigits: 2 })}`
|
|
}
|
|
|
|
export function dash(val) {
|
|
if (val == null || val === '') return '—'
|
|
return String(val)
|
|
}
|