Sfoglia il codice sorgente

修改车险报价时,报价结果未正确替换的bug

@dongkboy 2 mesi fa
parent
commit
9d0dad99a7
1 ha cambiato i file con 20 aggiunte e 13 eliminazioni
  1. 20 13
      src/views/insurancePolicy/index.vue

+ 20 - 13
src/views/insurancePolicy/index.vue

@@ -3672,11 +3672,14 @@ const quoteInsurance = async (companyId: any, companyIndex: any, val: any) => {
       }
       }
       if (res.data.kindInfoVo) {
       if (res.data.kindInfoVo) {
         const obj = quoteData.value.find(v => v.id === insurancePolicyForm.value.order.insuranceCompanyCode)
         const obj = quoteData.value.find(v => v.id === insurancePolicyForm.value.order.insuranceCompanyCode)
-        obj.projectList[obj.productIndex].kinds = res.data.kindInfoVo
+        if (obj && obj.projectList && obj.productIndex !== undefined) {
+          obj.projectList[obj.productIndex].kinds = res.data.kindInfoVo
+        }
       }
       }
       // 设置折扣信息
       // 设置折扣信息
       const feeOrders = res.data?.feeOrders || {};
       const feeOrders = res.data?.feeOrders || {};
-      quoteData.value[companyIndex].discounts = [
+      if (quoteData.value[companyIndex]) {
+        quoteData.value[companyIndex].discounts = [
         {
         {
           name: '交强',  // 交强险费用明细
           name: '交强',  // 交强险费用明细
           additionalPremium: feeOrders.jqAdditionalPremium ?? 0,
           additionalPremium: feeOrders.jqAdditionalPremium ?? 0,
@@ -3703,18 +3706,22 @@ const quoteInsurance = async (companyId: any, companyIndex: any, val: any) => {
           exportRatio: feeOrders.jyExportRatio ?? 0,
           exportRatio: feeOrders.jyExportRatio ?? 0,
         },
         },
       ]
       ]
-      // 保存报价结果
-      quoteData.value[companyIndex].quoteResult = res.data
-      quoteData.value[companyIndex].quoteCode = 200
-      loading.value = false
-      quoteData.value[companyIndex].loading = false
+        // 保存报价结果
+        quoteData.value[companyIndex].quoteResult = res.data
+        quoteData.value[companyIndex].quoteCode = 200
+        loading.value = false
+        quoteData.value[companyIndex].loading = false
+      }
     } else {
     } else {
-      quoteData.value[companyIndex].quoteResult = res.data
-      quoteData.value[companyIndex].quoteCode = 500
-      quoteData.value[companyIndex].failMsg = res.msg
+      if (quoteData.value[companyIndex]) {
+        quoteData.value[companyIndex].quoteResult = res.data
+        quoteData.value[companyIndex].quoteCode = 500
+        quoteData.value[companyIndex].failMsg = res.msg
+      }
       loading.value = false
       loading.value = false
-      quoteData.value[companyIndex].loading = false
-
+      if (quoteData.value[companyIndex]) {
+        quoteData.value[companyIndex].loading = false
+      }
     }
     }
     // InsurancePolicyRefs.resetFields()
     // InsurancePolicyRefs.resetFields()
   }).catch((e: any) => {
   }).catch((e: any) => {
@@ -4327,4 +4334,4 @@ onMounted(() => {
     }
     }
   }
   }
 }
 }
-</style>
+</style>