Sfoglia il codice sorgente

计算保险刷新列表修复,增加清空被保人信息按钮

yaoyao 2 anni fa
parent
commit
ab869d40a3
1 ha cambiato i file con 170 aggiunte e 175 eliminazioni
  1. 170 175
      src/views/Task/daikeComponents/KtLetter1.vue

+ 170 - 175
src/views/Task/daikeComponents/KtLetter1.vue

@@ -416,6 +416,9 @@
           <span style="margin-left: 10px">被保人信息</span>
         </div>
         <div class="flex j-s a-c">
+          <div style="font-size: 12px; margin: 0 10px" v-show="!bbtbcarShow && !bbczcarShow">
+            <el-button size="small" type="primary" @click="clearBbxx">清空被保人信息</el-button>
+          </div>
           <div style="font-size: 12px; margin: 0 10px">
             同投保人
             <el-switch v-model="bbtbcarShow" active-color="#D42426" @change="bbtbcarShowChange()"></el-switch>
@@ -5794,146 +5797,131 @@ export default {
         this.$message({ message: "发证日期早于初登日期", type: "error" });
         return;
       }
-      if (_this.bbtbcarShow == true) {
-        _this.insuredPersonInfo = JSON.parse(
-          JSON.stringify(_this.policyHolderInfo)
-        );
-      } else if (_this.bbczcarShow == true) {
-        _this.insuredPersonInfo = JSON.parse(
-          JSON.stringify(_this.ownerInfo)
-        );
-      } else {
-        // _this.insuredPersonInfo = {}
-      }
-      if (this.tbczcarShow == true) {
-        this.policyHolderInfo = JSON.parse(
-          JSON.stringify(_this.ownerInfo)
-        );
-      } else {
-        // this.policyHolderInfo = {}
-      }
+      this.policyHolderInfovalidate()
       console.log(this.policyHolderInfo, 'policyHolderInfo')
-      this.$refs["insuredPersonInfo"].validate((valid11) => {
-          if (valid11) {
-            this.$refs["carInfo"].validate((valid) => {
-              if (valid) {
-                // this.policyHolderInfovalidate()
-                _this.$refs["ownerInfo"].validate(async (valid1) => {
-                  if (valid1) {
-                    if (!_this.productId) {
-                      _this.$message.warning('请选择险别')
-                      return
-                    }
-                    let res = {};
-                    // res = await this.$api.letter.getAllAgreement();
-                    // this.$api.letter.getAllAgreement().then((res) => {
-                    let param = {
-                      productId: this.productId,
-                      carInfo: this.carInfo,
-                      ownerInfo: this.ownerInfo,
-                      applyInfo: this.policyHolderInfo,
-                      insureInfo: this.insuredPersonInfo,
-                      userId:this.isLetter==2? this.userId:""
-                    }
-                    if (JSON.stringify(param) === this.oldData) {
-                      return
-                    } else {
-                      this.oldData = JSON.stringify(param) 
-                    }
-                    console.log('校验成功,获取列表')
-                    this.showLoading = true
-                    this.$api.letter.ruleFilterCompany(param).then((res) => {
-                      if (res.code == 200) {
-                        res.data.map((ele) => {
-                          ele["result"] = {};
-                          ele["quoteCode"] = 0;
-                          ele["checked"] = false;
-                          ele["msg"] = "";
-                          ele["lastYearMsg"] = "";
-                          ele["agreementId"] = "";
-                          ele["apiType"] = "";
-                          ele["orderstatus"] = 0;
-                          ele.coefficient = "";
-                          ele.underwritingDescription =
-                            ele.agreement[0].underwritingDescription;
-                          if (ele.isTaxSource && ele.isTaxSource == "1" && ele.agreement) {
-                            ele.agreement.forEach((val) => {
-                              if (val.isTaxSource && val.isTaxSource == "1") {
-                                ele.agreementId = val.id;
-                                ele.apiType = val.apiType;
-                              }
-                            });
-                          }
-                        });
-                        if (this.$route.query.data) {
-                          data = data || this.$route.query.data
-                        }
-                        if (data) {
-                          this.productId = this.productId || data.productid
-                          res.data.forEach((val, index) => {
-                            if(!data.insAreaCompanyEditingDtos) {
-                              return
-                            }
-                            data.insAreaCompanyEditingDtos.forEach((ele) => {
-                              if (val.namesimple == ele.inscompany) {
-                                if (ele.inscompany == "中国人寿" && ele.companyId) {
-                                  this.lastCompanyId = ele.companyId;
-                                }
-                                res.data[index].quoteCode = 200;
-                                res.data[index].result = ele;
-                              }
-                            });
-                          });
+      this.$refs["carInfo"].validate((valid) => {
+        if (valid) {
+          _this.$refs["ownerInfo"].validate(async (valid1) => {
+            if (valid1) {
+              if (!this.bbczcarShow && !this.bbtbcarShow) {
+                this.$refs["insuredPersonInfo"].validate((valid2) => {
+                  if (!valid2) {
+                    document.getElementById("toubaor").scrollIntoView();
+                    this.$message({ message: "请检查被投保人信息", type: "warning" });
+                    return
+                  }
+                });
+              }
+              if (!_this.productId) {
+                _this.$message.warning('请选择险别')
+                return
+              }
+              let res = {};
+              // res = await this.$api.letter.getAllAgreement();
+              // this.$api.letter.getAllAgreement().then((res) => {
+              let param = {
+                productId: this.productId,
+                carInfo: this.carInfo,
+                ownerInfo: this.ownerInfo,
+                applyInfo: this.policyHolderInfo,
+                insureInfo: this.insuredPersonInfo,
+                userId:this.isLetter==2? this.userId:""
+              }
+              if (JSON.stringify(param) === this.oldData) {
+                return
+              } else {
+                this.oldData = JSON.stringify(param) 
+              }
+              console.log('校验成功,获取列表')
+              this.showLoading = true
+              this.$api.letter.ruleFilterCompany(param).then((res) => {
+                if (res.code == 200) {
+                  res.data.map((ele) => {
+                    ele["result"] = {};
+                    ele["quoteCode"] = 0;
+                    ele["checked"] = false;
+                    ele["msg"] = "";
+                    ele["lastYearMsg"] = "";
+                    ele["agreementId"] = "";
+                    ele["apiType"] = "";
+                    ele["orderstatus"] = 0;
+                    ele.coefficient = "";
+                    ele.underwritingDescription =
+                      ele.agreement[0].underwritingDescription;
+                    if (ele.isTaxSource && ele.isTaxSource == "1" && ele.agreement) {
+                      ele.agreement.forEach((val) => {
+                        if (val.isTaxSource && val.isTaxSource == "1") {
+                          ele.agreementId = val.id;
+                          ele.apiType = val.apiType;
                         }
-                        // //险种合并集合
-                      } else {
-                        this.$message.error(res.msg)
+                      });
+                    }
+                  });
+                  if (this.$route.query.data) {
+                    data = data || this.$route.query.data
+                  }
+                  if (data) {
+                    this.productId = this.productId || data.productid
+                    res.data.forEach((val, index) => {
+                      if(!data.insAreaCompanyEditingDtos) {
+                        return
                       }
-                      const combinedArray = [
-                        ...this.riskList.map(item => item.riskCode),
-                        ...this.kindList.map(item => item.kindCode),
-                      ];
-                      if (res.data) {
-                        res.data = res.data.filter(obj => {
-                        obj.agreement = obj.agreement.filter(agreementObj => {
-                          // 险种配置为空,则过滤掉该协议
-                          if (agreementObj.productsCodes == null) {
-                            return true;
-                          } else {
-                            // 检查是否包含 A 的特殊处理
-                            if (combinedArray.includes('A') && !agreementObj.productsCodes.includes(
-                                'A')) {
-                              return false;
-                            }
-                            return agreementObj.productsCodes.some(item => combinedArray.includes(
-                              item));
+                      data.insAreaCompanyEditingDtos.forEach((ele) => {
+                        if (val.namesimple == ele.inscompany) {
+                          if (ele.inscompany == "中国人寿" && ele.companyId) {
+                            this.lastCompanyId = ele.companyId;
                           }
-                        });
-                        return obj.agreement.length > 0; // 返回true保留,返回false移除该保险公司
-                      });
-                        res.data.forEach((e) => {
-                        e.agreement.forEach((el) => (el.disabled = false));
+                          res.data[index].quoteCode = 200;
+                          res.data[index].result = ele;
+                        }
                       });
-                      }
-                      this.totalCompanyList = res.data;
-                      this.showLoading = false
-                    })
-                  } else {
-                    document.getElementById("CheZhu").scrollIntoView();
-                    _this.$message({ message: "请检查人员信息", type: "warning" });
+                    });
                   }
+                  // //险种合并集合
+                } else {
+                  this.$message.error(res.msg)
+                }
+                const combinedArray = [
+                  ...this.riskList.map(item => item.riskCode),
+                  ...this.kindList.map(item => item.kindCode),
+                ];
+                if (res.data) {
+                  res.data = res.data.filter(obj => {
+                  obj.agreement = obj.agreement.filter(agreementObj => {
+                    // 险种配置为空,则过滤掉该协议
+                    if (agreementObj.productsCodes == null) {
+                      return true;
+                    } else {
+                      // 检查是否包含 A 的特殊处理
+                      if (combinedArray.includes('A') && !agreementObj.productsCodes.includes(
+                          'A')) {
+                        return false;
+                      }
+                      return agreementObj.productsCodes.some(item => combinedArray.includes(
+                        item));
+                    }
+                  });
+                  return obj.agreement.length > 0; // 返回true保留,返回false移除该保险公司
                 });
-              } else {
-                document.getElementById("Car").scrollIntoView();
-                this.$message({ message: "请检查车辆信息", type: "warning" });
-                return false;
-              }
-            });
-          } else {
-            document.getElementById("beitoubaoren").scrollIntoView();
-            _this.$message({ message: "请检查被投保人信息", type: "warning" });
-          }
-        });
+                  res.data.forEach((e) => {
+                  e.agreement.forEach((el) => (el.disabled = false));
+                });
+                }
+                this.totalCompanyList = res.data;
+                this.showLoading = false
+              })
+
+            } else {
+              document.getElementById("CheZhu").scrollIntoView();
+              _this.$message({ message: "请检查人员信息", type: "warning" });
+            }
+          });
+        } else {
+          document.getElementById("Car").scrollIntoView();
+          this.$message({ message: "请检查车辆信息", type: "warning" });
+          return false;
+        }
+      });
 
       },
     // 保费计算(报价)按钮
@@ -8393,26 +8381,22 @@ export default {
       this.imageUploadShow = true;
     },
     policyHolderInfovalidate() {
-      let isvalidat = false;
       let _this = this;
-      this.bbtbcarShowChange()
-      this.bbczcarShowChange()
+      // tbczcarShow 同车主
       if (_this.tbczcarShow == true) {
+        // 投保人信息 policyHolderInfo
         _this.policyHolderInfo = JSON.parse(JSON.stringify(_this.ownerInfo));
       } else {
         _this.$refs["policyHolderInfo"].validate((valid2) => {
           if (valid2) {
-            isvalidat = false;
           } else {
             document.getElementById("toubaor").scrollIntoView();
             _this.$message({ message: "请检查投保人信息", type: "warning" });
-            isvalidat = true;
           }
         });
       }
-      if (isvalidat) {
-        return;
-      }
+      this.bbtbcarShowChange()
+      this.bbczcarShowChange()
     },
     //报价
     quote(index) {
@@ -11329,7 +11313,6 @@ export default {
       switch (this.tbczcarShow) {
         case true:
           this.policyHolderInfo = JSON.parse(JSON.stringify(this.ownerInfo));
-          this.getCompanyList()
           break;
         default:
           for (let key in this.policyHolderInfo) {
@@ -11342,46 +11325,57 @@ export default {
       this.$forceUpdate()
     },
     bbczcarShowChange() {
-      //被保人同车主
-      switch (this.bbczcarShow) {
-        case true:
-          this.bbtbcarShow = false;
-          this.insuredPersonInfo = JSON.parse(JSON.stringify(this.ownerInfo));
-          setTimeout(() => {
-            this.getCompanyList()
-          }, 300);
-          break;
-        default:
-          for (let key in this.insuredPersonInfo) {
-            this.insuredPersonInfo[key] = "";
-            this.insuredPersonInfo.provinceData = [];
-            // this.selectedOptions3 = [];
-          }
-          this.insuredPersonInfo = {}
+      if (this.bbczcarShow) {
+        this.bbtbcarShow = false
       }
+      //被保人同车主
+      if (this.bbczcarShow && !this.bbtbcarShow) {
+        this.insuredPersonInfo = JSON.parse(JSON.stringify(this.ownerInfo));
+        this.bbtbcarShow = false
+      }
+      // if (!this.bbczcarShow && !this.bbtbcarShow) {
+      //   for (let key in this.insuredPersonInfo) {
+      //     this.insuredPersonInfo[key] = "";
+      //     this.insuredPersonInfo.provinceData = [];
+      //     // this.selectedOptions3 = [];
+      //   }
+      //   this.insuredPersonInfo = {}
+      // }
+      // if (this.bbtbcarShow) {
+      //   return
+      // }
+      // switch (this.bbczcarShow) {
+      //   case true:
+      //     this.insuredPersonInfo = JSON.parse(JSON.stringify(this.ownerInfo));
+      //     this.bbtbcarShow = false;
+      //     console.log( '车主信息111111', this.ownerInfo, '投保人信息', this.policyHolderInfo, '被保人信息', this.insuredPersonInfo, '被保人同车主', this.bbczcarShow)
+      //     break;
+      //   default:
+      //     for (let key in this.insuredPersonInfo) {
+      //       this.insuredPersonInfo[key] = "";
+      //       this.insuredPersonInfo.provinceData = [];
+      //       // this.selectedOptions3 = [];
+      //     }
+      // }
       this.$forceUpdate()
     },
     bbtbcarShowChange() {
-      //被保人同投保人
-      switch (this.bbtbcarShow) {
-        case true:
-          this.bbczcarShow = false;
-          this.insuredPersonInfo = JSON.parse(
-            JSON.stringify(this.policyHolderInfo)
-          );
-          setTimeout(() => {
-            this.getCompanyList()
-          }, 300);
-          break;
-        default:
-          for (let key in this.insuredPersonInfo) {
-            this.insuredPersonInfo[key] = "";
-            this.insuredPersonInfo.provinceData = [];
-          }
-          this.insuredPersonInfo = {}
+      if (this.bbtbcarShow) {
+        this.bbczcarShow = false 
+      }
+      if (this.bbtbcarShow && !this.bbczcarShow) {
+          this.insuredPersonInfo = JSON.parse(JSON.stringify(this.policyHolderInfo));
+          this.bbczcarShow = false
       }
       this.$forceUpdate()
     },
+    // 清空被保人信息
+    clearBbxx() {
+      for (let key in this.insuredPersonInfo) {
+        this.insuredPersonInfo[key] = "";
+        this.insuredPersonInfo.provinceData = [];
+      }
+    },
     // 查询车牌信息
     toCheckLicenseNo(licenseNo) {
       if (licenseNo) {
@@ -12277,6 +12271,7 @@ export default {
                 var _that = this;
                 switch (_that.inscompany) {
                   case "太平财险":
+                  case "诚泰财险":
                     let anresult = qrCodeUrl.replace(/[\r\n]/g, "");
                     let animgBase64 = `data:image/png;base64,${anresult}`;
                     base64ToPath(animgBase64).then((path) => {