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.
85 lines
2.4 KiB
TypeScript
85 lines
2.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 === "game_settlement") {
|
|
return t("creditLedger.reason.game_settlement", { defaultValue: "开奖结算" });
|
|
}
|
|
if (reason === "bet_hold") {
|
|
return t("creditLedger.reason.bet_hold", { 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 });
|
|
}
|