export const ISSUE_TYPES = [{ key: 1, label: "一般问题" }, { key: 2, label: "维修问题" }, { key: 3, label: "退货问题" }];
export const SEVERITIES = [{ key: 0, label: "轻微" }, { key: 1, label: "一般" }, { key: 2, label: "严重" }, { key: 3, label: "致命" }];
export const RETURN_TYPES = [{ key: 1, label: "退款退货" }, { key: 2, label: "换货" }, { key: 3, label: "仅退款" }];
export const VISIT_TYPES = [{ key: 0, label: "电话回访" }, { key: 1, label: "上门回访" }, { key: 2, label: "远程回访" }, { key: 3, label: "其他" }];
export const ROOT_CAUSES = ["", "设计缺陷", "物料缺陷", "工艺缺陷", "装配缺陷", "运输损坏", "包装缺陷", "使用不当", "软件缺陷", "其他"];
export const TICKET_STATUS: Record<number, string> = { 0: "草稿", 10: "处理中", 30: "待退货", 40: "待退款/换货", 50: "已完结", 60: "已关闭", 99: "已取消" };
export const RETURN_STATUS: Record<number, string> = { 0: "草稿", 10: "销售审核中", 20: "已同步MES", 30: "检验中", 40: "检验完成", 50: "已入库", 60: "退款/换货完成", 70: "已关闭", 99: "已取消" };
export const PROBLEM_STATUS: Record<number, string> = { 0: "草稿", 1: "已发布", 2: "已停用" };
export const labelOf = (options: Array<{ key: number; label: string }>, key?: number) => options.find(item => item.key === key)?.label || "--";
export const money = (value?: number) => value === undefined || value === null ? "--" : `¥${Number(value).toFixed(2)}`;
export const dateTime = (value?: string) => value ? value.replace("T", " ").slice(0, 19) : "--";
export const toast = (title: string) => uni.showToast({ title, icon: "none" });
export function confirm(content: string) {
  return new Promise<boolean>(resolve => uni.showModal({ title: "提示", content, success: result => resolve(result.confirm), fail: () => resolve(false) }));
}
