feat(game): 重构充值功能添加支付渠道选择
- 在 API 类型定义中添加支付渠道、货币代码和银行信息字段 - 实现充值 ViewModel 管理支付渠道、货币、支付方式和银行的选择逻辑 - 添加下拉选择组件让用户选择支付渠道、货币、支付方式和银行 - 更新桌面端和移动端充值界面的 UI 布局和样式设计 - 集成 Lucide 图标库提供支付方式相关的图标显示 - 重构存款配置标准化逻辑支持备用支付渠道数据处理 - 添加多语言本地化资源支持新的支付流程界面文本 - 优化充值创建请求的数据结构和参数传递机制
This commit is contained in:
@@ -81,6 +81,8 @@ function normalizeRate(dto: FinanceRateConfigDto) {
|
||||
function normalizePayChannel(dto: FinancePayChannelDto) {
|
||||
return {
|
||||
code: dto.code,
|
||||
currencyCodes: Array.isArray(dto.currency_codes) ? dto.currency_codes : [],
|
||||
depositBanks: (dto.deposit_banks ?? []).map(normalizeWithdrawBank),
|
||||
name: dto.name,
|
||||
sort: Number.isFinite(dto.sort) ? dto.sort : 0,
|
||||
status: typeof dto.status === 'number' ? dto.status : 1,
|
||||
@@ -133,12 +135,22 @@ function normalizeDepositFields(dto: FinanceDepositFieldsDto | undefined = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeDepositConfig(dto: FinanceDepositConfigDto | undefined) {
|
||||
function normalizeDepositConfig(
|
||||
dto: FinanceDepositConfigDto | undefined,
|
||||
fallbackPayChannels: FinancePayChannelDto[] = [],
|
||||
) {
|
||||
const payChannels =
|
||||
dto?.pay_channels && dto.pay_channels.length > 0
|
||||
? dto.pay_channels
|
||||
: fallbackPayChannels
|
||||
|
||||
return {
|
||||
banks: (dto?.banks ?? []).map(normalizeWithdrawBank),
|
||||
defaultChannelCode: dto?.default_channel_code ?? '',
|
||||
defaultChannelByCurrency: dto?.default_channel_by_currency ?? {},
|
||||
fields: normalizeDepositFields(dto?.fields),
|
||||
methods: (dto?.methods ?? []).map(normalizeDepositMethod),
|
||||
payChannels: payChannels.map(normalizePayChannel),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +188,7 @@ function normalizeDepositWithdrawConfig(
|
||||
return {
|
||||
currencies: (dto.currencies ?? []).map(normalizeCurrency),
|
||||
defaultDepositChannelCode: dto.default_deposit_channel_code ?? '',
|
||||
deposit: normalizeDepositConfig(dto.deposit),
|
||||
deposit: normalizeDepositConfig(dto.deposit, dto.pay_channels ?? []),
|
||||
payChannels: (dto.pay_channels ?? []).map(normalizePayChannel),
|
||||
platformCoinLabel: dto.platform_coin_label,
|
||||
rates: (dto.rates ?? []).map(normalizeRate),
|
||||
@@ -204,6 +216,10 @@ function normalizeDepositTierItem(
|
||||
typeof dto.pay_channel_code === 'string' && dto.pay_channel_code.length > 0
|
||||
? dto.pay_channel_code
|
||||
: null
|
||||
const channelCode =
|
||||
typeof dto.channel_code === 'string' && dto.channel_code.length > 0
|
||||
? dto.channel_code
|
||||
: (payChannelCode ?? null)
|
||||
const sort = toFiniteNumber(dto.sort ?? dto.pay_amount ?? dto.amount)
|
||||
const status = toFiniteNumber(dto.status ?? 1)
|
||||
const channels = (dto.channels ?? [])
|
||||
@@ -217,6 +233,7 @@ function normalizeDepositTierItem(
|
||||
return {
|
||||
amount,
|
||||
bonusAmount,
|
||||
channelCode,
|
||||
channels,
|
||||
coins,
|
||||
currency,
|
||||
|
||||
Reference in New Issue
Block a user