fetch(add): 账户管理
This commit is contained in:
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
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user