Files
lotteryAdmin/src/modules/settlement/settlement-status-label.ts
kang 4484a7a77a
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Refactor agents console and related components
- Simplified share rate calculation in AgentsConsole by removing unnecessary checks and directly setting the profile share rate.
- Updated the use of `profileParentCaps` to always return total share rate in the agent profile.
- Removed unused variables and memoized calculations for improved performance.
- Cleaned up imports in various files, removing unused components and optimizing the code structure.
- Added `tRef` dependency to several useEffect hooks to ensure proper reactivity to translation changes.
- Enhanced report preview tables with better label handling for various statuses and actions.
- Updated wallet filter options to align with player-side transaction types.
- Introduced new properties in types for better type safety and clarity.
2026-06-30 17:55:00 +08:00

109 lines
3.4 KiB
TypeScript

import type { TFunction } from "i18next";
export function settlementBillStatusLabel(
status: string,
t: TFunction<"settlementCenter">,
): string {
const key = `billStatus.${status}` as const;
return t(key, { defaultValue: status });
}
export function settlementBillTypeLabel(
billType: string,
t: TFunction<["settlementCenter", "agents"]>,
): string {
if (billType === "player") {
return t("agents:settlementBills.typePlayer", { defaultValue: "玩家账单" });
}
if (billType === "agent") {
return t("agents:settlementBills.typeAgent", { defaultValue: "代理层级账单" });
}
if (billType === "adjustment") {
return t("settlementCenter:billType.adjustment", { defaultValue: "补差单" });
}
if (billType === "reversal") {
return t("settlementCenter:billType.reversal", { defaultValue: "冲正单" });
}
if (billType === "bad_debt") {
return t("settlementCenter:billType.badDebt", { defaultValue: "坏账核销" });
}
return billType;
}
export function settlementPeriodStatusLabel(
status: string,
t: TFunction<"settlementCenter">,
): string {
if (status === "open") {
return t("filters.statusOpen", { defaultValue: "进行中" });
}
if (status === "closed") {
return t("filters.statusClosed", { defaultValue: "已关账" });
}
if (status === "completed") {
return t("filters.statusCompleted", { defaultValue: "已结清" });
}
return status;
}
export function creditLedgerReasonLabel(
reason: string,
t: TFunction<"settlementCenter">,
): string {
if (reason === "bet") {
return t("creditLedger.reason.bet", { defaultValue: "下注冻结" });
}
if (reason === "game_settlement") {
return t("creditLedger.reason.game_settlement", { defaultValue: "开奖结算" });
}
if (reason === "bill_settlement") {
return t("creditLedger.reason.bill_settlement", { defaultValue: "账期收付" });
}
if (reason === "game_settlement_reversal") {
return t("creditLedger.reason.game_settlement_reversal", { defaultValue: "开奖冲正" });
}
if (reason === "bet_hold") {
return t("creditLedger.reason.bet_hold", { defaultValue: "下注冻结" });
}
if (reason === "bet_hold_release") {
return t("creditLedger.reason.bet_hold_release", { defaultValue: "占用释放" });
}
if (reason === "game_settlement_win") {
return t("creditLedger.reason.game_settlement_win", { defaultValue: "开奖结算入账" });
}
if (reason === "game_settlement_loss") {
return t("creditLedger.reason.game_settlement_loss", { defaultValue: "开奖结算扣款" });
}
if (reason === "settlement_confirm") {
return t("creditLedger.reason.settlement_confirm", { defaultValue: "账期结算确认" });
}
if (reason === "settlement_payout") {
return t("creditLedger.reason.settlement_payout", { defaultValue: "结算收付入账" });
}
const key = `creditLedger.reason.${reason}` as const;
return t(key, { defaultValue: reason });
}
export function settlementAdjustmentTypeLabel(
type: string,
t: TFunction<"settlementCenter">,
): string {
if (type === "bad_debt") {
return t("adjustmentType.bad_debt", { defaultValue: "坏账核销" });
}
const key = `adjustmentType.${type}` as const;
return t(key, { defaultValue: type });
}
export function settlementPaymentStatusLabel(
status: string,
t: TFunction<"settlementCenter">,
): string {
const key = `paymentStatus.${status}` as const;
return t(key, { defaultValue: status });
}