Files
cpms_operation_platform/src/api/withdraw/index.ts
T

57 lines
1.9 KiB
TypeScript
Raw Normal View History

/**
* 提现管理 API
* 对应 OpenAPI: GET /admin/finance/withdraw/page, GET /admin/finance/withdraw/info
*/
import { get, post } from '@/utils/request';
import { USE_MOCK, MOCK_DELAY } from '@/config/mock';
import { buildMockWithdrawPage } from '@/config/mock/withdrawList';
import { buildMockWithdrawInfo } from '@/config/mock/withdrawInfo';
import type { WithdrawQueryParams, WithdrawVO, WithdrawInfoVO, PageData, ApiResult } from './types';
export type { WithdrawVO, WithdrawInfoVO, WithdrawQueryParams, PageData, ApiResult } from './types';
const delay = (ms: number) => new Promise<void>((r) => setTimeout(r, ms));
2026-07-31 18:15:24 +08:00
/** GET /finance/withdraw/page — 提现列表分页 */
export async function getWithdrawList(
params: WithdrawQueryParams,
): Promise<ApiResult<PageData<WithdrawVO>>> {
if (USE_MOCK) {
await delay(MOCK_DELAY);
const page = Number(params.page) || 1;
const limit = Number(params.limit) || 10;
return {
code: 200,
msg: 'success',
data: buildMockWithdrawPage(page, limit, params),
};
}
2026-07-31 18:15:24 +08:00
return get('/finance/withdraw/page', params as Record<string, any>);
}
2026-07-31 18:15:24 +08:00
/** GET /finance/withdraw/info?id=xxx — 提现详情 */
export async function getWithdrawInfo(id: number): Promise<ApiResult<WithdrawInfoVO>> {
if (USE_MOCK) {
await delay(MOCK_DELAY);
return { code: 200, msg: 'success', data: buildMockWithdrawInfo(id) };
}
2026-07-31 18:15:24 +08:00
return get('/finance/withdraw/info', { id: String(id) });
}
/** 提现审核请求参数 */
export interface WithdrawAuditParams {
/** 提现ID */
id: string;
/** 审核结果:1=通过,2=驳回 */
audit: string;
/** 审核内容 */
checkMsg: string;
/** 审核图片(逗号拼接的 URL) */
checkImg: string;
}
2026-07-31 18:15:24 +08:00
/** POST /finance/withdraw/audit — 审核提现 */
export async function postWithdrawAudit(params: WithdrawAuditParams): Promise<ApiResult<null>> {
2026-07-31 18:15:24 +08:00
return post('/finance/withdraw/audit', params);
}