account.ts 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. import request from "@/utils/request";
  2. const API_PATH = "/payment/account";
  3. export const AccountAPI = {
  4. statAmount(tenantId?: number, enterpriseId?: string, payeeType?: string) {
  5. return request<
  6. ApiResponse<{ amount_of_today: string; amount_of_7days: string; amount_of_all: string }>
  7. >({
  8. url: `${API_PATH}/stat/transfer/amount`,
  9. method: "get",
  10. params: { tenant_id: tenantId, enterprise_id: enterpriseId, payee_type: payeeType },
  11. });
  12. },
  13. statConsumeAmount(tenantId?: number, enterpriseId?: string) {
  14. return request<
  15. ApiResponse<{ amount_of_today: string; amount_of_7days: string; amount_of_all: string }>
  16. >({
  17. url: `${API_PATH}/stat/consume/amount`,
  18. method: "get",
  19. params: { tenant_id: tenantId, enterprise_id: enterpriseId },
  20. });
  21. },
  22. statSummaryAmount(tenantId?: number, enterpriseId?: string, payeeType?: string) {
  23. return request<
  24. ApiResponse<{ amount_of_today: string; amount_of_7days: string; amount_of_all: string }>
  25. >({
  26. url: `${API_PATH}/stat/summary/amount`,
  27. method: "get",
  28. params: { tenant_id: tenantId, enterprise_id: enterpriseId, payee_type: payeeType },
  29. });
  30. },
  31. statF2fTradeAmount(tenantId?: number, enterpriseId?: string) {
  32. return request<
  33. ApiResponse<{ amount_of_today: string; amount_of_7days: string; amount_of_all: string }>
  34. >({
  35. url: `${API_PATH}/stat/f2f/amount`,
  36. method: "get",
  37. params: { tenant_id: tenantId, enterprise_id: enterpriseId },
  38. });
  39. },
  40. authorizeApply(data: { enterprise_id: string; sign_scene?: string }) {
  41. return request<ApiResponse<{ sign_url: string; external_agreement_no: string }>>({
  42. url: `${API_PATH}/authorize/apply`,
  43. method: "post",
  44. data,
  45. });
  46. },
  47. queryAgreement(enterpriseId: string, externalAgreementNo: string, signScene: string) {
  48. return request<ApiResponse<{ agreement_no: string; status: string }>>({
  49. url: `${API_PATH}/agreement/query`,
  50. method: "get",
  51. params: { enterprise_id: enterpriseId, external_agreement_no: externalAgreementNo, sign_scene: signScene },
  52. });
  53. },
  54. create(data: {
  55. enterprise_id: string;
  56. agreement_no?: string; // 安全发: 签约协议号
  57. account_type?: string;
  58. scene?: string;
  59. account_book_id?: string;
  60. remark?: string;
  61. }) {
  62. return request<ApiResponse<{ enterprise_id: string; account_book_id: string }>>({
  63. url: `${API_PATH}`,
  64. method: "post",
  65. data,
  66. });
  67. },
  68. query(enterpriseId: string) {
  69. return request<ApiResponse<any[]>>({
  70. url: `${API_PATH}/query/${enterpriseId}`,
  71. method: "get",
  72. });
  73. },
  74. deposit(data: {
  75. enterprise_id: string;
  76. account_book_id: string;
  77. amount: number;
  78. out_biz_no?: string;
  79. remark?: string;
  80. }) {
  81. return request<ApiResponse<{ url: string }>>({
  82. url: `${API_PATH}/deposit`,
  83. method: "post",
  84. data,
  85. });
  86. },
  87. transfer(data: {
  88. enterprise_id: string;
  89. account_book_id?: string;
  90. out_biz_no?: string;
  91. amount: number;
  92. order_title?: string;
  93. remark?: string;
  94. payee_info: {
  95. identity_type: string;
  96. name: string;
  97. identity: string;
  98. bankcard_ext_info?: {
  99. account_type: string;
  100. inst_name?: string;
  101. inst_province?: string;
  102. inst_city?: string;
  103. inst_branch_name?: string;
  104. bank_code?: string;
  105. };
  106. };
  107. employee_id?: string;
  108. priority?: string;
  109. ext_info?: Record<string, any>;
  110. }) {
  111. return request<ApiResponse<{ status: string; order_id?: string; pay_fund_order_id?: string }>>({
  112. url: `${API_PATH}/transfer`,
  113. method: "post",
  114. data,
  115. });
  116. },
  117. transferDetail(outBizNo: string) {
  118. return request<ApiResponse<TransferOutSchema>>({
  119. url: `${API_PATH}/transfer/${outBizNo}`,
  120. method: "get",
  121. });
  122. },
  123. transferList(params: {
  124. page_no?: number;
  125. page_size?: number;
  126. out_biz_no?: string;
  127. status?: string;
  128. tenant_id?: number;
  129. enterprise_id?: string;
  130. }) {
  131. return request<ApiResponse<TransferListResp>>({
  132. url: `${API_PATH}/transfer`,
  133. method: "get",
  134. params,
  135. });
  136. },
  137. consumeList(params: {
  138. page_no?: number;
  139. page_size?: number;
  140. tenant_id?: number;
  141. enterprise_id?: string;
  142. employee_id?: string;
  143. consume_type?: string;
  144. status?: string;
  145. start_time?: string;
  146. end_time?: string;
  147. }) {
  148. return request<ApiResponse<PageResult<ConsumeVO[]>>>({
  149. url: `${API_PATH}/consume-list`,
  150. method: "get",
  151. params,
  152. });
  153. },
  154. consumeDetail(params: {
  155. pay_no: string;
  156. enterprise_id?: string;
  157. ant_shop_id?: string;
  158. query_options?: string[];
  159. }) {
  160. return request<ApiResponse<any>>({
  161. url: `${API_PATH}/consume-detail`,
  162. method: "get",
  163. params,
  164. });
  165. },
  166. exportTransferReport(params: {
  167. start_time: string;
  168. end_time: string;
  169. enterprise_id?: string;
  170. }) {
  171. return request({
  172. url: `${API_PATH}/transfer/export`,
  173. method: "get",
  174. params,
  175. responseType: "blob",
  176. });
  177. },
  178. downloadReceipt(params: {
  179. enterprise_id: string;
  180. order_no: string;
  181. }) {
  182. return request<ApiResponse<ReceiptQueryOutSchema>>({
  183. url: `${API_PATH}/receipt/download`,
  184. method: "get",
  185. params,
  186. });
  187. },
  188. queryReceipt(params: {
  189. enterprise_id: string;
  190. file_id: string;
  191. }) {
  192. return request<ApiResponse<ReceiptQueryOutSchema>>({
  193. url: `${API_PATH}/receipt/${params.enterprise_id}/${params.file_id}`,
  194. method: "get",
  195. });
  196. },
  197. withdraw(data: {
  198. enterprise_id: string;
  199. account_book_id: string;
  200. amount: number;
  201. remark?: string;
  202. }) {
  203. return request<ApiResponse>({
  204. url: `${API_PATH}/withdraw`,
  205. method: "post",
  206. data,
  207. });
  208. },
  209. };
  210. export interface ReceiptQueryOutSchema {
  211. file_id: string;
  212. status: string;
  213. download_url?: string;
  214. error_message?: string;
  215. }
  216. export interface TransferOutSchema {
  217. out_biz_no?: string;
  218. enterprise_id?: string;
  219. account_book_id?: string;
  220. amount?: string;
  221. order_title?: string;
  222. payee_info?: {
  223. identity_type: string;
  224. name: string;
  225. identity: string;
  226. bankcard_ext_info?: any;
  227. };
  228. status?: string;
  229. order_id?: string;
  230. pay_fund_order_id?: string;
  231. /** @deprecated 兼容旧字段 */
  232. order_no?: string;
  233. /** @deprecated 兼容旧字段 */
  234. fund_order_id?: string;
  235. created_time?: string;
  236. updated_time?: string;
  237. }
  238. export interface TransferListResp {
  239. total: number;
  240. items: TransferOutSchema[];
  241. }
  242. export interface ConsumeVO {
  243. id: number;
  244. tenant_id: number;
  245. enterprise_id: string;
  246. employee_id: string;
  247. pay_no: string;
  248. account_id: string;
  249. consume_type: string;
  250. consume_amount: string;
  251. gmt_biz_create: string;
  252. gmt_recieve_pay: string;
  253. peer_pay_amount: string;
  254. status: string;
  255. expense_scene_code: string;
  256. expense_type: string;
  257. created_time: string;
  258. updated_time: string;
  259. }
  260. export interface ConsumeDetailSchema {
  261. pay_no?: string;
  262. enterprise_id?: string;
  263. amount?: string;
  264. status?: string;
  265. created_time?: string;
  266. pay_type?: string;
  267. payee_info?: any;
  268. refund_info?: any;
  269. order_info?: any;
  270. ticket_info?: any;
  271. }
  272. export default AccountAPI;