feat: 增强注单处理逻辑并优化用户反馈体验

新增注单错误处理逻辑,支持已退款及待确认状态的异常场景处理。
更新 HallBetResultDialog:针对部分失败与已退款订单显示对应提示信息。
优化注单分组逻辑,新增订单状态处理,提升整体订单管理能力。
新增订单状态与用户通知相关多语言翻译,进一步提升用户体验。
This commit is contained in:
2026-05-26 16:32:53 +08:00
parent 51b2a36cc5
commit ab81da3199
19 changed files with 373 additions and 142 deletions

View File

@@ -53,6 +53,64 @@ function parseScheduleClockToMs(
);
}
/** 将时刻格式化为指定 IANA 时区下的 `YYYY-MM-DD`(用于排期日筛选)。 */
export function formatYmdInTimeZone(date: Date, timeZone: string): string {
try {
const parts = new Intl.DateTimeFormat("en-CA", {
timeZone,
year: "numeric",
month: "2-digit",
day: "2-digit",
}).formatToParts(date);
const map = new Map(parts.map((part) => [part.type, part.value]));
const year = map.get("year") ?? "0000";
const month = map.get("month") ?? "00";
const day = map.get("day") ?? "00";
return `${year}-${month}-${day}`;
} catch {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return `${y}-${m}-${d}`;
}
}
/** 排期时区下的「今天」`YYYY-MM-DD`。 */
export function scheduleTodayYmd(timeZone: string): string {
return formatYmdInTimeZone(new Date(), timeZone);
}
/**
* 日期选择器单元格对应的排期日字面量Y-M-D 与格子上显示的数字一致)。
* 与 API `start_date`/`end_date`(按排期时区解释)对齐。
*/
export function formatSchedulePickerYmd(date: Date): string {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return `${y}-${m}-${d}`;
}
export function parseSchedulePickerYmd(value: string): Date | undefined {
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
if (!m) return undefined;
const d = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
return Number.isNaN(d.getTime()) ? undefined : d;
}
/** IANA 时区短标签(如 UTC、GMT+8。 */
export function getTimeZoneShortLabel(timeZone: string, date = new Date()): string {
try {
const parts = new Intl.DateTimeFormat(undefined, {
timeZone,
timeZoneName: "short",
}).formatToParts(date);
return parts.find((part) => part.type === "timeZoneName")?.value ?? timeZone;
} catch {
return timeZone;
}
}
/** 浏览器本地时区短标签(如 CST、GMT+8用于界面说明。 */
export function getBrowserTimeZoneLabel(date = new Date()): string {
try {