From 65fdfc6dd82f0bcf6c6826fe1ab645b309f6045c Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 23 十月 2025 19:37:06 +0800
Subject: [PATCH] fix: bug

---
 src/views/Home/Home.vue |  210 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 178 insertions(+), 32 deletions(-)

diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index 8f164ac..748ed15 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -18,7 +18,7 @@
           <QueryFilterItem>
             <FieldRadio
               v-model="extraParamState.insurancePeriod"
-              :value-enum="insuranceTypeText"
+              :value-enum="insuranceTypeTextForFilter"
               buttonStyle
               showAllBtn
               @change="getList()"
@@ -27,7 +27,7 @@
           <QueryFilterItem>
             <FieldRadio
               v-model="extraParamState.auditStatus"
-              :value-enum="InsurancePolicyAuditStatusEnumText"
+              :value-enum="InsurancePolicyAuditStatusEnumTextForFilter"
               buttonStyle
               showAllBtn
               @change="getList()"
@@ -113,6 +113,8 @@
     <UploadInsurePersonDialog v-bind="dialogProps" />
     <UploadStampFileDialog v-bind="dialogStampFileProps" />
     <InsureInstructionsDialog v-bind="dialogInstructionsProps" />
+    <InsureLineModeSelectDialog v-bind="dialogLineModeSelectProps" />
+    <DisbursementDialog v-bind="dialogDisbursementProps" />
   </LoadingLayout>
 </template>
 
@@ -134,8 +136,9 @@
   useDialog,
 } from '@bole-core/components';
 import * as insuranceOrderServices from '@/services/api/InsuranceOrder';
+import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
 import { Message, OrderInputType, downloadFileByUrl } from '@bole-core/core';
-import { columns } from './constants';
+import { columns, InsureLineMode } from './constants';
 import UploadInsurePersonDialog from './components/UploadInsurePersonDialog.vue';
 import UploadStampFileDialog from './components/UploadStampFileDialog.vue';
 import {
@@ -154,16 +157,21 @@
   InsurancePolicyStatusEnum,
   AppType,
   InsurancePolicyAuditStatusEnumText,
+  InsurancePolicyAuditStatusEnumTextForFilter,
   InsurancePolicyAuditStatusEnum,
   InsurancePolicyProductIdNumberEnum,
   InsurancePolicyListPayStatusEnum,
   InsurancePolicyListPayStatusEnumText,
   InsuranceOccupationTypeTempPath,
+  InsurancePeriodEnum,
+  insuranceTypeTextForFilter,
 } from '@/constants';
 import dayjs from 'dayjs';
 import _ from 'lodash';
 import InsureInstructionsDialog from './components/InsureInstructionsDialog.vue';
-import { useUserInsureProductSetting } from '@/hooks';
+import InsureLineModeSelectDialog from './components/InsureLineModeSelectDialog.vue';
+import DisbursementDialog from './components/DisbursementDialog.vue';
+import { useInsureProductSchemeAllList, useUserInsureProductSetting } from '@/hooks';
 // import { Recorder } from '@/utils/record';
 
 defineOptions({
@@ -189,8 +197,7 @@
       onClick: (role) => handleBatch(role),
     },
     extraProps: {
-      hide: (row: API.GetInsurancePageOutput) =>
-        row.productOnline || row.status !== InsurancePolicyStatusEnum.Effecting,
+      hide: (row: API.GetInsurancePageOutput) => row.status !== InsurancePolicyStatusEnum.Effecting,
     },
   },
   {
@@ -202,8 +209,16 @@
       onClick: (role) => handleUploadStampFile(role),
     },
     extraProps: {
-      hide: (row: API.GetInsurancePageOutput) =>
-        row.status !== InsurancePolicyStatusEnum.WaitEffect,
+      hide: (row: API.GetInsurancePageOutput) => {
+        if (row.productOnline) {
+          return (
+            row.auditStatus !== InsurancePolicyAuditStatusEnum.WaitAdd &&
+            row.auditStatus !== InsurancePolicyAuditStatusEnum.WaitAudit
+          );
+        } else {
+          return row.status !== InsurancePolicyStatusEnum.WaitEffect;
+        }
+      },
     },
   },
   {
@@ -218,19 +233,19 @@
       hide: (row: API.GetInsurancePageOutput) => row.productOnline || !row.insureBillUrl,
     },
   },
-  {
-    data: {
-      enCode: 'payBtn',
-      name: '鏀粯',
-    },
-    emits: {
-      onClick: (role) => handlePay(role),
-    },
-    extraProps: {
-      hide: (row: API.GetInsurancePageOutput) =>
-        row.payStatus != InsurancePolicyListPayStatusEnum.WaitPay,
-    },
-  },
+  // {
+  //   data: {
+  //     enCode: 'payBtn',
+  //     name: '鏀粯',
+  //   },
+  //   emits: {
+  //     onClick: (role) => handlePay(role),
+  //   },
+  //   extraProps: {
+  //     hide: (row: API.GetInsurancePageOutput) =>
+  //       row.payStatus != InsurancePolicyListPayStatusEnum.WaitPay,
+  //   },
+  // },
   {
     data: {
       enCode: 'stampFilesBtn',
@@ -265,6 +280,31 @@
   //     onClick: (role) => handleStandarEndo(role),
   //   },
   // },
+  {
+    data: {
+      enCode: 'submitAuditBtn',
+      name: '鎻愪氦瀹℃牳',
+    },
+    emits: {
+      onClick: (role) => handleSubmitAuditBtn(role),
+    },
+    extraProps: {
+      hide: (row: API.GetInsurancePageOutput) =>
+        row.auditStatus != InsurancePolicyAuditStatusEnum.WaitAdd,
+    },
+  },
+  {
+    data: {
+      enCode: 'applyTradeBySelfBtn',
+      name: '鍑鸿处鐢宠',
+    },
+    emits: {
+      onClick: (role) => handleParkBountyApplyTradeBySelf(role),
+    },
+    extraProps: {
+      hide: (row: API.GetInsurancePageOutput) => row.productOnline,
+    },
+  },
 ]).filter(Boolean);
 
 const BaseState = {
@@ -360,6 +400,8 @@
     productIdNumber: '',
     productSchemeIdNumber: '',
     effectStartTime: dayjs().add(1, 'day').format('YYYY-MM-DD'),
+    effectEndTime: '',
+    isOnLineInsurance: false,
   },
   closeAfterConfirm: false,
 });
@@ -376,13 +418,23 @@
     } else if (res === InsurancePolicyStatusEnum.OutTimeEffect) {
       await Message.tipMessage('璇ユ壒娆′繚鍗曞凡澶辨晥锛岃淇敼鎵规鍙峰悗閲嶆柊瀵煎叆');
     } else if (res === InsurancePolicyStatusEnum.WaitEffect) {
-      await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛屾槸鍚﹁鐩栵紵');
-      importInsStaffToList();
+      if (isSjbAccount.value) {
+        await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛岃淇敼鎵规鍙峰悗閲嶆柊瀵煎叆');
+      } else {
+        await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛屾槸鍚﹁鐩栵紵');
+        importInsStaffToList();
+      }
     } else {
       importInsStaffToList();
     }
   } catch (error) {}
 }
+
+const { isSjbAccount, getInsureProductIdByIdNumber } = useUserInsureProductSetting();
+
+const { getInsureProductSchemeByIdNumber } = useInsureProductSchemeAllList({
+  insureProductId: computed(() => getInsureProductIdByIdNumber(editForm.productIdNumber)),
+});
 
 async function importInsStaffToList() {
   try {
@@ -393,8 +445,23 @@
       productSchemeIdNumber: editForm.productSchemeIdNumber,
       effectStartTime: editForm.effectStartTime,
     };
+    const currentInsureProductScheme = getInsureProductSchemeByIdNumber(
+      editForm.productSchemeIdNumber
+    );
+    if (currentInsureProductScheme?.period === InsurancePeriodEnum['1-29D']) {
+      params.effectEndTime = editForm.effectEndTime;
+    }
     let res = await insuranceOrderServices.importInsStaffToList(params, {
       timeout: 60 * 1000 * 10,
+      customErrorHandler(error) {
+        if (error?.response?.data?.error?.code === '10001') {
+          Message.tipMessage(error.response.data?.error?.message, {
+            showCancelButton: false,
+          });
+          return true;
+        }
+        return false;
+      },
     });
     if (res) {
       // await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
@@ -435,24 +502,39 @@
   } catch (error) {}
 }
 
-const { dialogProps: dialogInstructionsProps, dialogState: dialogInstructionsState } = useDialog({
-  onConfirm: handleUpload,
-});
+const { dialogProps: dialogLineModeSelectProps, dialogState: dialogLineModeSelectState } =
+  useDialog({
+    onConfirm: handleLineModeSelect,
+  });
 
-const { isSjbAccount } = useUserInsureProductSetting();
-
-function handleOpenInstructions() {
-  if (isSjbAccount.value) {
+async function handleLineModeSelect(mode: InsureLineMode) {
+  if (mode === InsureLineMode.OnLine) {
     dialogInstructionsState.dialogVisible = true;
   } else {
     handleUpload();
   }
 }
 
-async function handleUpload() {
+const { dialogProps: dialogInstructionsProps, dialogState: dialogInstructionsState } = useDialog({
+  onConfirm: () => {
+    return handleUpload(true);
+  },
+});
+
+function handleOpenInstructions() {
+  if (isSjbAccount.value) {
+    // dialogInstructionsState.dialogVisible = true;
+    dialogLineModeSelectState.dialogVisible = true;
+  } else {
+    handleUpload();
+  }
+}
+
+async function handleUpload(isOnLineInsurance = false) {
   handleAdd({
     serialNum: `${dayjs().format('YYYYMMDD')}${_.random(0, 9999).toString().padStart(4, '0')}`,
     url: [] as UploadUserFile[],
+    isOnLineInsurance,
   });
 }
 
@@ -622,7 +704,12 @@
 
 async function handleGoDownloadInvoice(row: API.GetInsurancePageOutput) {
   try {
-    await insuranceOrderServices.getInvoiceId({ id: row.id });
+    await insuranceOrderServices.getInvoiceId(
+      { id: row.id },
+      {
+        timeout: 60 * 1000 * 30,
+      }
+    );
     router.push({
       name: 'InsureDownloadInvoice',
       params: {
@@ -631,4 +718,63 @@
     });
   } catch (error) {}
 }
+
+async function handleSubmitAuditBtn(row: API.GetInsurancePageOutput) {
+  try {
+    let params: API.InsurancePolicyAuditInput = {
+      insurancePolicyId: row.id,
+    };
+    let res = await insuranceOrderServices.insurancePolicyAddAudit(params);
+    if (res) {
+      Message.successMessage('涓婁紶鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
+
+function handleParkBountyApplyTradeBySelf(row: API.GetInsurancePageOutput) {
+  handleDisbursementAdd({
+    remianAmount: row.remianAmount,
+  });
+}
+
+const {
+  dialogProps: dialogDisbursementProps,
+  handleAdd: handleDisbursementAdd,
+  editForm: editDisbursementForm,
+} = useFormDialog({
+  onConfirm: parkBountyApplyTradeBySelf,
+  defaultFormParams: {
+    payRemark: '',
+    tradeAmount: 0,
+    remianAmount: 0,
+    payFileUrl: [] as UploadUserFile[],
+
+    incomeCompanyName: '',
+    insureBillNo: '',
+    incomeBankAccount: '',
+    incomeBankCardNumber: '',
+    incomeBankName: '',
+  },
+});
+
+async function parkBountyApplyTradeBySelf() {
+  try {
+    let params: API.CreateParkBountyTradeInput = {
+      tradeAmount: editDisbursementForm.tradeAmount,
+      payFileUrl: editDisbursementForm.payFileUrl.map((item) => item.url).join('|'),
+      payRemark: editDisbursementForm.payRemark,
+      incomeCompanyName: editDisbursementForm.incomeCompanyName,
+      insureBillNo: editDisbursementForm.insureBillNo,
+      incomeBankAccount: editDisbursementForm.incomeBankAccount,
+      incomeBankCardNumber: editDisbursementForm.incomeBankCardNumber,
+      incomeBankName: editDisbursementForm.incomeBankName,
+    };
+    let res = await parkBountyApplyServices.parkBountyApplyTradeBySelf(params);
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
 </script>

--
Gitblit v1.9.1