Files
order_site/apps/frontend/src/utils/consignment-contact.ts
T

23 lines
666 B
TypeScript

/** 寄卖「对接客服」展示工具:后台列表、详情、工单与打手端统一口径。 */
export type ConsignmentContactDisplay = {
/** 姓名;没有对接客服时为空串 */
name: string
/** 姓名,没有时回退为指定文案(默认「未指定」) */
text: string
}
type ConsignmentContactLike =
| {
contactSupporterName?: string | null
}
| null
| undefined
export function formatConsignmentContactSupporter(
source: ConsignmentContactLike,
emptyText = '未指定',
): ConsignmentContactDisplay {
const name = String(source?.contactSupporterName || '').trim()
return { name, text: name || emptyText }
}