| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-02-22 12:02:55 |
| 4 | * @LastEditTime: 2025-03-02 23:00:49 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: 财务 |
| 7 | */ |
| 8 | import http from './request'; |
| 9 | import { Pagination } from './types'; |
| 10 | import { UserWalletRecord } from './types/finance'; |
| 11 | import { |
| 12 | CreateUserWalletAccountParams, |
| 13 | UserWallet, |
| 14 | UserWalletAccount, |
| 15 | } from './types/userWalletAccount'; |
| 16 | |
| 17 | export const financeApi = { |
| 18 | // --------- userWalletAccount STR --------- |
| 19 | |
| 20 | /** |
| 21 | * 获取验证码 |
| 22 | */ |
| 23 | getWalletAccountCode(phone: string) { |
| 24 | return http.post<string>( |
| 25 | `/finance/userWalletAccount/phoneCode/${phone}`, |
| 26 | {}, |
| 27 | { |
| 28 | isToken: true, |
| 29 | }, |
| 30 | ); |
| 31 | }, |
| 32 | |
| 33 | /** |
| 34 | * 创建用户钱包账户 |
| 35 | */ |
| 36 | createUserWalletAccount(data: CreateUserWalletAccountParams) { |
| 37 | return http.post<UserWalletAccount>('/finance/userWalletAccount', data, { |
| 38 | isToken: true, |
| 39 | }); |
| 40 | }, |
| 41 | |
| 42 | /** |
| 43 | * 获取用户钱包信息 |
| 44 | * @returns |
| 45 | */ |
| 46 | getUserWalletInfo() { |
| 47 | return http.get<UserWallet>(`/finance/userWallet/info`, { |
| 48 | isToken: true, |
| 49 | }); |
| 50 | }, |
| 51 | |
| 52 | /** |
| 53 | * 获取用户钱包账户列表 |
| 54 | * @returns |
| 55 | */ |
| 56 | getUserWalletAccountList() { |
| 57 | return http.get<UserWalletAccount[]>(`/finance/userWalletAccount/list`, { |
| 58 | isToken: true, |
| 59 | }); |
| 60 | }, |
| 61 | |
| 62 | /** |
| 63 | * 删除用户钱包账户 |
| 64 | */ |
| 65 | deleteUserWalletAccount(id: string) { |
| 66 | return http.delete<boolean>(`/finance/userWalletAccount/delete/${id}`); |
| 67 | }, |
| 68 | // --------- userWalletAccount END --------- |
| 69 | |
| 70 | // 创建用户提现记录-提交提现 |
| 71 | addUserWalletRecord(data: { |
| 72 | walletAccountId: string; // 钱包账户 |
| 73 | balance: number; |
| 74 | }) { |
| 75 | return http.post<Pagination<UserWalletRecord>>( |
| 76 | `/finance/userWalletRecord`, |
| 77 | data, |
| 78 | { |
| 79 | isToken: true, |
| 80 | }, |
| 81 | ); |
| 82 | }, |
| 83 | |
| 84 | // 提现记录 |
| 85 | getWithdrawList(params: { page: number; pageSize: number }) { |
| 86 | return http.get<Pagination<UserWalletRecord>>( |
| 87 | `/finance/userWalletRecord/list`, |
| 88 | { |
| 89 | isToken: true, |
| 90 | params, |
| 91 | }, |
| 92 | ); |
| 93 | }, |
| 94 | }; |
| 95 |