feat: 统一管理端多语言、配置与票据/结算页面重构
This commit is contained in:
9
src/modules/settlement/invalid-settlement-batch-id.tsx
Normal file
9
src/modules/settlement/invalid-settlement-batch-id.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function InvalidSettlementBatchId(): React.ReactElement {
|
||||
const { t } = useTranslation("settlement");
|
||||
|
||||
return <p className="text-destructive text-sm">{t("invalidBatchId")}</p>;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export const settlementModuleMeta = {
|
||||
title: "结算",
|
||||
title: "结算批次",
|
||||
description: "",
|
||||
} as const;
|
||||
|
||||
@@ -53,6 +53,19 @@ type Props = {
|
||||
|
||||
type SettlementAction = "approve" | "reject" | "payout";
|
||||
|
||||
function settlementStatusText(value: string, t: (key: string) => string): string {
|
||||
const key = `statusOptions.${value}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? value : translated;
|
||||
}
|
||||
|
||||
function settlementReviewStatusText(value: string | null, t: (key: string) => string): string {
|
||||
if (!value) return "—";
|
||||
const key = `reviewStatusOptions.${value}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? value : translated;
|
||||
}
|
||||
|
||||
export function SettlementBatchDetailsConsole({ batchId }: Props) {
|
||||
const { t } = useTranslation(["settlement", "common"]);
|
||||
const profile = useAdminProfile();
|
||||
@@ -195,11 +208,11 @@ export function SettlementBatchDetailsConsole({ batchId }: Props) {
|
||||
<CardContent className="grid gap-2 text-sm sm:grid-cols-2">
|
||||
<p>
|
||||
<span className="text-muted-foreground">{t("settlementStatus")}</span>{" "}
|
||||
<span className="font-mono">{summary.status}</span>
|
||||
<span className="font-mono">{settlementStatusText(summary.status, t)}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-muted-foreground">{t("reviewState")}</span>{" "}
|
||||
<span className="font-mono">{summary.review_status ?? "—"}</span>
|
||||
<span className="font-mono">{settlementReviewStatusText(summary.review_status, t)}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-muted-foreground">{t("ticketTotal")}</span>{" "}
|
||||
|
||||
@@ -74,6 +74,13 @@ function settlementStatusText(value: string, t: (key: string) => string): string
|
||||
return option ? t(option.label) : value;
|
||||
}
|
||||
|
||||
function settlementReviewStatusText(value: string | null, t: (key: string) => string): string {
|
||||
if (!value) return "—";
|
||||
const key = `reviewStatusOptions.${value}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? value : translated;
|
||||
}
|
||||
|
||||
export function SettlementBatchesConsole() {
|
||||
const { t } = useTranslation(["settlement", "common"]);
|
||||
const profile = useAdminProfile();
|
||||
@@ -228,7 +235,7 @@ export function SettlementBatchesConsole() {
|
||||
<Table id="settlement-batches-table">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>ID</TableHead>
|
||||
<TableHead>{t("table.id", { ns: "common" })}</TableHead>
|
||||
<TableHead>{t("drawNo")}</TableHead>
|
||||
<TableHead className="text-right">{t("totalBet")}</TableHead>
|
||||
<TableHead className="text-right">{t("actualDeduct")}</TableHead>
|
||||
@@ -261,7 +268,9 @@ export function SettlementBatchesConsole() {
|
||||
>
|
||||
{formatAdminMinorUnits(row.platform_profit)}
|
||||
</TableCell>
|
||||
<TableCell className="text-xs text-muted-foreground">{row.review_status ?? "—"}</TableCell>
|
||||
<TableCell className="text-xs text-muted-foreground">
|
||||
{settlementReviewStatusText(row.review_status, t)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<span
|
||||
className={cn(
|
||||
|
||||
Reference in New Issue
Block a user