Add product/channel billing condition editors, place-order additional services, billing simulator, forecast-to-inbound fee delta and margin warnings, insurance-aware claim tips, OMS preset dict seeds, and related AI skills/system pages. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
import { STATUS_TAG_TONES } from '@/utils/statusTag'
|
|
|
|
/** 问题件 / 理赔件 子状态(与后端 OrderHandleStatusCodes 一致) */
|
|
export const ORDER_HANDLE_STATUS_ALL = 'all' as const
|
|
|
|
export type OrderHandleStatusCode = typeof ORDER_HANDLE_STATUS_ALL | 'pending' | 'processed'
|
|
|
|
export const ORDER_HANDLE_SUB_TAB_PARENTS = ['problematic', 'claimed'] as const
|
|
|
|
export type OrderHandleSubTabParent = (typeof ORDER_HANDLE_SUB_TAB_PARENTS)[number]
|
|
|
|
export function isOrderHandleSubTabParent(
|
|
status?: string | null,
|
|
): status is OrderHandleSubTabParent {
|
|
return ORDER_HANDLE_SUB_TAB_PARENTS.includes(status as OrderHandleSubTabParent)
|
|
}
|
|
|
|
export interface OrderHandleStatusMeta {
|
|
value: OrderHandleStatusCode
|
|
labelKey: string
|
|
tagColor: string
|
|
tagBgColor: string
|
|
tagBorder: string
|
|
}
|
|
|
|
export const ORDER_HANDLE_STATUS_LIST: OrderHandleStatusMeta[] = [
|
|
{
|
|
value: ORDER_HANDLE_STATUS_ALL,
|
|
labelKey: 'order.myOrders.handleStatus.all',
|
|
tagColor: STATUS_TAG_TONES.neutral.tagColor,
|
|
tagBgColor: STATUS_TAG_TONES.neutral.tagBgColor,
|
|
tagBorder: STATUS_TAG_TONES.neutral.tagBorder,
|
|
},
|
|
{
|
|
value: 'pending',
|
|
labelKey: 'order.myOrders.handleStatus.pending',
|
|
tagColor: STATUS_TAG_TONES.wait.tagColor,
|
|
tagBgColor: STATUS_TAG_TONES.wait.tagBgColor,
|
|
tagBorder: STATUS_TAG_TONES.wait.tagBorder,
|
|
},
|
|
{
|
|
value: 'processed',
|
|
labelKey: 'order.myOrders.handleStatus.processed',
|
|
tagColor: STATUS_TAG_TONES.ok.tagColor,
|
|
tagBgColor: STATUS_TAG_TONES.ok.tagBgColor,
|
|
tagBorder: STATUS_TAG_TONES.ok.tagBorder,
|
|
},
|
|
]
|
|
|
|
const HANDLE_STATUS_BY_CODE = new Map(
|
|
ORDER_HANDLE_STATUS_LIST.map((item) => [item.value, item]),
|
|
)
|
|
|
|
export function resolveOrderHandleStatusCode(row?: {
|
|
handleStatus?: string
|
|
HandleStatus?: string
|
|
}): OrderHandleStatusCode {
|
|
const raw = String(row?.handleStatus ?? row?.HandleStatus ?? '').trim().toLowerCase()
|
|
if (raw === 'processed') return 'processed'
|
|
return 'pending'
|
|
}
|
|
|
|
export function getOrderHandleStatusMeta(
|
|
code?: string | null,
|
|
): OrderHandleStatusMeta | undefined {
|
|
if (!code || code === ORDER_HANDLE_STATUS_ALL) {
|
|
return HANDLE_STATUS_BY_CODE.get(ORDER_HANDLE_STATUS_ALL)
|
|
}
|
|
const normalized = code.toLowerCase() as OrderHandleStatusCode
|
|
return HANDLE_STATUS_BY_CODE.get(normalized)
|
|
}
|