Files
hfb_jysh/frontend/src/features/admin/enumLabels.ts
T

155 lines
4.5 KiB
TypeScript

/** 后台订单/支付相关枚举的中文展示。未知值保留原始 code,方便排查新枚举。 */
function labelOf(map: Record<string, string>, value?: string | null) {
const code = (value ?? '').trim()
if (!code) return '—'
return map[code] ?? code
}
export const paymentBizTypeMap: Record<string, string> = {
order_pay: '订单支付',
deposit: '押金支付',
wallet_recharge: '钱包充值',
main_recharge: '充值',
cancel_refund: '取消退款',
admin_close_refund: '客服关闭退款',
admin_refund: '人工退款',
checkout_refund: '结账退款',
deposit_refund: '押金退款',
rent_refund: '租金退款',
arbitration_refund: '仲裁退款',
admin_seal_refund: '封存退款',
mohong_pay: '撞车支付',
mohong_refund: '撞车退款',
quality_owner_pay: '优质号主保证金',
}
export function paymentBizTypeLabel(value?: string | null) {
return labelOf(paymentBizTypeMap, value)
}
export const paymentProviderMap: Record<string, string> = {
leshua: '拉卡拉',
shuncheng: '顺诚',
mock: '模拟支付',
demo: '演示渠道',
}
export function paymentProviderLabel(value?: string | null) {
return labelOf(paymentProviderMap, value)
}
export const paymentMethodMap: Record<string, string> = {
wechat: '微信支付',
alipay: '支付宝',
unionpay: '银联',
qq: 'QQ 钱包',
mock: '模拟支付',
}
export function paymentMethodLabel(value?: string | null) {
return labelOf(paymentMethodMap, value)
}
export const processStageMap: Record<string, string> = {
create: '创建',
payment: '支付',
handoff: '交接',
checkout: '结账',
settlement: '结算',
dispute: '争议',
}
export function processStageLabel(value?: string | null) {
return labelOf(processStageMap, value)
}
export const processActionMap: Record<string, string> = {
created: '创建订单',
paid: '支付完成',
owner_handoff_submitted: '号主提交交接',
handoff_submitted: '号主提交交接',
platform_handoff_submitted: '客服代交接',
admin_force_handoff: '客服确认交接',
renter_received_confirmed: '租客确认收号',
handoff_received: '租客确认收号',
checkout_submitted: '租客发起结账',
checkout_countered: '修改结账方案',
checkout_confirmed: '号主确认结账',
checkout_accepted: '租客接受结账方案',
checkout_disputed: '发起结账争议',
platform_checkout_countered: '客服修改结账方案',
platform_checkout_confirmed: '客服确认结账',
platform_checkout_dispute_opened: '客服发起结账争议',
offline_settlement_confirmed: '确认线下结算',
deposit_held: '暂扣押金',
deposit_released: '归还暂扣押金',
}
export function processActionLabel(value?: string | null) {
const code = (value ?? '').trim()
if (!code) return '—'
const direct = processActionMap[code]
if (direct) return direct
// 兼容手工数据/旧数据里的 order.xxx 形式。
if (code.startsWith('order.')) {
const suffix = code.slice('order.'.length)
const mapped = processActionMap[suffix]
if (mapped) return mapped
}
return code
}
export const handoffRecordTypeMap: Record<string, string> = {
owner_handoff: '号主交接',
owner_return: '号主归还',
renter_return: '租客归还',
platform_handoff: '客服代交接',
admin_force_handoff: '客服确认交接',
renter_checkout: '租客发起结账',
platform_checkout_counter: '客服修改结账方案',
platform_checkout_dispute_opened: '客服发起结账争议',
}
export function handoffRecordTypeLabel(value?: string | null) {
return labelOf(handoffRecordTypeMap, value)
}
export const disputeTypeMap: Record<string, string> = {
cannot_login: '无法登录',
false_description: '描述不符',
account_banned: '账号封禁',
asset_loss: '资产损失',
haf_coin_dispute: '哈夫币争议',
handoff_timeout: '交接超时',
return_timeout: '归还超时',
checkout_amount: '结账金额争议',
checkout: '结账争议',
checkout_dispute: '结账争议',
}
export function disputeTypeLabel(value?: string | null) {
return labelOf(disputeTypeMap, value)
}
export const disputeStatusMap: Record<string, string> = {
open: '处理中',
processing: '处理中',
resolved: '已解决',
cancelled: '已取消',
}
export function disputeStatusLabel(value?: string | null) {
return labelOf(disputeStatusMap, value)
}
export const participantTypeMap: Record<string, string> = {
user: '用户',
admin: '客服',
system: '系统',
}
export function participantTypeLabel(value?: string | null) {
return labelOf(participantTypeMap, value)
}