- 新增备用金账户、流水、支出、对账与权限 - 后台用户支持中文显示名并同步备用金姓名 - 审计、登录记录、任务及工单操作人优先展示中文名 - 补充备用金与人工支出方案文档
78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import type {
|
|
AdminFundEntryType,
|
|
AdminFundExpenseCategory,
|
|
AdminFundPayeeType,
|
|
AdminFundReconciliationStatus,
|
|
} from '@/types/admin'
|
|
|
|
export const FUND_ENTRY_LABELS: Record<AdminFundEntryType, string> = {
|
|
opening: '期初',
|
|
funding: '公司拨付',
|
|
issue: '发放',
|
|
expense: '支出',
|
|
return: '缴回',
|
|
adjustment: '调整',
|
|
}
|
|
|
|
export const FUND_ENTRY_COLORS: Record<AdminFundEntryType, string> = {
|
|
opening: 'default',
|
|
funding: 'blue',
|
|
issue: 'green',
|
|
expense: 'red',
|
|
return: 'orange',
|
|
adjustment: 'purple',
|
|
}
|
|
|
|
export const FUND_CATEGORY_LABELS: Record<AdminFundExpenseCategory, string> = {
|
|
platform_recharge: '平台充值',
|
|
purchase: '采购/拿货',
|
|
compensation: '客户赔偿',
|
|
freight: '运费',
|
|
other: '其他',
|
|
}
|
|
|
|
export const FUND_PAYEE_LABELS: Record<AdminFundPayeeType, string> = {
|
|
platform: '平台',
|
|
supplier: '供应商',
|
|
customer: '客户',
|
|
other: '其他',
|
|
}
|
|
|
|
export const FUND_ACCOUNT_STATUS_LABELS: Record<string, string> = {
|
|
active: '正常',
|
|
frozen: '冻结',
|
|
closed: '关闭',
|
|
}
|
|
|
|
export const FUND_RECONCILIATION_STATUS_LABELS: Record<AdminFundReconciliationStatus, string> = {
|
|
pending: '待确认',
|
|
confirmed: '已对平',
|
|
discrepancy: '有差异',
|
|
}
|
|
|
|
export const FUND_RECONCILIATION_STATUS_COLORS: Record<AdminFundReconciliationStatus, string> = {
|
|
pending: 'gold',
|
|
confirmed: 'green',
|
|
discrepancy: 'red',
|
|
}
|
|
|
|
export function formatFundAmount(amountFen: number, withSign = false) {
|
|
const value = Number(amountFen || 0) / 100
|
|
const absolute = Math.abs(value).toFixed(2)
|
|
if (withSign) {
|
|
if (value > 0) return `+¥${absolute}`
|
|
if (value < 0) return `-¥${absolute}`
|
|
}
|
|
return value < 0 ? `-¥${absolute}` : `¥${absolute}`
|
|
}
|
|
|
|
export function toFen(value: unknown) {
|
|
const yuan = Number(value)
|
|
return Number.isFinite(yuan) ? Math.round(yuan * 100) : 0
|
|
}
|
|
|
|
export function fromFen(value: unknown) {
|
|
const fen = Number(value)
|
|
return Number.isFinite(fen) ? fen / 100 : 0
|
|
}
|