feat: 添加货币管理功能,更新国际化支持,移除报表相关代码
This commit is contained in:
@@ -41,6 +41,8 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { useAdminCurrencyCatalog } from "@/hooks/use-admin-currency-catalog";
|
||||
import { formatAdminMinorUnits } from "@/lib/money";
|
||||
import { LotteryApiBizError } from "@/types/api/errors";
|
||||
import type { AdminPlayerRow } from "@/types/api/admin-player";
|
||||
|
||||
@@ -60,11 +62,6 @@ function playerStatusVariant(
|
||||
return "default";
|
||||
}
|
||||
|
||||
function formatMinorUnits(minor: number, currencyCode: string): string {
|
||||
const major = minor / 100;
|
||||
return `${major.toFixed(2)} ${currencyCode}`;
|
||||
}
|
||||
|
||||
const PLAYER_STATUS_OPTIONS = [
|
||||
{ value: 0, label: "statusNormal" },
|
||||
{ value: 1, label: "statusFrozen" },
|
||||
@@ -74,9 +71,10 @@ const PLAYER_STATUS_OPTIONS = [
|
||||
export function PlayersConsole(): React.ReactElement {
|
||||
const { t } = useTranslation(["players", "common"]);
|
||||
const profile = useAdminProfile();
|
||||
useAdminCurrencyCatalog();
|
||||
const canManagePlayers = adminHasAnyPermission(profile?.permissions, ["prd.users.manage"]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [perPage, setPerPage] = useState(25);
|
||||
const [perPage, setPerPage] = useState(10);
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
@@ -206,6 +204,9 @@ export function PlayersConsole(): React.ReactElement {
|
||||
if (formNickname !== editingPlayer?.nickname) {
|
||||
body.nickname = formNickname.trim() || null;
|
||||
}
|
||||
if (formDefaultCurrency !== editingPlayer?.default_currency) {
|
||||
body.default_currency = formDefaultCurrency.trim().toUpperCase();
|
||||
}
|
||||
if (formStatus !== editingPlayer?.status) {
|
||||
body.status = formStatus;
|
||||
}
|
||||
@@ -344,12 +345,12 @@ export function PlayersConsole(): React.ReactElement {
|
||||
<TableCell>{row.default_currency}</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-right tabular-nums text-xs">
|
||||
{row.wallets.length > 0
|
||||
? formatMinorUnits(row.wallets[0].balance, row.wallets[0].currency_code)
|
||||
? formatAdminMinorUnits(row.wallets[0].balance, row.wallets[0].currency_code)
|
||||
: "—"}
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-right tabular-nums text-xs">
|
||||
{row.wallets.length > 0
|
||||
? formatMinorUnits(row.wallets[0].available_balance, row.wallets[0].currency_code)
|
||||
? formatAdminMinorUnits(row.wallets[0].available_balance, row.wallets[0].currency_code)
|
||||
: "—"}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
|
||||
Reference in New Issue
Block a user