fetch(add): 账户管理

This commit is contained in:
sexygoat
2026-01-23 17:18:24 +08:00
parent 339abca4c0
commit b53fea43c6
93 changed files with 7094 additions and 3153 deletions

View File

@@ -2,14 +2,14 @@
* 佣金相关配置
*/
import { CommissionStatus, WithdrawalStatus } from '@/types/api'
import { CommissionStatus, WithdrawalStatus } from '@/types/api/commission'
// 佣金状态选项
export const COMMISSION_STATUS_OPTIONS = [
{ label: '待结算', value: CommissionStatus.PENDING, type: 'warning' as const },
{ label: '已结算', value: CommissionStatus.SETTLED, type: 'success' as const },
{ label: '已提现', value: CommissionStatus.WITHDRAWN, type: 'info' as const },
{ label: '冻结', value: CommissionStatus.FROZEN, type: 'danger' as const }
{ label: '已冻结', value: CommissionStatus.FROZEN, type: 'info' as const },
{ label: '解冻中', value: CommissionStatus.UNFREEZING, type: 'warning' as const },
{ label: '已发放', value: CommissionStatus.RELEASED, type: 'success' as const },
{ label: '已失效', value: CommissionStatus.INVALID, type: 'danger' as const }
]
// 提现状态选项
@@ -17,22 +17,57 @@ export const WITHDRAWAL_STATUS_OPTIONS = [
{ label: '待审核', value: WithdrawalStatus.PENDING, type: 'warning' as const },
{ label: '已通过', value: WithdrawalStatus.APPROVED, type: 'success' as const },
{ label: '已拒绝', value: WithdrawalStatus.REJECTED, type: 'danger' as const },
{ label: '处理中', value: WithdrawalStatus.PROCESSING, type: 'primary' as const },
{ label: '已完成', value: WithdrawalStatus.COMPLETED, type: 'success' as const },
{ label: '失败', value: WithdrawalStatus.FAILED, type: 'danger' as const }
{ label: '已到账', value: WithdrawalStatus.COMPLETED, type: 'success' as const }
]
// 支付方式选项
export const PAYMENT_METHOD_OPTIONS = [
{ label: '银行转账', value: 'bank', icon: 'bank' },
{ label: '银行', value: 'bank', icon: 'bank' },
{ label: '支付宝', value: 'alipay', icon: 'alipay' },
{ label: '微信', value: 'wechat', icon: 'wechat' }
]
// ========== 提现状态映射 ==========
// 提现状态映射 (1:待审核, 2:已通过, 3:已拒绝, 4:已到账)
export const WithdrawalStatusMap = {
1: { label: '待审核', type: 'warning' as const, color: '#E6A23C' },
2: { label: '已通过', type: 'success' as const, color: '#67C23A' },
3: { label: '已拒绝', type: 'danger' as const, color: '#F56C6C' },
4: { label: '已到账', type: 'success' as const, color: '#67C23A' }
}
// ========== 佣金状态映射 ==========
// 佣金状态映射 (1:已冻结, 2:解冻中, 3:已发放, 4:已失效)
export const CommissionStatusMap = {
1: { label: '已冻结', type: 'info' as const, color: '#909399' },
2: { label: '解冻中', type: 'warning' as const, color: '#E6A23C' },
3: { label: '已发放', type: 'success' as const, color: '#67C23A' },
4: { label: '已失效', type: 'danger' as const, color: '#F56C6C' }
}
// ========== 提现方式映射 ==========
// 提现方式映射 (alipay:支付宝, wechat:微信, bank:银行卡)
export const WithdrawalMethodMap = {
alipay: { label: '支付宝', icon: 'alipay' },
wechat: { label: '微信', icon: 'wechat' },
bank: { label: '银行卡', icon: 'bank' }
}
// ========== 佣金类型映射 ==========
// 佣金类型映射 (one_time:一次性佣金, long_term:长期佣金)
export const CommissionTypeMap = {
one_time: { label: '一次性佣金', type: 'primary' as const },
long_term: { label: '长期佣金', type: 'success' as const }
}
// 获取佣金状态标签
export function getCommissionStatusLabel(status: CommissionStatus): string {
const option = COMMISSION_STATUS_OPTIONS.find((item) => item.value === status)
return option?.label || status
return option?.label || String(status)
}
// 获取佣金状态类型
@@ -44,7 +79,7 @@ export function getCommissionStatusType(status: CommissionStatus) {
// 获取提现状态标签
export function getWithdrawalStatusLabel(status: WithdrawalStatus): string {
const option = WITHDRAWAL_STATUS_OPTIONS.find((item) => item.value === status)
return option?.label || status
return option?.label || String(status)
}
// 获取提现状态类型
@@ -58,3 +93,15 @@ export function getPaymentMethodLabel(method: string): string {
const option = PAYMENT_METHOD_OPTIONS.find((item) => item.value === method)
return option?.label || method
}
// 获取佣金类型标签
export function getCommissionTypeLabel(type: string): string {
const config = CommissionTypeMap[type as keyof typeof CommissionTypeMap]
return config?.label || String(type)
}
// 获取佣金类型type
export function getCommissionTypeType(type: string) {
const config = CommissionTypeMap[type as keyof typeof CommissionTypeMap]
return config?.type || 'info'
}