Explorar o código

Merge branch 'dev' of http://39.101.143.165:8090/dong_k/tenant-Platform into dev

@dongkboy hai 2 meses
pai
achega
0ed7be774a
Modificáronse 2 ficheiros con 54 adicións e 79 borrados
  1. 1 1
      src/api/modules/insurancePolicy.ts
  2. 53 78
      src/views/insurancePolicy/index.vue

+ 1 - 1
src/api/modules/insurancePolicy.ts

@@ -10,7 +10,7 @@ const insurancePolicyApi = (axiosInstance: ApiInstance) => ({
       system_code: localStorage.getItem('login_system')
     }
   }), // 获取保司
-  getSchemeResult: (data: any) => axiosInstance.get(`scheme/getSchemeResult?companyId=${data.companyId}&productId=${data.productId}&seatCount=${data.seatCount}`), // 获取保司下的险种和驾意险
+  getSchemeResult: (data: any) => axiosInstance.get(`scheme/getSchemeResult?companyId=${data.companyId}&productId=${data.productId}&seatCount=${data.seatCount}&energyType=${data.energyType}&vehicleType=${data.vehicleType}&carnature=${data.carnature}`), // 获取保司下的险种和驾意险
   imagesUpload: (data: any) => axiosInstance.post('/unify/order/imagesUpload', data), // 上传影像保存
   underwriting: (data: any) => axiosInstance.post('/unify/order/underwriting', data), // 核保
   imageSave: (data: any) => axiosInstance.post('/unify/order/imageSave', data), // 本地影像存储

+ 53 - 78
src/views/insurancePolicy/index.vue

@@ -88,7 +88,7 @@
             <el-col :span="6">
               <!-- 使用性质下拉选择 -->
               <el-form-item label="使用性质" prop="carNatureCode">
-                <el-select v-model="insurancePolicyForm.carNatureCode" placeholder="请选择">
+                <el-select v-model="insurancePolicyForm.carNatureCode" placeholder="请选择" @change="getSchemeResult">
                   <el-option v-for="item in optionObj.car_nature_code" :label="item.label" :value="item.value"
                     :key="item.value"></el-option>
                 </el-select>
@@ -106,7 +106,7 @@
             <el-col :span="6">
               <!-- 车辆种类下拉选择 -->
               <el-form-item label="车辆种类" prop="plateType">
-                <el-select v-model="insurancePolicyForm.plateType" placeholder="请选择">
+                <el-select v-model="insurancePolicyForm.plateType" placeholder="请选择" @change="getSchemeResult">
                   <el-option v-for="item in optionObj.car_kind_code" :label="item.label" :value="item.value"
                     :key="item.value"></el-option>
                 </el-select>
@@ -125,7 +125,7 @@
             <el-col :span="6">
               <!-- 能源种类下拉选择 -->
               <el-form-item label="能源种类" prop="energyTypeCode">
-                <el-select v-model="insurancePolicyForm.energyTypeCode" placeholder="请选择">
+                <el-select v-model="insurancePolicyForm.energyTypeCode" placeholder="请选择" @change="getSchemeResult">
                   <el-option v-for="item in optionObj.energy_type_code" :label="item.label" :value="item.value"
                     :key="item.value"></el-option>
                 </el-select>
@@ -2659,91 +2659,66 @@ const handleEquitiesSave = (data: any) => {
   equitiesShow.value = false
 }
 
-const handleSelect = (row: any) => {
-  insurancePolicyForm.value.order.insuranceCompanyCode = row.id
-  if (insurancePolicyForm.value.productId) {
-    api.insurancePolicyApi.getSchemeResult({
-      companyId: row.id,
-      productId: insurancePolicyForm.value.productId,
-      seatCount: insurancePolicyForm.value.seatCount,
-    }).then((res: any) => {
-      let list = res.data?.schemes || [];
-      if (res.data?.optionalScheme) {
-        list.push(res.data.optionalScheme)
-      }
-      if (list.length > 0) {
-        list.forEach((item: any) => {
-          item.checked = false
-        })
-      }
-      // 方案信息
-      quoteData.value.forEach((item: any) => {
-        if (item.id === row.id) {
-          item.productIndex = 0;
-          item.insurancePlanInfo = {
-            ...list[0],
+/**
+ * 获取保险公司方案结果并更新报价数据
+ * 根据当前保单表单中的保险公司编码、产品ID、座位数、能源类型、车辆类型及使用性质,
+ * 调用接口查询可选方案列表,将可选方案合并至列表中,
+ * 并将方案信息及过滤后的项目列表写入当前行的报价数据中。
+ */
+const getSchemeResult = () => {
+  if (!insurancePolicyForm.value.order.insuranceCompanyCode) return
+  if (!insurancePolicyForm.value.productId) return
+  api.insurancePolicyApi.getSchemeResult({
+    companyId: insurancePolicyForm.value.order.insuranceCompanyCode,
+    productId: insurancePolicyForm.value.productId,
+    seatCount: insurancePolicyForm.value.seatCount,
+    energyType: insurancePolicyForm.value.energyTypeCode,
+    vehicleType: insurancePolicyForm.value.plateType,
+    carnature: insurancePolicyForm.value.carNatureCode,
+  }).then((res: any) => {
+    let list = res.data?.schemes || [];
+    if (res.data?.optionalScheme) {
+      list.push(res.data.optionalScheme)
+    }
+    if (list.length > 0) {
+      list.forEach((item: any) => {
+        item.checked = false
+      })
+    }
+    // 方案信息
+    quoteData.value.forEach((item: any) => {
+      if (item.id === insurancePolicyForm.value.order.insuranceCompanyCode) {
+        item.productIndex = 0;
+        item.insurancePlanInfo = {
+          ...list[0],
+          rescue: [],
+          detection: [],
+          driver: [],
+          inspect: []
+        }
+        item.projectList = list.map((item1: any) => {
+          return {
+            ...item1,
+            drivings: item1.drivings.filter(v => ['1', '2'].includes(v.selectedStatus)),
             rescue: [],
             detection: [],
             driver: [],
             inspect: []
           }
-          item.projectList = list.map((item1: any) => {
-            return {
-              ...item1,
-              drivings: item1.drivings.filter(v => ['1', '2'].includes(v.selectedStatus)),
-              rescue: [],
-              detection: [],
-              driver: [],
-              inspect: []
-            }
-          })
-        }
-      })
+        })
+      }
     })
-  }
+  })
+}
+
+const handleSelect = (row: any) => {
+  insurancePolicyForm.value.order.insuranceCompanyCode = row.id
+  getSchemeResult()
 }
 const handelExpend = (e: any) => {
   e.checked = true
   insurancePolicyForm.value.order.insuranceCompanyCode = e.id
-  if (insurancePolicyForm.value.productId) {
-    api.insurancePolicyApi.getSchemeResult({
-      companyId: e.id,
-      productId: insurancePolicyForm.value.productId,
-      seatCount: insurancePolicyForm.value.seatCount,
-    }).then((res: any) => {
-      let list = res.data?.schemes || [];
-      if (res.data?.optionalScheme) {
-        list.push(res.data.optionalScheme)
-      }
-      if (list.length > 0) {
-        list.forEach((item: any) => {
-          item.checked = false
-        })
-      }
-      quoteData.value.forEach((item: any) => {
-        if (item.id === e.id) {
-          item.productIndex = 0;
-          item.insurancePlanInfo = {
-            ...list[0],
-            rescue: [],
-            detection: [],
-            driver: [],
-            inspect: []
-          }
-          item.projectList = list.map((item1: any) => {
-            return {
-              ...item1,
-              drivings: item1.drivings.filter(v => ['1', '2'].includes(v.selectedStatus)),
-              rescue: [],
-              detection: [],
-              driver: [],
-              inspect: []
-            }
-          })
-        }
-      })
-    })
-  }
+  getSchemeResult()
 }
 const handleClickRow = (a: any, b: any) => {