feat(admin): 新增资金出款与运营开支管理
This commit is contained in:
@@ -33,6 +33,12 @@ import type {
|
||||
DashboardData,
|
||||
FinanceDashboard,
|
||||
FinanceDetailPage,
|
||||
FinanceDisbursementPage,
|
||||
FinanceDisbursementQuery,
|
||||
ManualDisbursementPayload,
|
||||
OperatingExpensePage,
|
||||
OperatingExpensePayload,
|
||||
OperatingExpenseQuery,
|
||||
} from '@/features/admin/types'
|
||||
|
||||
export async function fetchAdminCaptcha() {
|
||||
@@ -462,3 +468,76 @@ export async function updateAdminDistributionSite(
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchFinanceDisbursements(query: FinanceDisbursementQuery) {
|
||||
const { data } = await adminClient.get<ApiResponse<Partial<FinanceDisbursementPage>>>(
|
||||
'/admin/finance/disbursements',
|
||||
{ params: compactParams(query) }
|
||||
)
|
||||
return {
|
||||
items: data.data.items ?? [],
|
||||
total: data.data.total ?? 0,
|
||||
page: data.data.page ?? query.page ?? 1,
|
||||
page_size: data.data.page_size ?? query.page_size ?? 20,
|
||||
summary: data.data.summary ?? {
|
||||
record_count: 0,
|
||||
paid_amount_cent: 0,
|
||||
paid_count: 0,
|
||||
payment_pending_amount_cent: 0,
|
||||
payment_pending_count: 0,
|
||||
review_pending_amount_cent: 0,
|
||||
review_pending_count: 0,
|
||||
withdrawal_fee_amount_cent: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export async function createManualDisbursement(payload: ManualDisbursementPayload) {
|
||||
const { data } = await adminClient.post<ApiResponse<unknown>>(
|
||||
'/admin/finance/manual-disbursements',
|
||||
payload
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function voidManualDisbursement(id: number | string, reason: string) {
|
||||
const { data } = await adminClient.post<ApiResponse<unknown>>(
|
||||
`/admin/finance/manual-disbursements/${id}/void`,
|
||||
{ reason }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchOperatingExpenses(query: OperatingExpenseQuery) {
|
||||
const { data } = await adminClient.get<ApiResponse<Partial<OperatingExpensePage>>>(
|
||||
'/admin/finance/operating-expenses',
|
||||
{ params: compactParams(query) }
|
||||
)
|
||||
return {
|
||||
items: data.data.items ?? [],
|
||||
total: data.data.total ?? 0,
|
||||
page: data.data.page ?? query.page ?? 1,
|
||||
page_size: data.data.page_size ?? query.page_size ?? 20,
|
||||
summary: data.data.summary ?? {
|
||||
record_count: 0,
|
||||
paid_amount_cent: 0,
|
||||
paid_count: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export async function createOperatingExpense(payload: OperatingExpensePayload) {
|
||||
const { data } = await adminClient.post<ApiResponse<unknown>>(
|
||||
'/admin/finance/operating-expenses',
|
||||
payload
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function voidOperatingExpense(id: number | string, reason: string) {
|
||||
const { data } = await adminClient.post<ApiResponse<unknown>>(
|
||||
`/admin/finance/operating-expenses/${id}/void`,
|
||||
{ reason }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user