feat(admin): 仪表盘重构、代理线路修复与后台体验优化
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
- 各角色仪表盘:KPI 可点击跳转、快捷入口、去重冗余区块,代理/站点降级 analytics - 代理线路:创建玩家权限、侧栏搜索、深链 URL、档案保存与删除预检等修复 - 统一密码最短 6 位;代理模块表格/侧栏背景色一致(admin-table-inset) - 报表、钱包、对账、开奖、结算、配置等模块结构与 i18n 同步更新
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
export type SettlementPeriodView = "bills" | "operations" | "ledger";
|
||||
import type { SettlementBillListScope } from "@/api/admin-agent-settlement";
|
||||
|
||||
const VALID_VIEWS: SettlementPeriodView[] = ["bills", "operations", "ledger"];
|
||||
export type SettlementPeriodView = "bills" | "ledger";
|
||||
|
||||
export type SettlementBillScopeFilter = "all" | SettlementBillListScope;
|
||||
|
||||
const VALID_VIEWS: SettlementPeriodView[] = ["bills", "ledger"];
|
||||
|
||||
const VALID_BILL_SCOPES: SettlementBillScopeFilter[] = [
|
||||
"all",
|
||||
"pending_confirm",
|
||||
"awaiting_payment",
|
||||
"settled",
|
||||
"adjustment",
|
||||
];
|
||||
|
||||
function parsePositiveInt(raw: string | null): number | null {
|
||||
if (raw === null || raw === "") {
|
||||
@@ -11,16 +23,30 @@ function parsePositiveInt(raw: string | null): number | null {
|
||||
}
|
||||
|
||||
export function settlementCenterListHref(adminSiteId?: number | null): string {
|
||||
return settlementCenterScopeHref(adminSiteId, "all");
|
||||
}
|
||||
|
||||
/** 结算中心列表深链,可带账单筛选 scope(待确认 / 待收付等)。 */
|
||||
export function settlementCenterScopeHref(
|
||||
adminSiteId?: number | null,
|
||||
billScope: SettlementBillScopeFilter = "all",
|
||||
): string {
|
||||
const params = new URLSearchParams();
|
||||
if (adminSiteId != null && adminSiteId > 0) {
|
||||
return `/admin/settlement-center?site=${adminSiteId}`;
|
||||
params.set("site", String(adminSiteId));
|
||||
}
|
||||
return "/admin/settlement-center";
|
||||
if (billScope !== "all") {
|
||||
params.set("scope", billScope);
|
||||
}
|
||||
const qs = params.toString();
|
||||
return qs ? `/admin/settlement-center?${qs}` : "/admin/settlement-center";
|
||||
}
|
||||
|
||||
export function settlementPeriodViewHref(
|
||||
periodId: number,
|
||||
view: SettlementPeriodView = "bills",
|
||||
adminSiteId?: number | null,
|
||||
billScope?: SettlementBillScopeFilter | null,
|
||||
): string {
|
||||
const params = new URLSearchParams({
|
||||
period: String(periodId),
|
||||
@@ -29,24 +55,57 @@ export function settlementPeriodViewHref(
|
||||
if (adminSiteId != null && adminSiteId > 0) {
|
||||
params.set("site", String(adminSiteId));
|
||||
}
|
||||
if (billScope != null && billScope !== "all") {
|
||||
params.set("scope", billScope);
|
||||
}
|
||||
return `/admin/settlement-center?${params.toString()}`;
|
||||
}
|
||||
|
||||
export function preferredBillScopeForPeriod(summary?: {
|
||||
pending_confirm?: number;
|
||||
awaiting_payment?: number;
|
||||
}): SettlementBillScopeFilter {
|
||||
const pending = summary?.pending_confirm ?? 0;
|
||||
const awaiting = summary?.awaiting_payment ?? 0;
|
||||
if (pending > 0) {
|
||||
return "pending_confirm";
|
||||
}
|
||||
if (awaiting > 0) {
|
||||
return "awaiting_payment";
|
||||
}
|
||||
return "all";
|
||||
}
|
||||
|
||||
export function parseSettlementCenterView(
|
||||
siteRaw: string | null,
|
||||
periodRaw: string | null,
|
||||
viewRaw: string | null,
|
||||
): { siteId: number | null; periodId: number | null; view: SettlementPeriodView } {
|
||||
const normalizedView = viewRaw === "reports" ? "bills" : viewRaw;
|
||||
scopeRaw?: string | null,
|
||||
): {
|
||||
siteId: number | null;
|
||||
periodId: number | null;
|
||||
view: SettlementPeriodView;
|
||||
billScope: SettlementBillScopeFilter;
|
||||
} {
|
||||
const normalizedView =
|
||||
viewRaw === "reports" || viewRaw === "operations" ? "bills" : viewRaw;
|
||||
const view =
|
||||
normalizedView !== null && VALID_VIEWS.includes(normalizedView as SettlementPeriodView)
|
||||
? (normalizedView as SettlementPeriodView)
|
||||
: "bills";
|
||||
|
||||
const billScope =
|
||||
scopeRaw !== null &&
|
||||
scopeRaw !== "" &&
|
||||
VALID_BILL_SCOPES.includes(scopeRaw as SettlementBillScopeFilter)
|
||||
? (scopeRaw as SettlementBillScopeFilter)
|
||||
: "all";
|
||||
|
||||
return {
|
||||
siteId: parsePositiveInt(siteRaw),
|
||||
periodId: parsePositiveInt(periodRaw),
|
||||
view,
|
||||
billScope,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user