feat(settlement, admin): introduce new types and functions for downline share and settlement period hints

Added new types for downline share breakdown and settlement period open hints to enhance the agent settlement API. Updated the admin console components to support these new features, improving the user experience with better data presentation and interaction. Additionally, refined the date range field to accommodate new calendar markers and hints, ensuring a more intuitive interface for managing settlement periods.
This commit is contained in:
2026-06-12 16:01:42 +08:00
parent 1eb6702c51
commit 24fd7c10bd
50 changed files with 1821 additions and 618 deletions

View File

@@ -110,6 +110,38 @@ function CellMonoId({
);
}
function walletTxnBizTypeLabel(
bizType: string,
ledgerSource: string | null | undefined,
t: (key: string) => string,
tSettlement: (key: string, opts?: { defaultValue?: string }) => string,
): string {
if (ledgerSource === "credit_ledger") {
return creditLedgerReasonLabel(bizType, tSettlement);
}
switch (bizType) {
case "transfer_in":
return t("transferIn");
case "transfer_out":
return t("transferOut");
case "transfer_out_refund":
return t("transferOutRefund");
case "bet_deduct":
return t("bizBetDeduct");
case "bet_reverse":
return t("bizBetReverse");
case "settle_payout":
return t("bizSettlePayout");
case "jackpot_manual_payout":
return t("bizJackpotPayout");
case "settlement_adjustment":
return t("bizSettlementAdjustment");
default:
return bizType;
}
}
function statusLabelT(status: string, t: (key: string) => string): string {
switch (status) {
case "processing":
@@ -551,8 +583,8 @@ export function TransferOrdersPanel(): React.ReactElement {
{err ? <p className="text-sm text-red-600 dark:text-red-400">{err}</p> : null}
{(loading && !data) || data ? (
<>
<div className="rounded-md border">
<Table id="wallet-transfer-orders-table" className="table-fixed">
<div className="admin-table-shell overflow-x-auto rounded-md border">
<Table id="wallet-transfer-orders-table" className="min-w-[1180px]">
<TableHeader>
<TableRow>
<TableHead className="min-w-0 max-w-[14rem]">{t("localTransferNo")}</TableHead>
@@ -713,6 +745,10 @@ export function WalletTxnsPanel(): React.ReactElement {
setPage(1);
};
const showLedgerColumn =
data?.items.some((row) => row.ledger_source === "credit_ledger") ?? false;
const txnTableColSpan = showLedgerColumn ? 12 : 11;
return (
<Card>
<CardHeader>
@@ -863,56 +899,66 @@ export function WalletTxnsPanel(): React.ReactElement {
{err ? <p className="text-sm text-red-600 dark:text-red-400">{err}</p> : null}
{(loading && !data) || data ? (
<>
<div className="rounded-md border">
<Table id="wallet-transactions-table" className="table-fixed">
<div className="admin-table-shell overflow-x-auto rounded-md border">
<Table id="wallet-transactions-table" className="min-w-[1180px]">
<TableHeader>
<TableRow>
<TableHead className="min-w-0 max-w-[14rem]">{t("txnNo")}</TableHead>
<TableHead className="min-w-0 max-w-[12rem]">{t("externalRefNo")}</TableHead>
<TableHead className="min-w-[10rem] whitespace-nowrap">{t("txnNo")}</TableHead>
<TableHead className="min-w-[8rem] whitespace-nowrap">{t("externalRefNo")}</TableHead>
<AdminAgentIdentityHeads />
<AdminPlayerIdentityHeads />
<TableHead className="whitespace-nowrap">{t("ledgerChannel", { defaultValue: "账本" })}</TableHead>
<TableHead className="whitespace-nowrap">{t("type")}</TableHead>
<TableHead className="whitespace-nowrap">{t("amount")}</TableHead>
{showLedgerColumn ? (
<TableHead className="whitespace-nowrap">{t("ledgerChannel", { defaultValue: "账本" })}</TableHead>
) : null}
<TableHead className="min-w-[6.5rem] whitespace-nowrap">{t("type")}</TableHead>
<TableHead className="min-w-[6.5rem] whitespace-nowrap">{t("amount")}</TableHead>
<TableHead className="whitespace-nowrap">{t("status")}</TableHead>
<TableHead className="min-w-0 whitespace-normal leading-tight">{t("requestTime")}</TableHead>
<TableHead className="min-w-0 whitespace-normal leading-tight">{t("finishedTime")}</TableHead>
<TableHead className="min-w-[8.5rem] whitespace-nowrap">{t("requestTime")}</TableHead>
<TableHead className="min-w-[8.5rem] whitespace-nowrap">{t("finishedTime")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{loading && !data ? (
<AdminTableLoadingRow colSpan={12} />
<AdminTableLoadingRow colSpan={txnTableColSpan} />
) : !data || data.items.length === 0 ? (
<AdminTableNoResourceRow colSpan={12} />
<AdminTableNoResourceRow colSpan={txnTableColSpan} />
) : (
data.items.map((row) => (
<TableRow key={row.id}>
<TableCell className="min-w-0 max-w-[14rem] align-top whitespace-normal">
<TableCell className="min-w-[10rem] max-w-[12rem] align-top">
<CellMonoId value={row.txn_no} copyHint={t("copyTxnNo")} />
</TableCell>
<TableCell className="min-w-0 max-w-[12rem] align-top whitespace-normal">
<TableCell className="min-w-[8rem] max-w-[10rem] align-top">
<CellMonoId value={row.external_ref_no} copyHint={t("copyExternalTxnRefNo")} />
</TableCell>
<AdminAgentIdentityCells row={row} />
<AdminPlayerIdentityCells row={row} />
<TableCell>
<PlayerLedgerSourceBadge ledgerSource={row.ledger_source} />
{showLedgerColumn ? (
<TableCell className="align-top whitespace-nowrap">
<PlayerLedgerSourceBadge ledgerSource={row.ledger_source} />
</TableCell>
) : null}
<TableCell className="min-w-[6.5rem] max-w-[9rem] align-top text-xs">
<span
className="block truncate"
title={walletTxnBizTypeLabel(row.biz_type, row.ledger_source, t, tSettlement)}
>
{walletTxnBizTypeLabel(row.biz_type, row.ledger_source, t, tSettlement)}
</span>
</TableCell>
<TableCell className="min-w-0 text-xs">
{row.ledger_source === "credit_ledger"
? creditLedgerReasonLabel(row.biz_type, tSettlement)
: row.biz_type}
<TableCell className="min-w-[6.5rem] align-top whitespace-nowrap tabular-nums text-xs">
{row.amount_formatted ?? formatAdminMinorUnits(row.amount)}
<span className="ml-1 text-muted-foreground">
({row.direction === 1 ? t("in") : t("out")})
</span>
</TableCell>
<TableCell className="tabular-nums text-xs">
{row.amount} ({row.direction === 1 ? t("in") : t("out")})
</TableCell>
<TableCell>
<TableCell className="align-top whitespace-nowrap">
<AdminStatusBadge status={row.status}>{statusLabelT(row.status, t)}</AdminStatusBadge>
</TableCell>
<TableCell className="min-w-0 whitespace-normal font-mono text-[11px] leading-snug text-muted-foreground">
<TableCell className="min-w-[8.5rem] align-top whitespace-nowrap font-mono text-[11px] leading-snug text-muted-foreground">
{formatTs(row.created_at)}
</TableCell>
<TableCell className="min-w-0 whitespace-normal font-mono text-[11px] leading-snug text-muted-foreground">
<TableCell className="min-w-[8.5rem] align-top whitespace-nowrap font-mono text-[11px] leading-snug text-muted-foreground">
{formatTs(row.updated_at)}
</TableCell>
</TableRow>