Преглед на файлове

feat: 批量API层账号级 - /payment/batch 路径、去企业ID、主体参数

alphaH преди 4 дни
родител
ревизия
356e7c80cd
променени са 1 файла, в които са добавени 30 реда и са изтрити 26 реда
  1. 30 26
      frontend/src/api/module_payment/batch.ts

+ 30 - 26
frontend/src/api/module_payment/batch.ts

@@ -1,15 +1,20 @@
 import request from "@/utils/request";
 
-const API_PATH = "/payment/account/batch";
+const API_PATH = "/payment/batch";
 
 /** 制单授权记录(后端 BatchAuthorizeEntity,全局 SNAKE_CASE 序列化) */
 export interface BatchAuthorizeVO {
+  id?: number;
   out_biz_no: string;
   status: string;
   agreement_no?: string;
   authorize_link?: string;
   participant_id: string;
   participant_id_type?: string;
+  /** 主体名称(表单录入,同时作为授权申请 principal_info.name) */
+  participant_name?: string;
+  /** 服务商(表单下拉选择,授权申请 client 解析依据) */
+  service_provider_id?: number;
   authorize_expire_time?: string;
   created_time?: string;
 }
@@ -34,11 +39,10 @@ export interface BatchOrderVO {
   total_amount: string;
   total_count: number;
   order_title?: string;
-  /** INIT / SUCCESS / DISUSE / FAIL */
+  /** INIT=受理中 / WAIT_PAY=等待支付 / SUCCESS=成功 / DISUSE=已关闭 / FAIL=失败 / INVALID=无效 */
   status: string;
   created_time?: string;
   pay_url?: string;
-  enterprise_id?: string;
   payer_uid?: string;
   agreement_no?: string;
   transfer_scene_name?: string;
@@ -62,9 +66,10 @@ export interface BatchDetailItem {
   error_msg?: string;
 }
 
-/** 创建批次请求体(BatchCreateDTO,snake_case;付款方恒为企业自身 UID、协议号自动带出,均不接受客户端指定) */
+/** 创建批次请求体(BatchCreateDTO,snake_case;付款方恒为已授权主体、协议号自动带出,均不接受客户端指定) */
 export interface BatchCreateParams {
-  enterprise_id?: string;
+  /** 付款主体(授权主体支付宝 uid,制单时从已授权主体选择) */
+  participant_id: string;
   order_title: string;
   transfer_scene_name?: string;
   transfer_scene_report_infos?: Array<{ info_type: string; info_content: string }>;
@@ -74,35 +79,35 @@ export interface BatchCreateParams {
 }
 
 export const BatchPayAPI = {
-  /** 生成制单授权链接(PC 渠道,付款方恒为企业自身 UID,后端不接受指定) */
-  authorizeApply(enterpriseId: string) {
+  /** 生成制单授权链接(账号级: 主体信息来自表单,服务商下拉选择) */
+  authorizeApply(data: { participant_name: string; participant_id: string; service_provider_id: number }) {
     return request<ApiResponse<{ authorize_link: string; out_biz_no: string; status: string }>>({
       url: `${API_PATH}/authorize/apply`,
       method: "post",
-      data: { enterprise_id: enterpriseId },
+      data,
     });
   },
 
   /** 制单授权重新生成:作废当前 AUTHING 申请(旧链接失效),换新 out_biz_no 重新申请 */
-  authorizeRebind(enterpriseId: string) {
+  authorizeRebind(id: number) {
     return request<ApiResponse<{ authorize_link: string; out_biz_no: string; status: string }>>({
       url: `${API_PATH}/authorize/rebind`,
       method: "post",
-      data: { enterprise_id: enterpriseId },
+      data: { id },
     });
   },
 
   /** 查询制单授权状态(AUTHED 时回写协议号) */
-  queryAuthorize(enterpriseId: string, outBizNo: string) {
+  queryAuthorize(outBizNo: string) {
     return request<ApiResponse<{ agreement_no: string; status: string }>>({
       url: `${API_PATH}/authorize/query`,
       method: "get",
-      params: { enterprise_id: enterpriseId, out_biz_no: outBizNo },
+      params: { out_biz_no: outBizNo },
     });
   },
 
-  /** 制单授权记录(分页) */
-  authorizeList(params: { enterprise_id?: string; page_no?: number; page_size?: number }) {
+  /** 制单授权记录(分页,可按主体筛选) */
+  authorizeList(params: { participant_id?: string; page_no?: number; page_size?: number }) {
     return request<ApiResponse<BatchPageResult<BatchAuthorizeVO[]>>>({
       url: `${API_PATH}/authorize/list`,
       method: "get",
@@ -120,35 +125,35 @@ export const BatchPayAPI = {
   },
 
   /** 生成 PC 支付页面 — pageExecute 返回 HTML 表单(与充值/签约同款处理) */
-  renderPay(enterpriseId: string, outBatchNo: string) {
+  renderPay(outBatchNo: string) {
     return request<ApiResponse<{ pay_url: string }>>({
       url: `${API_PATH}/pay`,
       method: "post",
-      data: { enterprise_id: enterpriseId, out_batch_no: outBatchNo },
+      data: { out_batch_no: outBatchNo },
     });
   },
 
   /** 查询批次状态(同步支付宝并回写 DB) */
-  batchQuery(enterpriseId: string, outBatchNo: string) {
+  batchQuery(outBatchNo: string) {
     return request<ApiResponse<{ out_batch_no: string; status: string }>>({
       url: `${API_PATH}/query`,
       method: "get",
-      params: { enterprise_id: enterpriseId, out_batch_no: outBatchNo },
+      params: { out_batch_no: outBatchNo },
     });
   },
 
   /** 关闭未支付批次 */
-  batchClose(enterpriseId: string, outBatchNo: string) {
+  batchClose(outBatchNo: string) {
     return request<ApiResponse<{ status: string }>>({
       url: `${API_PATH}/close`,
       method: "post",
-      data: { enterprise_id: enterpriseId, out_batch_no: outBatchNo },
+      data: { out_batch_no: outBatchNo },
     });
   },
 
-  /** 批次列表(分页,状态/时间筛选) */
+  /** 批次列表(分页,主体/状态/时间筛选) */
   batchList(params: {
-    enterprise_id?: string;
+    participant_id?: string;
     status?: string;
     start_time?: string;
     end_time?: string;
@@ -162,13 +167,12 @@ export const BatchPayAPI = {
     });
   },
 
-  /** 批次详情 + 明细分页(后端要求 enterprise_id 租户隔离) */
-  batchDetail(enterpriseId: string, outBatchNo: string, pageNo = 1, pageSize = 20) {
+  /** 批次详情 + 明细分页(租户隔离由后端拦截器自动追加) */
+  batchDetail(outBatchNo: string, pageNo = 1, pageSize = 20) {
     return request<ApiResponse<{ order: BatchOrderVO; details: BatchPageResult<BatchDetailItem[]> }>>({
       url: `${API_PATH}/detail`,
       method: "get",
       params: {
-        enterprise_id: enterpriseId,
         out_batch_no: outBatchNo,
         page_no: pageNo,
         page_size: pageSize,
@@ -178,7 +182,7 @@ export const BatchPayAPI = {
 
   /** 批次报表导出(xlsx 下载,接口直出字节流非 Result 包装) */
   batchExport(params: {
-    enterprise_id?: string;
+    participant_id?: string;
     status?: string;
     start_time?: string;
     end_time?: string;