fetch(add): 账户管理
This commit is contained in:
@@ -19,9 +19,7 @@ export class AccountService extends BaseService {
|
||||
* GET /api/admin/accounts
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getAccounts(
|
||||
params?: AccountQueryParams
|
||||
): Promise<PaginationResponse<PlatformAccount>> {
|
||||
static getAccounts(params?: AccountQueryParams): Promise<PaginationResponse<PlatformAccount>> {
|
||||
return this.getPage<PlatformAccount>('/api/admin/accounts', params)
|
||||
}
|
||||
|
||||
|
||||
@@ -221,9 +221,7 @@ export class CardService extends BaseService {
|
||||
* 批量充值记录列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getBatchRechargeRecords(
|
||||
params?: any
|
||||
): Promise<PaginationResponse<BatchRechargeRecord>> {
|
||||
static getBatchRechargeRecords(params?: any): Promise<PaginationResponse<BatchRechargeRecord>> {
|
||||
return this.getPage<BatchRechargeRecord>('/api/cards/batch-recharge-records', params)
|
||||
}
|
||||
|
||||
|
||||
175
src/api/modules/commission.ts
Normal file
175
src/api/modules/commission.ts
Normal file
@@ -0,0 +1,175 @@
|
||||
/**
|
||||
* 佣金管理相关 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
WithdrawalRequestQueryParams,
|
||||
WithdrawalRequestPageResult,
|
||||
ApproveWithdrawalParams,
|
||||
RejectWithdrawalParams,
|
||||
WithdrawalSettingListResult,
|
||||
WithdrawalSettingItem,
|
||||
CreateWithdrawalSettingParams,
|
||||
CommissionRecordQueryParams,
|
||||
MyCommissionRecordPageResult,
|
||||
MyCommissionSummary,
|
||||
SubmitWithdrawalParams,
|
||||
ShopCommissionRecordPageResult,
|
||||
ShopCommissionSummaryQueryParams,
|
||||
ShopCommissionSummaryPageResult
|
||||
} from '@/types/api/commission'
|
||||
|
||||
export class CommissionService extends BaseService {
|
||||
// ==================== 提现申请管理 ====================
|
||||
|
||||
/**
|
||||
* 获取提现申请列表
|
||||
* GET /api/admin/commission/withdrawal-requests
|
||||
*/
|
||||
static getWithdrawalRequests(
|
||||
params?: WithdrawalRequestQueryParams
|
||||
): Promise<BaseResponse<WithdrawalRequestPageResult>> {
|
||||
return this.get<BaseResponse<WithdrawalRequestPageResult>>(
|
||||
'/api/admin/commission/withdrawal-requests',
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过提现申请
|
||||
* POST /api/admin/commission/withdrawal-requests/{id}/approve
|
||||
*/
|
||||
static approveWithdrawal(id: number, params?: ApproveWithdrawalParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(
|
||||
`/api/admin/commission/withdrawal-requests/${id}/approve`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝提现申请
|
||||
* POST /api/admin/commission/withdrawal-requests/{id}/reject
|
||||
*/
|
||||
static rejectWithdrawal(id: number, params: RejectWithdrawalParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/commission/withdrawal-requests/${id}/reject`, params)
|
||||
}
|
||||
|
||||
// ==================== 提现配置管理 ====================
|
||||
|
||||
/**
|
||||
* 获取提现配置列表
|
||||
* GET /api/admin/commission/withdrawal-settings
|
||||
*/
|
||||
static getWithdrawalSettings(): Promise<BaseResponse<WithdrawalSettingListResult>> {
|
||||
return this.get<BaseResponse<WithdrawalSettingListResult>>(
|
||||
'/api/admin/commission/withdrawal-settings'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增提现配置
|
||||
* POST /api/admin/commission/withdrawal-settings
|
||||
*/
|
||||
static createWithdrawalSetting(params: CreateWithdrawalSettingParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>('/api/admin/commission/withdrawal-settings', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前生效的提现配置
|
||||
* GET /api/admin/commission/withdrawal-settings/current
|
||||
*/
|
||||
static getCurrentWithdrawalSetting(): Promise<BaseResponse<WithdrawalSettingItem>> {
|
||||
return this.get<BaseResponse<WithdrawalSettingItem>>(
|
||||
'/api/admin/commission/withdrawal-settings/current'
|
||||
)
|
||||
}
|
||||
|
||||
// ==================== 我的佣金 ====================
|
||||
|
||||
/**
|
||||
* 获取我的佣金明细
|
||||
* GET /api/admin/my/commission-records
|
||||
*/
|
||||
static getMyCommissionRecords(
|
||||
params?: CommissionRecordQueryParams
|
||||
): Promise<BaseResponse<MyCommissionRecordPageResult>> {
|
||||
return this.get<BaseResponse<MyCommissionRecordPageResult>>(
|
||||
'/api/admin/my/commission-records',
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的佣金概览
|
||||
* GET /api/admin/my/commission-summary
|
||||
*/
|
||||
static getMyCommissionSummary(): Promise<BaseResponse<MyCommissionSummary>> {
|
||||
return this.get<BaseResponse<MyCommissionSummary>>('/api/admin/my/commission-summary')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的提现记录
|
||||
* GET /api/admin/my/withdrawal-requests
|
||||
*/
|
||||
static getMyWithdrawalRequests(
|
||||
params?: WithdrawalRequestQueryParams
|
||||
): Promise<BaseResponse<WithdrawalRequestPageResult>> {
|
||||
return this.get<BaseResponse<WithdrawalRequestPageResult>>(
|
||||
'/api/admin/my/withdrawal-requests',
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起提现申请
|
||||
* POST /api/admin/my/withdrawal-requests
|
||||
*/
|
||||
static submitWithdrawalRequest(params: SubmitWithdrawalParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>('/api/admin/my/withdrawal-requests', params)
|
||||
}
|
||||
|
||||
// ==================== 代理商佣金管理 ====================
|
||||
|
||||
/**
|
||||
* 获取代理商佣金明细
|
||||
* GET /api/admin/shops/{shop_id}/commission-records
|
||||
*/
|
||||
static getShopCommissionRecords(
|
||||
shopId: number,
|
||||
params?: CommissionRecordQueryParams
|
||||
): Promise<BaseResponse<ShopCommissionRecordPageResult>> {
|
||||
return this.get<BaseResponse<ShopCommissionRecordPageResult>>(
|
||||
`/api/admin/shops/${shopId}/commission-records`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理商提现记录
|
||||
* GET /api/admin/shops/{shop_id}/withdrawal-requests
|
||||
*/
|
||||
static getShopWithdrawalRequests(
|
||||
shopId: number,
|
||||
params?: WithdrawalRequestQueryParams
|
||||
): Promise<BaseResponse<WithdrawalRequestPageResult>> {
|
||||
return this.get<BaseResponse<WithdrawalRequestPageResult>>(
|
||||
`/api/admin/shops/${shopId}/withdrawal-requests`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理商佣金汇总列表
|
||||
* GET /api/admin/shops/commission-summary
|
||||
*/
|
||||
static getShopCommissionSummary(
|
||||
params?: ShopCommissionSummaryQueryParams
|
||||
): Promise<BaseResponse<ShopCommissionSummaryPageResult>> {
|
||||
return this.get<BaseResponse<ShopCommissionSummaryPageResult>>(
|
||||
'/api/admin/shops/commission-summary',
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
65
src/api/modules/customerAccount.ts
Normal file
65
src/api/modules/customerAccount.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 客户账号管理 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
CustomerAccountItem,
|
||||
CustomerAccountPageResult,
|
||||
CustomerAccountQueryParams,
|
||||
CreateCustomerAccountParams,
|
||||
UpdateCustomerAccountParams,
|
||||
UpdateCustomerAccountPasswordParams,
|
||||
UpdateCustomerAccountStatusParams
|
||||
} from '@/types/api/customerAccount'
|
||||
|
||||
export class CustomerAccountService extends BaseService {
|
||||
/**
|
||||
* 查询客户账号列表
|
||||
*/
|
||||
static getCustomerAccounts(
|
||||
params?: CustomerAccountQueryParams
|
||||
): Promise<BaseResponse<CustomerAccountPageResult>> {
|
||||
return this.get<BaseResponse<CustomerAccountPageResult>>('/api/admin/customer-accounts', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增代理商账号
|
||||
*/
|
||||
static createCustomerAccount(
|
||||
data: CreateCustomerAccountParams
|
||||
): Promise<BaseResponse<CustomerAccountItem>> {
|
||||
return this.post<BaseResponse<CustomerAccountItem>>('/api/admin/customer-accounts', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑账号
|
||||
*/
|
||||
static updateCustomerAccount(
|
||||
id: number,
|
||||
data: UpdateCustomerAccountParams
|
||||
): Promise<BaseResponse<CustomerAccountItem>> {
|
||||
return this.put<BaseResponse<CustomerAccountItem>>(`/api/admin/customer-accounts/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改账号密码
|
||||
*/
|
||||
static updateCustomerAccountPassword(
|
||||
id: number,
|
||||
data: UpdateCustomerAccountPasswordParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/password`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改账号状态
|
||||
*/
|
||||
static updateCustomerAccountStatus(
|
||||
id: number,
|
||||
data: UpdateCustomerAccountStatusParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/status`, data)
|
||||
}
|
||||
}
|
||||
66
src/api/modules/enterprise.ts
Normal file
66
src/api/modules/enterprise.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 企业客户管理 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
EnterpriseItem,
|
||||
EnterprisePageResult,
|
||||
EnterpriseQueryParams,
|
||||
CreateEnterpriseParams,
|
||||
UpdateEnterpriseParams,
|
||||
UpdateEnterprisePasswordParams,
|
||||
UpdateEnterpriseStatusParams,
|
||||
CreateEnterpriseResponse
|
||||
} from '@/types/api/enterprise'
|
||||
|
||||
export class EnterpriseService extends BaseService {
|
||||
/**
|
||||
* 查询企业客户列表
|
||||
*/
|
||||
static getEnterprises(
|
||||
params?: EnterpriseQueryParams
|
||||
): Promise<BaseResponse<EnterprisePageResult>> {
|
||||
return this.get<BaseResponse<EnterprisePageResult>>('/api/admin/enterprises', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业客户
|
||||
*/
|
||||
static createEnterprise(
|
||||
data: CreateEnterpriseParams
|
||||
): Promise<BaseResponse<CreateEnterpriseResponse>> {
|
||||
return this.post<BaseResponse<CreateEnterpriseResponse>>('/api/admin/enterprises', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑企业信息
|
||||
*/
|
||||
static updateEnterprise(
|
||||
id: number,
|
||||
data: UpdateEnterpriseParams
|
||||
): Promise<BaseResponse<EnterpriseItem>> {
|
||||
return this.put<BaseResponse<EnterpriseItem>>(`/api/admin/enterprises/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业账号密码
|
||||
*/
|
||||
static updateEnterprisePassword(
|
||||
id: number,
|
||||
data: UpdateEnterprisePasswordParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/enterprises/${id}/password`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/禁用企业
|
||||
*/
|
||||
static updateEnterpriseStatus(
|
||||
id: number,
|
||||
data: UpdateEnterpriseStatusParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/enterprises/${id}/status`, data)
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,11 @@ export { PlatformAccountService } from './platformAccount'
|
||||
export { ShopAccountService } from './shopAccount'
|
||||
export { ShopService } from './shop'
|
||||
export { CardService } from './card'
|
||||
export { CommissionService } from './commission'
|
||||
export { EnterpriseService } from './enterprise'
|
||||
export { CustomerAccountService } from './customerAccount'
|
||||
|
||||
// TODO: 按需添加其他业务模块
|
||||
// export { PackageService } from './package'
|
||||
// export { DeviceService } from './device'
|
||||
// export { CommissionService } from './commission'
|
||||
// export { SettingService } from './setting'
|
||||
|
||||
@@ -19,9 +19,7 @@ export class PermissionService extends BaseService {
|
||||
* GET /api/admin/permissions
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getPermissions(
|
||||
params?: PermissionQueryParams
|
||||
): Promise<PaginationResponse<Permission>> {
|
||||
static getPermissions(params?: PermissionQueryParams): Promise<PaginationResponse<Permission>> {
|
||||
return this.getPage<Permission>('/api/admin/permissions', params)
|
||||
}
|
||||
|
||||
@@ -58,10 +56,7 @@ export class PermissionService extends BaseService {
|
||||
* @param id 权限ID
|
||||
* @param data 权限数据
|
||||
*/
|
||||
static updatePermission(
|
||||
id: number,
|
||||
data: UpdatePermissionParams
|
||||
): Promise<BaseResponse> {
|
||||
static updatePermission(id: number, data: UpdatePermissionParams): Promise<BaseResponse> {
|
||||
return this.update(`/api/admin/permissions/${id}`, data)
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,7 @@ export class PlatformAccountService extends BaseService {
|
||||
static createPlatformAccount(
|
||||
data: CreatePlatformAccountParams
|
||||
): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
return this.post<BaseResponse<PlatformAccountResponse>>(
|
||||
'/api/admin/platform-accounts',
|
||||
data
|
||||
)
|
||||
return this.post<BaseResponse<PlatformAccountResponse>>('/api/admin/platform-accounts', data)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,13 +45,8 @@ export class PlatformAccountService extends BaseService {
|
||||
* @param accountId 账号ID
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
static removeRoleFromPlatformAccount(
|
||||
accountId: number,
|
||||
roleId: number
|
||||
): Promise<BaseResponse> {
|
||||
return this.delete<BaseResponse>(
|
||||
`/api/admin/platform-accounts/${accountId}/roles/${roleId}`
|
||||
)
|
||||
static removeRoleFromPlatformAccount(accountId: number, roleId: number): Promise<BaseResponse> {
|
||||
return this.delete<BaseResponse>(`/api/admin/platform-accounts/${accountId}/roles/${roleId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,9 +63,7 @@ export class PlatformAccountService extends BaseService {
|
||||
* GET /api/admin/platform-accounts/{id}
|
||||
* @param id 账号ID
|
||||
*/
|
||||
static getPlatformAccountDetail(
|
||||
id: number
|
||||
): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
static getPlatformAccountDetail(id: number): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
return this.getOne<PlatformAccountResponse>(`/api/admin/platform-accounts/${id}`)
|
||||
}
|
||||
|
||||
@@ -111,9 +101,7 @@ export class PlatformAccountService extends BaseService {
|
||||
* GET /api/admin/platform-accounts/{id}/roles
|
||||
* @param id 账号ID
|
||||
*/
|
||||
static getPlatformAccountRoles(
|
||||
id: number
|
||||
): Promise<BaseResponse<PlatformAccountRoleResponse[]>> {
|
||||
static getPlatformAccountRoles(id: number): Promise<BaseResponse<PlatformAccountRoleResponse[]>> {
|
||||
return this.get<BaseResponse<PlatformAccountRoleResponse[]>>(
|
||||
`/api/admin/platform-accounts/${id}/roles`
|
||||
)
|
||||
@@ -125,10 +113,7 @@ export class PlatformAccountService extends BaseService {
|
||||
* @param id 账号ID
|
||||
* @param data 角色ID列表
|
||||
*/
|
||||
static assignRolesToPlatformAccount(
|
||||
id: number,
|
||||
data: AssignRolesParams
|
||||
): Promise<BaseResponse> {
|
||||
static assignRolesToPlatformAccount(id: number, data: AssignRolesParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/platform-accounts/${id}/roles`, data)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ export class ShopAccountService extends BaseService {
|
||||
* POST /api/admin/shop-accounts
|
||||
* @param data 代理账号数据
|
||||
*/
|
||||
static createShopAccount(data: CreateShopAccountParams): Promise<BaseResponse<ShopAccountResponse>> {
|
||||
static createShopAccount(
|
||||
data: CreateShopAccountParams
|
||||
): Promise<BaseResponse<ShopAccountResponse>> {
|
||||
return this.post<BaseResponse<ShopAccountResponse>>('/api/admin/shop-accounts', data)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user