account.ts 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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 }) {
  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. // ========== 进件 ==========
  48. uploadImage(file: File, enterpriseId: string) {
  49. const fd = new FormData();
  50. fd.append("file", file);
  51. fd.append("enterprise_id", enterpriseId);
  52. return request<ApiResponse<{ image_id: string }>>({
  53. url: `${API_PATH}/onboard/upload`,
  54. method: "post",
  55. data: fd,
  56. headers: { "Content-Type": "multipart/form-data" },
  57. });
  58. },
  59. createOnboard(data: {
  60. enterprise_id: string;
  61. scene_directions: string;
  62. scene_image: string;
  63. sites?: string;
  64. }) {
  65. return request<ApiResponse<{ order_id: string; out_biz_no: string; status: string }>>({
  66. url: `${API_PATH}/onboard/create`,
  67. method: "post",
  68. data,
  69. });
  70. },
  71. queryOnboard(enterpriseId: string, orderId: string) {
  72. return request<ApiResponse<{ order_id: string; status: string }>>({
  73. url: `${API_PATH}/onboard/query`,
  74. method: "get",
  75. params: { enterprise_id: enterpriseId, order_id: orderId },
  76. });
  77. },
  78. cancelOnboard(data: { enterprise_id: string; order_id: string }) {
  79. return request<ApiResponse>({
  80. url: `${API_PATH}/onboard/cancel`,
  81. method: "post",
  82. data,
  83. });
  84. },
  85. // ========== 签约查询 ==========
  86. queryAgreement(enterpriseId: string, externalAgreementNo: string) {
  87. return request<ApiResponse<{ agreement_no: string; status: string }>>({
  88. url: `${API_PATH}/agreement/query`,
  89. method: "get",
  90. params: { enterprise_id: enterpriseId, external_agreement_no: externalAgreementNo },
  91. });
  92. },
  93. create(data: {
  94. enterprise_id: string;
  95. agreement_no?: string; // 安全发: 签约协议号
  96. account_type?: string;
  97. scene?: string;
  98. account_book_id?: string;
  99. remark?: string;
  100. }) {
  101. return request<ApiResponse<{ enterprise_id: string; account_book_id: string }>>({
  102. url: `${API_PATH}`,
  103. method: "post",
  104. data,
  105. });
  106. },
  107. query(enterpriseId: string) {
  108. return request<ApiResponse<any[]>>({
  109. url: `${API_PATH}/query/${enterpriseId}`,
  110. method: "get",
  111. });
  112. },
  113. deposit(data: {
  114. enterprise_id: string;
  115. account_book_id: string;
  116. amount: number;
  117. out_biz_no?: string;
  118. remark?: string;
  119. }) {
  120. return request<ApiResponse<{ url: string }>>({
  121. url: `${API_PATH}/deposit`,
  122. method: "post",
  123. data,
  124. });
  125. },
  126. transfer(data: {
  127. enterprise_id: string;
  128. account_book_id?: string;
  129. out_biz_no?: string;
  130. amount: number;
  131. order_title?: string;
  132. remark?: string;
  133. payee_info: {
  134. identity_type: string;
  135. name: string;
  136. identity: string;
  137. bankcard_ext_info?: {
  138. account_type: string;
  139. inst_name?: string;
  140. inst_province?: string;
  141. inst_city?: string;
  142. inst_branch_name?: string;
  143. bank_code?: string;
  144. };
  145. };
  146. employee_id?: string;
  147. priority?: string;
  148. ext_info?: Record<string, any>;
  149. }) {
  150. return request<ApiResponse<{ status: string; order_id?: string; pay_fund_order_id?: string }>>({
  151. url: `${API_PATH}/transfer`,
  152. method: "post",
  153. data,
  154. });
  155. },
  156. transferDetail(outBizNo: string) {
  157. return request<ApiResponse<TransferOutSchema>>({
  158. url: `${API_PATH}/transfer/${outBizNo}`,
  159. method: "get",
  160. });
  161. },
  162. transferList(params: {
  163. page_no?: number;
  164. page_size?: number;
  165. out_biz_no?: string;
  166. status?: string;
  167. tenant_id?: number;
  168. enterprise_id?: string;
  169. }) {
  170. return request<ApiResponse<TransferListResp>>({
  171. url: `${API_PATH}/transfer`,
  172. method: "get",
  173. params,
  174. });
  175. },
  176. consumeList(params: {
  177. page_no?: number;
  178. page_size?: number;
  179. tenant_id?: number;
  180. enterprise_id?: string;
  181. employee_id?: string;
  182. consume_type?: string;
  183. status?: string;
  184. start_time?: string;
  185. end_time?: string;
  186. }) {
  187. return request<ApiResponse<PageResult<ConsumeVO[]>>>({
  188. url: `${API_PATH}/consume-list`,
  189. method: "get",
  190. params,
  191. });
  192. },
  193. consumeDetail(params: {
  194. pay_no: string;
  195. enterprise_id?: string;
  196. ant_shop_id?: string;
  197. query_options?: string[];
  198. }) {
  199. return request<ApiResponse<any>>({
  200. url: `${API_PATH}/consume-detail`,
  201. method: "get",
  202. params,
  203. });
  204. },
  205. exportTransferReport(params: {
  206. start_time: string;
  207. end_time: string;
  208. enterprise_id?: string;
  209. }) {
  210. return request({
  211. url: `${API_PATH}/transfer/export`,
  212. method: "get",
  213. params,
  214. responseType: "blob",
  215. });
  216. },
  217. downloadReceipt(params: {
  218. enterprise_id: string;
  219. order_no: string;
  220. }) {
  221. return request<ApiResponse<ReceiptQueryOutSchema>>({
  222. url: `${API_PATH}/receipt/download`,
  223. method: "get",
  224. params,
  225. });
  226. },
  227. queryReceipt(params: {
  228. enterprise_id: string;
  229. file_id: string;
  230. }) {
  231. return request<ApiResponse<ReceiptQueryOutSchema>>({
  232. url: `${API_PATH}/receipt/${params.enterprise_id}/${params.file_id}`,
  233. method: "get",
  234. });
  235. },
  236. withdraw(data: {
  237. enterprise_id: string;
  238. account_book_id: string;
  239. amount: number;
  240. remark?: string;
  241. }) {
  242. return request<ApiResponse>({
  243. url: `${API_PATH}/withdraw`,
  244. method: "post",
  245. data,
  246. });
  247. },
  248. };
  249. export interface ReceiptQueryOutSchema {
  250. file_id: string;
  251. status: string;
  252. download_url?: string;
  253. error_message?: string;
  254. }
  255. export interface TransferOutSchema {
  256. out_biz_no?: string;
  257. enterprise_id?: string;
  258. account_book_id?: string;
  259. amount?: string;
  260. order_title?: string;
  261. payee_info?: {
  262. identity_type: string;
  263. name: string;
  264. identity: string;
  265. bankcard_ext_info?: any;
  266. };
  267. status?: string;
  268. order_id?: string;
  269. pay_fund_order_id?: string;
  270. /** @deprecated 兼容旧字段 */
  271. order_no?: string;
  272. /** @deprecated 兼容旧字段 */
  273. fund_order_id?: string;
  274. created_time?: string;
  275. updated_time?: string;
  276. }
  277. export interface TransferListResp {
  278. total: number;
  279. items: TransferOutSchema[];
  280. }
  281. export interface ConsumeVO {
  282. id: number;
  283. tenant_id: number;
  284. enterprise_id: string;
  285. employee_id: string;
  286. pay_no: string;
  287. account_id: string;
  288. consume_type: string;
  289. consume_amount: string;
  290. gmt_biz_create: string;
  291. gmt_recieve_pay: string;
  292. peer_pay_amount: string;
  293. status: string;
  294. expense_scene_code: string;
  295. expense_type: string;
  296. created_time: string;
  297. updated_time: string;
  298. }
  299. export interface ConsumeDetailSchema {
  300. pay_no?: string;
  301. enterprise_id?: string;
  302. amount?: string;
  303. status?: string;
  304. created_time?: string;
  305. pay_type?: string;
  306. payee_info?: any;
  307. refund_info?: any;
  308. order_info?: any;
  309. ticket_info?: any;
  310. }
  311. export default AccountAPI;