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,8 +2,7 @@
* 账号相关类型定义
*/
import { PaginationParams } from './common'
import { UserRole } from './auth'
import { PaginationParams } from '@/types'
// 账号状态
export enum AccountStatus {
@@ -113,13 +112,6 @@ export interface AgentQueryParams extends PaginationParams {
status?: AccountStatus
}
// 企业客户查询参数
export interface EnterpriseQueryParams extends PaginationParams {
keyword?: string
customerRoleId?: string | number
status?: AccountStatus
}
// 创建账号参数(匹配后端 ModelCreateAccountRequest
export interface CreatePlatformAccountParams {
username: string // 用户名 (3-50字符)
@@ -143,24 +135,3 @@ export interface CreateAgentParams {
password: string
status: AccountStatus
}
// 创建企业客户参数
export interface CreateEnterpriseParams {
enterpriseCode: string
enterpriseName: string
contactPerson: string
contactPhone: string
email?: string
address?: string
customerRoleId: string | number
username: string
password: string
status: AccountStatus
}
// 账号操作参数
export interface AccountOperationParams {
id: string | number
operation: 'resetPassword' | 'unbindPhone' | 'enable' | 'disable' | 'lock'
newPassword?: string // 重置密码时需要
}

View File

@@ -2,235 +2,249 @@
* 佣金相关类型定义
*/
import { PaginationParams } from './common'
import { PaginationParams } from '@/types'
// 佣金状态
export enum CommissionStatus {
PENDING = 'pending', // 待结算
SETTLED = 'settled', // 已结算
WITHDRAWN = 'withdrawn', // 已提现
FROZEN = 'frozen' // 冻结
FROZEN = 1, // 已冻结
UNFREEZING = 2, // 解冻中
RELEASED = 3, // 已发放
INVALID = 4 // 已失效
}
// 提现状态
export enum WithdrawalStatus {
PENDING = 'pending', // 待审核
APPROVED = 'approved', // 已通过
REJECTED = 'rejected', // 已拒绝
PROCESSING = 'processing', // 处理中
COMPLETED = 'completed', // 已完成
FAILED = 'failed' // 失败
PENDING = 1, // 待审核
APPROVED = 2, // 已通过
REJECTED = 3, // 已拒绝
COMPLETED = 4 // 已到账
}
// 佣金类型
export enum CommissionType {
CARD_SALE = 'cardSale', // 号卡销售佣金
PACKAGE_SALE = 'packageSale', // 套餐销售佣金
RECHARGE = 'recharge', // 充值佣金
RENEWAL = 'renewal' // 续费佣金
ONE_TIME = 'one_time', // 一次性佣金
LONG_TERM = 'long_term' // 长期佣金
}
// 分佣模板
export interface CommissionTemplate {
id: string | number
templateCode: string // 模板编码
templateName: string // 模板名称
description?: string
// 分佣规则
rules: CommissionRule[]
status: 1 | 0 // 启用/禁用
isDefault: boolean // 是否默认模板
createTime: string
updateTime?: string
creatorName?: string
// 提现方式
export enum WithdrawalMethod {
ALIPAY = 'alipay', // 支付宝
WECHAT = 'wechat', // 微信
BANK = 'bank' // 银行卡
}
// 分佣规则
export interface CommissionRule {
id?: string | number
type: CommissionType // 佣金类型
rateType: 'fixed' | 'percentage' // 固定金额/百分比
value: number // 金额或百分比值
minAmount?: number // 最小触发金额
maxAmount?: number // 最大触发金额
description?: string
// 放款类型
export enum PaymentType {
MANUAL = 'manual' // 人工打款
}
// 佣金记录
export interface CommissionRecord {
id: string | number
recordNo: string // 记录编号
// 关联信息
accountId: string | number
accountName: string
accountType: 'agent' | 'enterprise'
// 佣金信息
type: CommissionType
amount: number // 佣金金额
sourceAmount: number // 源交易金额
rate: number // 佣金比例
status: CommissionStatus
// 来源信息
sourceType: 'card' | 'package' | 'recharge' // 来源类型
sourceId: string | number // 来源ID
sourceName?: string
orderId?: string | number // 关联订单ID
orderNo?: string
// 结算信息
settleTime?: string // 结算时间
withdrawTime?: string // 提现时间
withdrawId?: string | number // 提现申请ID
// 时间信息
createTime: string
remark?: string
// ==================== 提现申请相关 ====================
/**
* 提现申请项
*/
export interface WithdrawalRequestItem {
id: number // 提现申请ID
withdrawal_no: string // 提现单号
shop_id: number // 店铺ID
shop_name: string // 店铺名称
shop_hierarchy?: string // 店铺层级路径
amount: number // 提现金额(分)
actual_amount: number // 实际到账金额(分)
fee: number // 手续费(分)
fee_rate: number // 手续费比率(基点,100=1%)
withdrawal_method: WithdrawalMethod // 提现方式
account_name: string // 收款账户名称
account_number: string // 收款账号
bank_name?: string // 银行名称
status: WithdrawalStatus // 状态
payment_type: PaymentType // 放款类型
applicant_id: number // 申请人账号ID
applicant_name: string // 申请人用户名
processor_id?: number // 处理人账号ID
processor_name?: string // 处理人用户名
reject_reason?: string // 拒绝原因
remark?: string // 备注
created_at: string // 申请时间
processed_at?: string // 处理时间
}
// 提现申请
export interface WithdrawalApplication {
id: string | number
applicationNo: string // 申请单号
// 申请人信息
applicantId: string | number
applicantName: string
applicantType: 'agent' | 'enterprise'
// 提现信息
amount: number // 提现金额
fee?: number // 手续费
actualAmount?: number // 实际到账金额
status: WithdrawalStatus
// 收款信息
bankName?: string // 银行名称
bankAccount?: string // 银行账号
accountName?: string // 账户名
alipayAccount?: string // 支付宝账号
wechatAccount?: string // 微信账号
paymentMethod: 'bank' | 'alipay' | 'wechat' // 支付方式
// 审核信息
applyTime: string
processTime?: string // 处理时间
processorId?: string | number
processorName?: string
rejectReason?: string // 拒绝原因
// 完成信息
completeTime?: string
transactionNo?: string // 交易流水号
remark?: string
/**
* 提现申请查询参数
*/
export interface WithdrawalRequestQueryParams extends PaginationParams {
status?: WithdrawalStatus // 状态筛选
withdrawal_no?: string // 提现单号
shop_name?: string // 店铺名称
start_time?: string // 申请开始时间
end_time?: string // 申请结束时间
}
// 客户账户(佣金视图)
export interface CustomerCommissionAccount {
id: string | number
accountId: string | number
accountName: string
accountType: 'agent' | 'enterprise'
// 佣金统计
totalCommission: number // 总佣金
settledCommission: number // 已结算佣金
withdrawnCommission: number // 已提现佣金
pendingCommission: number // 待结算佣金
frozenCommission: number // 冻结佣金
availableCommission: number // 可提现佣金
// 提现统计
totalWithdrawal: number // 累计提现
withdrawalCount: number // 提现次数
lastWithdrawalTime?: string // 最后提现时间
// 时间信息
createTime: string
updateTime?: string
/**
* 审批提现申请参数
*/
export interface ApproveWithdrawalParams {
remark?: string // 审批备注
}
// 我的账户(当前登录账号的佣金数据)
export interface MyCommissionAccount {
// 佣金概览
totalCommission: number
settledCommission: number
withdrawnCommission: number
pendingCommission: number
availableCommission: number
frozenCommission: number
// 本月数据
monthCommission: number // 本月佣金
monthSettled: number // 本月已结算
// 今日数据
todayCommission: number
// 提现信息
totalWithdrawal: number
withdrawalCount: number
pendingWithdrawal: number // 待审核提现
// 图表数据近7天/30天
chartData?: {
dates: string[]
commissions: number[]
}
/**
* 拒绝提现申请参数
*/
export interface RejectWithdrawalParams {
reject_reason: string // 拒绝原因
remark?: string // 备注
}
// 佣金提现设置
export interface WithdrawalSetting {
id: string | number
// 提现规则
minAmount: number // 最小提现金额
maxAmount?: number // 最大提现金额
dailyLimit?: number // 每日提现次数限制
fee: number // 手续费
feeType: 'fixed' | 'percentage' // 固定金额/百分比
// 审核设置
autoApprove: boolean // 是否自动审核
autoApproveAmount?: number // 自动审核金额阈值
// 到账时间
arrivalDays: number // 预计到账天数
// 生效时间
effectiveTime: string
createTime: string
creatorName?: string
// ==================== 提现配置相关 ====================
/**
* 提现配置项
*/
export interface WithdrawalSettingItem {
id: number // 配置ID
min_withdrawal_amount: number // 最低提现金额(分)
fee_rate: number // 手续费比率(基点,100=1%)
daily_withdrawal_limit: number // 每日提现次数限制
arrival_days: number // 到账天数
is_active: boolean // 是否生效
creator_id?: number // 创建人ID
creator_name?: string // 创建人用户名
created_at: string // 创建时间
}
// 佣金查询参数
export interface CommissionQueryParams extends PaginationParams {
accountId?: string | number
accountType?: 'agent' | 'enterprise'
type?: CommissionType
status?: CommissionStatus
amountRange?: [number, number]
createTimeRange?: [string, string]
settleTimeRange?: [string, string]
/**
* 创建提现配置参数
*/
export interface CreateWithdrawalSettingParams {
min_withdrawal_amount: number // 最低提现金额(分)
fee_rate: number // 手续费比率(基点,100=1%)
daily_withdrawal_limit: number // 每日提现次数限制
arrival_days: number // 到账天数
}
// 提现查询参数
export interface WithdrawalQueryParams extends PaginationParams {
applicationNo?: string
applicantId?: string | number
applicantName?: string
status?: WithdrawalStatus
paymentMethod?: 'bank' | 'alipay' | 'wechat'
amountRange?: [number, number]
applyTimeRange?: [string, string]
// ==================== 佣金记录相关 ====================
/**
* 我的佣金记录项
*/
export interface MyCommissionRecordItem {
id: number // 佣金记录ID
amount: number // 佣金金额(分)
commission_type: CommissionType // 佣金类型
status: CommissionStatus // 状态
order_id?: number // 订单ID
shop_id: number // 店铺ID
created_at: string // 创建时间
}
// 创建分佣模板参数
export interface CreateCommissionTemplateParams {
templateCode: string
templateName: string
description?: string
rules: CommissionRule[]
isDefault: boolean
/**
* 佣金记录查询参数
*/
export interface CommissionRecordQueryParams extends PaginationParams {
commission_type?: CommissionType // 佣金类型
status?: CommissionStatus // 状态
start_time?: string // 开始时间
end_time?: string // 结束时间
}
// 申请提现参数
export interface ApplyWithdrawalParams {
amount: number
paymentMethod: 'bank' | 'alipay' | 'wechat'
bankName?: string
bankAccount?: string
accountName?: string
alipayAccount?: string
wechatAccount?: string
remark?: string
/**
* 我的佣金概览
*/
export interface MyCommissionSummary {
total_commission: number // 总佣金(分)
available_commission: number // 可提现佣金(分)
frozen_commission: number // 冻结中佣金(分)
withdrawing_commission: number // 提现中佣金(分)
withdrawn_commission: number // 已提现佣金(分)
}
// 审核提现参数
export interface ProcessWithdrawalParams {
id: string | number
status: 'approved' | 'rejected'
rejectReason?: string
remark?: string
/**
* 发起提现申请参数
*/
export interface SubmitWithdrawalParams {
amount: number // 提现金额(分)
withdrawal_method: WithdrawalMethod // 提现方式
account_name: string // 收款账户名称
account_number: string // 收款账号
bank_name?: string // 银行名称(银行卡提现时必填)
remark?: string // 备注
}
// ==================== 代理商佣金相关 ====================
/**
* 代理商佣金记录项
*/
export interface ShopCommissionRecordItem {
id: number // 佣金记录ID
amount: number // 佣金金额(分)
balance_after: number // 入账后佣金余额(分)
commission_type: CommissionType // 佣金类型
status: CommissionStatus // 状态
order_id?: number // 订单ID
order_no?: string // 订单号
order_created_at?: string // 订单创建时间
iccid?: string // ICCID
device_no?: string // 设备号
created_at: string // 佣金入账时间
}
/**
* 代理商佣金汇总项
*/
export interface ShopCommissionSummaryItem {
shop_id: number // 店铺ID
shop_code: string // 店铺编码
shop_name: string // 店铺名称
username?: string // 主账号用户名
phone?: string // 主账号手机号
total_commission: number // 总佣金(分)
available_commission: number // 可提现佣金(分)
frozen_commission: number // 冻结中佣金(分)
withdrawing_commission: number // 提现中佣金(分)
withdrawn_commission: number // 已提现佣金(分)
unwithdraw_commission: number // 未提现佣金(分)
created_at?: string // 店铺创建时间
}
/**
* 代理商佣金汇总查询参数
*/
export interface ShopCommissionSummaryQueryParams extends PaginationParams {
shop_name?: string // 店铺名称
shop_code?: string // 店铺编码
}
// ==================== 响应类型 ====================
export interface WithdrawalRequestPageResult {
items: WithdrawalRequestItem[] | null
page: number
size: number
total: number
}
export interface WithdrawalSettingListResult {
items: WithdrawalSettingItem[]
}
export interface MyCommissionRecordPageResult {
items: MyCommissionRecordItem[] | null
page: number
size: number
total: number
}
export interface ShopCommissionRecordPageResult {
items: ShopCommissionRecordItem[] | null
page: number
size: number
total: number
}
export interface ShopCommissionSummaryPageResult {
items: ShopCommissionSummaryItem[] | null
page: number
size: number
total: number
}

View File

@@ -16,6 +16,8 @@ export interface PaginationParams {
size?: number
pageNum?: number
pageSize?: number
page?: number
page_size?: number
}
// 分页响应数据

View File

@@ -0,0 +1,63 @@
/**
* 客户账号管理相关类型定义
*/
// 客户账号信息
export interface CustomerAccountItem {
id: number
username: string
phone: string
user_type: number // 3=代理账号, 4=企业账号
user_type_name: string
shop_id: number | null
shop_name: string
enterprise_id: number | null
enterprise_name: string
status: number // 0=禁用, 1=启用
status_name: string
created_at: string
}
// 客户账号分页结果
export interface CustomerAccountPageResult {
items: CustomerAccountItem[]
page: number
size: number
total: number
}
// 查询客户账号列表参数
export interface CustomerAccountQueryParams {
page?: number
page_size?: number
username?: string
phone?: string
user_type?: number | null
shop_id?: number | null
enterprise_id?: number | null
status?: number | null
}
// 新增代理商账号参数
export interface CreateCustomerAccountParams {
username: string
phone: string
password: string
shop_id: number
}
// 编辑账号参数
export interface UpdateCustomerAccountParams {
username?: string
phone?: string
}
// 修改账号密码参数
export interface UpdateCustomerAccountPasswordParams {
password: string
}
// 修改账号状态参数
export interface UpdateCustomerAccountStatusParams {
status: 0 | 1
}

View File

@@ -0,0 +1,91 @@
/**
* 企业客户管理相关类型定义
*/
// 企业信息
export interface EnterpriseItem {
id: number
enterprise_code: string
enterprise_name: string
business_license: string
legal_person: string
province: string
city: string
district: string
address: string
contact_name: string
contact_phone: string
login_phone: string
owner_shop_id: number | null
owner_shop_name: string
status: number // 0=禁用, 1=启用
status_name: string
created_at: string
}
// 企业客户分页结果
export interface EnterprisePageResult {
items: EnterpriseItem[]
page: number
size: number
total: number
}
// 查询企业客户列表参数
export interface EnterpriseQueryParams {
page?: number
page_size?: number
enterprise_name?: string
login_phone?: string
contact_phone?: string
owner_shop_id?: number | null
status?: number | null
}
// 新增企业客户参数
export interface CreateEnterpriseParams {
enterprise_code: string
enterprise_name: string
business_license?: string
legal_person?: string
province?: string
city?: string
district?: string
address?: string
contact_name: string
contact_phone: string
login_phone: string
password: string
owner_shop_id?: number | null
}
// 编辑企业信息参数
export interface UpdateEnterpriseParams {
enterprise_code?: string
enterprise_name?: string
business_license?: string
legal_person?: string
province?: string
city?: string
district?: string
address?: string
contact_name?: string
contact_phone?: string
owner_shop_id?: number | null
}
// 修改企业账号密码参数
export interface UpdateEnterprisePasswordParams {
password: string
}
// 启用/禁用企业参数
export interface UpdateEnterpriseStatusParams {
status: 0 | 1
}
// 新增企业客户响应
export interface CreateEnterpriseResponse {
account_id: number
enterprise: EnterpriseItem
}

View File

@@ -38,5 +38,11 @@ export * from './device'
// 佣金相关
export * from './commission'
// 企业客户相关
export * from './enterprise'
// 客户账号相关
export * from './customerAccount'
// 设置相关
export * from './setting'