Răsfoiți Sursa

@
feat: 前端适配安全发API — agreement_no + pageExecute HTML处理

- account.ts: create 增加 agreement_no 参数; transfer 响应字段 order_id/pay_fund_order_id
- index.vue: createForm 增加签约协议号输入框; handleCreate 传 agreement_no
- handleAuthorizeApply/handleDeposit: pageExecute 返回 HTML 改为 Blob URL 跳转
- TransferOutSchema: 新增 order_id/pay_fund_order_id,保留旧字段兼容
@

alphaH 2 zile în urmă
părinte
comite
762b04ab9d

+ 6 - 1
frontend/src/api/module_payment/account.ts

@@ -53,6 +53,7 @@ export const AccountAPI = {
 
   create(data: {
     enterprise_id: string;
+    agreement_no?: string;  // 安全发: 签约协议号
     account_type?: string;
     scene?: string;
     account_book_id?: string;
@@ -110,7 +111,7 @@ export const AccountAPI = {
     priority?: string;
     ext_info?: Record<string, any>;
   }) {
-    return request<ApiResponse<{ status: string; order_no?: string; fund_order_id?: string }>>({
+    return request<ApiResponse<{ status: string; order_id?: string; pay_fund_order_id?: string }>>({
       url: `${API_PATH}/transfer`,
       method: "post",
       data,
@@ -238,7 +239,11 @@ export interface TransferOutSchema {
     bankcard_ext_info?: any;
   };
   status?: string;
+  order_id?: string;
+  pay_fund_order_id?: string;
+  /** @deprecated 兼容旧字段 */
   order_no?: string;
+  /** @deprecated 兼容旧字段 */
   fund_order_id?: string;
   created_time?: string;
   updated_time?: string;

+ 15 - 6
frontend/src/views/module_payment/account/index.vue

@@ -76,6 +76,9 @@
                   <el-option label="企业信用" value="ENT_CREDIT" />
                 </el-select>
               </el-form-item>
+              <el-form-item label="签约协议号" prop="agreement_no">
+                <el-input v-model="createForm.agreement_no" placeholder="签约完成后粘贴协议号(选填)" />
+              </el-form-item>
               <el-form-item label="备注" prop="remark">
                 <el-input v-model="createForm.remark" type="textarea" placeholder="请输入备注" />
               </el-form-item>
@@ -779,6 +782,7 @@ const authorizeResult = reactive({
 
 const createForm = reactive({
   enterprise_id: "",
+  agreement_no: "",
   account_type: "ALL",
   scene: "B2B_TRANS",
   remark: "",
@@ -1235,9 +1239,11 @@ async function handleAuthorize() {
     const res = await AccountAPI.authorizeApply({
       enterprise_id: currentEnterpriseId.value!,
     });
-    authorizeResult.sign_url = res.data.data?.sign_url || "";
-    // 直接打开新窗口跳转
-    window.open(authorizeResult.sign_url, "_blank");
+    const signHtml = res.data.data?.sign_url || "";
+    authorizeResult.sign_url = signHtml;
+    // pageExecute 返回 HTML 表单,通过 Blob URL 跳转到支付宝签约页
+    const blob = new Blob([signHtml], { type: "text/html" });
+    window.open(URL.createObjectURL(blob), "_blank");
   } finally {
     authorizeLoading.value = false;
   }
@@ -1278,6 +1284,7 @@ async function handleCreate() {
   try {
     const res = await AccountAPI.create({
       enterprise_id: currentEnterpriseId.value!,
+      agreement_no: createForm.agreement_no || undefined,
       account_type: "ALL",
       scene: "B2B_TRANS",
       remark: "",
@@ -1314,9 +1321,11 @@ async function handleDeposit() {
           amount: depositForm.amount,
           remark: depositForm.remark,
         });
-        depositResult.url = res.data.data?.url || "";
-        // 直接打开新窗口跳转
-        window.open(depositResult.url, "_blank");
+        const depositHtml = res.data.data?.url || "";
+        depositResult.url = depositHtml;
+        // pageExecute 返回 HTML 表单,通过 Blob URL 跳转到支付宝充值页
+        const blob = new Blob([depositHtml], { type: "text/html" });
+        window.open(URL.createObjectURL(blob), "_blank");
       } finally {
         depositLoading.value = false;
       }