feat: 重构管理端列表与风控/结算导航,新增表格导出和结算审核确认

This commit is contained in:
2026-05-19 17:06:56 +08:00
parent a1fb163f1b
commit 37b13278ef
47 changed files with 1255 additions and 524 deletions

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import { getAdminRiskPoolLockLogs } from "@/api/admin-risk";
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
import { AdminTableExportButton } from "@/components/admin/admin-table-export-button";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
@@ -31,6 +32,22 @@ import type { AdminRiskLockLogListData, AdminRiskLockLogRow } from "@/types/api/
const ACTION_ALL = "__all__";
function riskActionLabel(
value: string,
t: (key: string) => string,
): string {
if (value === ACTION_ALL) {
return t("noLimit");
}
if (value === "lock") {
return t("lock");
}
if (value === "release") {
return t("release");
}
return value;
}
export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
const { t } = useTranslation(["risk", "common"]);
const formatDt = useAdminDateTimeFormatter();
@@ -76,25 +93,30 @@ export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
}, [load]);
return (
<Card>
<CardHeader>
<CardTitle className="text-lg">{t("lockLogsTitle")}</CardTitle>
<Card className="admin-list-card">
<CardHeader className="admin-list-header">
<CardTitle className="admin-list-title">{t("lockLogsTitle")}</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid max-w-full gap-3 sm:grid-cols-[minmax(0,8rem)_minmax(0,10rem)_auto] sm:items-end">
<div className="space-y-1.5">
<Label htmlFor="risk-log-number">{t("number4d")}</Label>
<CardContent className="admin-list-content">
<div className="admin-list-toolbar">
<div className="admin-list-field">
<Label htmlFor="risk-log-number" className="sm:w-20 sm:shrink-0">
{t("number4d")}
</Label>
<Input
id="risk-log-number"
inputMode="numeric"
maxLength={4}
value={draftNumber}
className="w-full sm:w-32"
onChange={(e) => setDraftNumber(e.target.value.replace(/\D/g, "").slice(0, 4))}
placeholder={t("optional")}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor="risk-log-action">{t("actionFilter")}</Label>
<div className="admin-list-field">
<Label htmlFor="risk-log-action" className="sm:w-20 sm:shrink-0">
{t("actionFilter")}
</Label>
<Select
modal={false}
value={draftAction}
@@ -102,8 +124,8 @@ export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
if (v) setDraftAction(v);
}}
>
<SelectTrigger id="risk-log-action" size="sm" className="w-full">
<SelectValue />
<SelectTrigger id="risk-log-action" size="sm" className="w-full sm:w-40">
<SelectValue>{riskActionLabel(draftAction, t)}</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem value={ACTION_ALL}>{t("noLimit")}</SelectItem>
@@ -112,7 +134,12 @@ export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
</SelectContent>
</Select>
</div>
<div className="flex gap-2 sm:justify-end">
<div className="admin-list-actions">
<AdminTableExportButton
tableId={`risk-lock-logs-table-${drawId}`}
filename="风险占用流水"
sheetName="风险占用流水"
/>
<Button
type="button"
size="sm"
@@ -133,8 +160,8 @@ export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
<p className="text-sm text-muted-foreground">{t("states.loading", { ns: "common" })}</p>
) : (
<>
<div className="overflow-x-auto rounded-md border">
<Table>
<div className="admin-table-shell">
<Table id={`risk-lock-logs-table-${drawId}`}>
<TableHeader>
<TableRow>
<TableHead>{t("time")}</TableHead>
@@ -153,7 +180,9 @@ export function RiskLockLogsConsole({ drawId }: { drawId: number }) {
{row.created_at ? formatDt(row.created_at) : "—"}
</TableCell>
<TableCell className="font-mono text-sm">{row.normalized_number}</TableCell>
<TableCell className="text-sm">{row.action_type}</TableCell>
<TableCell className="text-sm">
{riskActionLabel(row.action_type, t)}
</TableCell>
<TableCell className="text-right text-sm tabular-nums">
{formatAdminMinorUnits(row.amount)}
</TableCell>