完善个人中心资金功能

This commit is contained in:
yml2213
2026-07-28 10:41:46 +08:00
parent dca45afcc8
commit 2ab80c4df8
8 changed files with 1960 additions and 23 deletions
+50 -2
View File
@@ -3,9 +3,12 @@ import type {
CollectLookupResponse,
UploadedFile,
WorkOrder,
WorkerFinanceRequest,
WorkerListResponse,
WorkerLoginResponse,
WorkerProfileResponse,
WorkerUser,
WorkerWalletLedger,
} from '@/types/worker-platform'
export function registerWorker(payload: {
@@ -37,8 +40,53 @@ export function logoutWorker() {
}
export function fetchWorkerProfile() {
return apiGet<{ worker: WorkerUser; permissions: Record<string, unknown> }>(
'/api/v1/worker/profile',
return apiGet<WorkerProfileResponse>('/api/v1/worker/profile')
}
export function fetchWorkerWalletLedgers(params?: Record<string, unknown>) {
return apiGet<WorkerListResponse<WorkerWalletLedger>>(
'/api/v1/worker/profile/wallet-ledgers',
params,
)
}
export function fetchWorkerFinanceRequests(params?: Record<string, unknown>) {
return apiGet<WorkerListResponse<WorkerFinanceRequest>>(
'/api/v1/worker/profile/finance-requests',
params,
)
}
export function createWorkerRechargeRequest(payload: {
amount?: number
note?: string
}) {
return apiPost<{ request: WorkerFinanceRequest }>(
'/api/v1/worker/profile/recharge-requests',
payload,
)
}
export function createWorkerWithdrawRequest(payload: {
amount?: number
accountChannel?: string
accountName?: string
accountNo?: string
note?: string
}) {
return apiPost<{ request: WorkerFinanceRequest }>(
'/api/v1/worker/profile/withdraw-requests',
payload,
)
}
export function changeWorkerPassword(payload: {
currentPassword: string
newPassword: string
}) {
return apiPost<{ worker: WorkerUser; reloginRequired: boolean }>(
'/api/v1/worker/profile/change-password',
payload,
)
}