money.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import { defHttp } from '/@/utils/http/axios';
  2. import {
  3. GetTypeListModel,
  4. DeleteBatchesParams,
  5. TypeIdParams,
  6. AddTypeParams,
  7. EditTypeParams,
  8. GetAccountListModel,
  9. GetTypeModel,
  10. GetAccountModel,
  11. AccountIdParams,
  12. AddAccountParams,
  13. EditAccountParams,
  14. } from './model/moneyModel';
  15. enum Api {
  16. TypeUrl = '/money/type',
  17. AccountUrl = '/money/account',
  18. }
  19. /**
  20. * @description: GetTypeList
  21. */
  22. export function getTypeList(params) {
  23. console.log('-------------------getTypeList---------------');
  24. return defHttp.request<GetTypeListModel>({
  25. url: Api.TypeUrl,
  26. method: 'GET',
  27. params,
  28. });
  29. }
  30. /**
  31. * @description: addType
  32. */
  33. export function addType(params: AddTypeParams) {
  34. return defHttp.request<GetTypeListModel>({
  35. url: Api.TypeUrl,
  36. method: 'POST',
  37. params,
  38. });
  39. }
  40. /**
  41. * @description: 批量删除交易类型
  42. */
  43. export function deleteBatchesType(params: DeleteBatchesParams) {
  44. return defHttp.request<GetTypeListModel>({
  45. url: Api.TypeUrl,
  46. method: 'DELETE',
  47. params,
  48. });
  49. }
  50. /**
  51. * @description: 获取单个交易类型
  52. */
  53. export function getType(params: TypeIdParams) {
  54. return defHttp.request<GetTypeModel>({
  55. url: Api.TypeUrl + '/' + params.id,
  56. method: 'GET',
  57. });
  58. }
  59. /**
  60. * @description: 修改单个交易类型
  61. */
  62. export function editType(params: EditTypeParams) {
  63. return defHttp.request<GetTypeListModel>({
  64. url: Api.TypeUrl + '/' + params.id,
  65. method: 'PUT',
  66. params,
  67. });
  68. }
  69. /**
  70. * @description: 删除单个会员
  71. */
  72. export function deleteType(params: TypeIdParams) {
  73. return defHttp.request<GetTypeListModel>({
  74. url: Api.TypeUrl + '/' + params.id,
  75. method: 'DELETE',
  76. });
  77. }
  78. /**
  79. * @description: GetAccountList -----------------------------------------------
  80. */
  81. export function getAccountList(params) {
  82. console.log('-------------------getAccountList---------------');
  83. return defHttp.request<GetAccountListModel>({
  84. url: Api.AccountUrl,
  85. method: 'GET',
  86. params,
  87. });
  88. }
  89. /**
  90. * @description: addAccount
  91. */
  92. export function addAccount(params: AddAccountParams) {
  93. return defHttp.request<GetAccountListModel>({
  94. url: Api.AccountUrl,
  95. method: 'POST',
  96. params,
  97. });
  98. }
  99. /**
  100. * @description: 批量删除账户
  101. */
  102. export function deleteBatchesAccount(params: DeleteBatchesParams) {
  103. return defHttp.request<GetAccountListModel>({
  104. url: Api.AccountUrl,
  105. method: 'DELETE',
  106. params,
  107. });
  108. }
  109. /**
  110. * @description: 获取单个账户
  111. */
  112. export function getAccount(params: AccountIdParams) {
  113. return defHttp.request<GetAccountModel>({
  114. url: Api.AccountUrl + '/' + params.id,
  115. method: 'GET',
  116. });
  117. }
  118. /**
  119. * @description: 修改单个账户
  120. */
  121. export function editAccount(params: EditAccountParams) {
  122. return defHttp.request<GetAccountListModel>({
  123. url: Api.AccountUrl + '/' + params.id,
  124. method: 'PUT',
  125. params,
  126. });
  127. }
  128. /**
  129. * @description: 删除单个账户
  130. */
  131. export function deleteAccount(params: AccountIdParams) {
  132. return defHttp.request<GetAccountListModel>({
  133. url: Api.AccountUrl + '/' + params.id,
  134. method: 'DELETE',
  135. });
  136. }