48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
|
|
import api, { unwrap, PageResponse } from './request';
|
||
|
|
|
||
|
|
export interface WithdrawResp extends Record<string, unknown> {
|
||
|
|
requestId: number;
|
||
|
|
settleMasterId?: number;
|
||
|
|
settleMonth?: string;
|
||
|
|
agentId: number;
|
||
|
|
agentName?: string;
|
||
|
|
amount: number;
|
||
|
|
bankCode?: string;
|
||
|
|
accountNo?: string;
|
||
|
|
status: string;
|
||
|
|
statusName?: string;
|
||
|
|
requestedAt?: string;
|
||
|
|
sentAt?: string;
|
||
|
|
completedAt?: string;
|
||
|
|
failReason?: string;
|
||
|
|
transferTxId?: string;
|
||
|
|
transferStatus?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface WithdrawSearchParam {
|
||
|
|
agentId?: number;
|
||
|
|
settleMasterId?: number;
|
||
|
|
pageNum?: number;
|
||
|
|
pageSize?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface WithdrawSaveReq {
|
||
|
|
settleMasterId: number;
|
||
|
|
agentId: number;
|
||
|
|
amount: number;
|
||
|
|
requestedBy: number;
|
||
|
|
bankCode: string;
|
||
|
|
accountNo: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const withdrawApi = {
|
||
|
|
list: (params: WithdrawSearchParam = {}) =>
|
||
|
|
unwrap<PageResponse<WithdrawResp>>(api.get('/api/withdraw-requests', { params })),
|
||
|
|
detail: (id: number) =>
|
||
|
|
unwrap<WithdrawResp>(api.get(`/api/withdraw-requests/${id}`)),
|
||
|
|
create: (req: WithdrawSaveReq) =>
|
||
|
|
unwrap<number>(api.post('/api/withdraw-requests', req)),
|
||
|
|
cancel: (id: number) =>
|
||
|
|
unwrap<void>(api.post(`/api/withdraw-requests/${id}/cancel`, {})),
|
||
|
|
};
|