wallet.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. * Wallet / Recharge API module
  3. * 钱包充值配置等相关接口
  4. */
  5. import { http } from '~/utils/request'
  6. import type { NextVOWalletRecordVo, ResultVOString, WalletRechargeConfigVO, WalletRechargeOrderStateVo, WalletRecordDTO, WalletWithdrawApplyDTO, WalletWithdrawCalculateVo, WalletWithdrawInfoVo, WalletWithdrawRealNameAuthDTO, WalletWithdrawRealInfoAuthApplyVo, WalletWithdrawRealInfoAuthStatusVo } from '~/types/api'
  7. export const walletApi = {
  8. /**
  9. * 获取浏览器端钱包充值配置
  10. * 对应后端接口:POST /wallet/recharge/browser/goldCoin/config
  11. */
  12. getRechargeConfig() {
  13. return http.post<WalletRechargeConfigVO>('/wallet/recharge/browser/goldCoin/config')
  14. },
  15. /**
  16. * 提交浏览器端钱包充值
  17. * 对应后端接口:POST /wallet/recharge/browser/submit
  18. * @param id 充值档位 ID(后端返回的 items.id)
  19. */
  20. submitRecharge(id: string, uri: string) {
  21. return http.post<ResultVOString>('/wallet/recharge/browser/submit', { id, uri })
  22. },
  23. /**
  24. * 查询充值订单状态
  25. * 对应后端接口:POST /wallet/recharge/checkOrderState
  26. * @param orderNo 订单号(后端接口字段为 id)
  27. */
  28. checkRechargeOrderState(orderNo: string) {
  29. return http.post<WalletRechargeOrderStateVo>('/wallet/recharge/checkOrderState', { id: orderNo })
  30. },
  31. /**
  32. * 钱包流水-金币
  33. * 对应后端接口:POST /wallet/record/goldCoin
  34. */
  35. recordGoldCoin(data: WalletRecordDTO) {
  36. return http.post<NextVOWalletRecordVo>('/wallet/record/goldCoin', data)
  37. },
  38. /**
  39. * 钱包流水-钻石
  40. * 对应后端接口:POST /wallet/record/diamond
  41. */
  42. recordDiamond(data: WalletRecordDTO) {
  43. return http.post<NextVOWalletRecordVo>('/wallet/record/diamond', data)
  44. },
  45. /**
  46. * 钱包流水-金豆
  47. * 对应后端接口:POST /wallet/record/bean
  48. */
  49. recordBean(data: WalletRecordDTO) {
  50. return http.post<NextVOWalletRecordVo>('/wallet/record/bean', data)
  51. },
  52. /**
  53. * 提现实名认证
  54. * 对应后端接口:POST /wallet/withdraw/realNameAuth
  55. * @param data 身份证和银行卡信息
  56. */
  57. submitWithdrawRealNameAuth(data: WalletWithdrawRealNameAuthDTO) {
  58. return http.post<WalletWithdrawRealInfoAuthApplyVo>('/wallet/withdraw/realNameAuth', data)
  59. },
  60. /**
  61. * 获得提现实名认证状态
  62. * 对应后端接口:POST /wallet/withdraw/getRealNameAuthStatus
  63. */
  64. getWithdrawRealNameAuthStatus() {
  65. return http.post<WalletWithdrawRealInfoAuthStatusVo>('/wallet/withdraw/getRealNameAuthStatus')
  66. },
  67. /**
  68. * 获取金豆提现信息
  69. * 对应后端接口:POST /wallet/withdraw/info
  70. * 按后端要求使用 application/x-www-form-urlencoded
  71. */
  72. getWithdrawInfo() {
  73. return http.post<WalletWithdrawInfoVo>('/wallet/withdraw/info')
  74. },
  75. /**
  76. * 金豆提现计算
  77. * 对应后端接口:POST /wallet/withdraw/calculate
  78. */
  79. withdrawCalculate(amount: number) {
  80. return http.post<WalletWithdrawCalculateVo>('/wallet/withdraw/calculate', { amount })
  81. },
  82. /**
  83. * 金豆提现申请提交
  84. * 对应后端接口:POST /wallet/withdraw/submit
  85. */
  86. withdrawSubmit(data: WalletWithdrawApplyDTO) {
  87. return http.post<Record<string, never>>('/wallet/withdraw/submit', data)
  88. },
  89. }