refactor(admin, draws, settlement): unify admin datetime display and tighten wallet write permission

This commit is contained in:
2026-06-09 15:06:52 +08:00
parent b7278e68a4
commit dfd475856e
10 changed files with 60 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import type { SettlementAdjustmentRow } from "@/api/admin-agent-settlement";
import { AdminNoResourceState } from "@/components/admin/admin-no-resource-state";
import { AdminLoadingState } from "@/components/admin/admin-loading-state";
import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter";
import { formatSettlementPeriodSpan } from "@/lib/agent-settlement-period-range";
import { formatDashboardMoneyMinor } from "@/modules/dashboard/use-dashboard-analytics";
import {
@@ -30,6 +31,7 @@ export function SettlementAdjustmentsTable({
onOpenBill,
}: SettlementAdjustmentsTableProps): React.ReactElement {
const { t } = useTranslation(["settlementCenter", "common"]);
const formatTs = useAdminDateTimeFormatter();
if (loading) {
return <AdminLoadingState />;
@@ -71,7 +73,7 @@ export function SettlementAdjustmentsTable({
{formatDashboardMoneyMinor(row.amount, currencyCode)}
</TableCell>
<TableCell className="max-w-[200px] truncate text-sm">{row.reason ?? "—"}</TableCell>
<TableCell className="text-xs text-muted-foreground">{row.created_at ?? "—"}</TableCell>
<TableCell className="text-xs text-muted-foreground">{formatTs(row.created_at)}</TableCell>
<TableCell>
{row.original_bill_id != null ? (
<button

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import type { SettlementPaymentRow } from "@/api/admin-agent-settlement";
import { AdminNoResourceState } from "@/components/admin/admin-no-resource-state";
import { AdminLoadingState } from "@/components/admin/admin-loading-state";
import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter";
import { formatSettlementPeriodSpan } from "@/lib/agent-settlement-period-range";
import { formatDashboardMoneyMinor } from "@/modules/dashboard/use-dashboard-analytics";
import { settlementBillTypeLabel } from "@/modules/settlement/settlement-status-label";
@@ -31,6 +32,7 @@ export function SettlementPaymentsTable({
onOpenBill,
}: SettlementPaymentsTableProps): React.ReactElement {
const { t } = useTranslation(["settlementCenter", "agents", "common"]);
const formatTs = useAdminDateTimeFormatter();
if (loading) {
return <AdminLoadingState />;
@@ -77,9 +79,13 @@ export function SettlementPaymentsTable({
{formatDashboardMoneyMinor(row.amount, currencyCode)}
</TableCell>
<TableCell>{row.method ?? "—"}</TableCell>
<TableCell>{row.status}</TableCell>
<TableCell>
{t(`paymentStatus.${row.status}`, {
defaultValue: row.status === "confirmed" ? "已确认" : row.status,
})}
</TableCell>
<TableCell className="text-xs text-muted-foreground">
{row.confirmed_at ?? row.created_at ?? "—"}
{formatTs(row.confirmed_at ?? row.created_at)}
</TableCell>
<TableCell>
<button