order.vue 31 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
<!-- 权益订单 -->
<template>
  <div v-if="pageShow">
    <div v-if="detailOrderStatus == 25 || detailOrderStatus == 22" class="fail_status_widget">
      <i class="el-icon-warning"></i>
      <span>核赔不通过:{{ noPassMap[reasonForFailureCode] }},{{ reasonForFailure }}</span>
    </div>
    <report @toSearchOrderDetail="toSearchOrderDetail" ref="reportRef" :isGH="routeInfo.isGH" :pageType="pageType" :editForm.sync="editForm"></report>
    <!-- 维修信息 -->
    <repair ref="repairRef" @changeObjectType="changeObjectType" :isGH="routeInfo.isGH" :pageType="pageType" :serviceItemsList.sync="serviceItemsList" :totalPrice.sync="totalPrice" :accountForm.sync="accountForm"></repair>
    <material ref="materialRef" :pageType="pageType" :materialForm.sync="materialForm"></material>
    <!-- 查看和待核赔 2个页面查看上传加装件信息 v-if="pageType == 2 || pageType == 6" -->
    <div v-if="refitInfo.addOnsFlag == 1 && (pageType == 2 || pageType == 6)" class="refit-info">
      <div class="title">上传加改装件凭证</div>
      <div class="refit-img" v-for="(item, index) in refitInfo.attachmentList || []" :key="index">
        <label class="label" for="">{{ item.attachmentCode == 'QS0001' ? '发票或收据' : '加改装部位照片' }}:</label>
        <el-image class="img" :preview-src-list="[item.attachmentFile]" :src="item.attachmentFile"></el-image>
      </div>
    </div>
    <wraning :isWatchOrder="isWatchOrder" @getWarningData="getWarningData" v-if="accountMatchResultList.length && detailOrderStatus != 2" :list="accountMatchResultList"></wraning>
    <div v-if="pageType != 2" class="page-btm-btn">
      <template v-if="detailOrderStatus < 19 || detailOrderStatus == 22 || detailOrderStatus == 25">
        <el-button type="primary" @click="confirmSubmit(1)">提交</el-button>
        <el-button type="primary" plain @click="confirmSubmit(2)">草稿</el-button>
      </template>
      <!-- <template v-if="detailOrderStatus == 19">
        <el-button @click="toCheckOrder(20)" :size="size" type="primary">提交</el-button>
      </template> -->
      <template v-if="detailOrderStatus == 21">
        <el-button @click="toCheckOrderByYY(22)" :size="size" plain>审核不通过</el-button>
        <el-button @click="toCheckOrderByYY(23)" :size="size" type="primary">审核通过</el-button>
      </template>
      <template v-if="detailOrderStatus == 23">
        <el-button @click="toCheckOrderByYY(25)" :size="size" plain>审核不通过</el-button>
        <el-button @click="toCheckOrderByYY(24)" :size="size" type="primary">审核通过</el-button>
      </template>
    </div>
    <div v-if="pageType == 2 && detailOrderStatus == 19" class="page-btm-btn">
      <el-button @click="toCheckOrder(20)" :size="size" type="primary">提交</el-button>
    </div>
    <el-dialog title="风险预警" width="720px" @close="cancelWarning" :visible.sync="dialogVisible">
      <div v-if="accountMatchResultList.length" class="warning_body">
        <!-- <div slot="title" class="maxtitle">风险预警</div> -->
        <div class="header">
          <i class="el-icon-warning"></i>
          <span class="title">风险预警</span>
          <span class="cont">请核实情况,并在系统上提交说明或上传资料。</span>
        </div>
        <div class="main">
          <div class="element">
            <div class="e_title">风险预警:{{ matchResultDesc[accountMatchResultList[accountMatchResultList.length - 1].matchResult] }}</div>
            <div class="e_desc">具体描述:{{ accountMatchResultList[accountMatchResultList.length - 1].matchResultDesc }}</div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button :size="size" @click="cancelWarning">取 消</el-button>
        <el-button :size="size" type="primary" @click="handleWarning">确 定</el-button>
      </span>
    </el-dialog>
    <GLDialog class="gl-form-page gl-form-min" title="审核不通过" mode="mid" :visible.sync="showNoPassDialog" @onOk="comfirmNoPass" @onCancel="cancleNoPass">
      <glsx-combi-form ref="noPassRef" :isInline="false" labelWidth="154px" defaultWidth="284px" :formObj="noPassObj" :formData="noPassForm"></glsx-combi-form>
    </GLDialog>
  </div>
</template>
<script>
import report from './components/report.vue'
import repair from './components/repair.vue'
import material from './components/material.vue'
import util from '@/util/util'
import wraning from './components/wraning/index.vue'
import glsxCombiForm from '@/components/glsx-combi-form'
import NP from 'number-precision'
export default {
  name: 'order',
  components: {
    report,
    repair,
    material,
    wraning,
    glsxCombiForm
  },
  data() {
    return {
      permitDraft: false,
      routeInfo: null,
      isGH: false,
      editForm: {
        caseType: 0, // 默认常规赔案
        contractNo: '',
        reportDate: '',
        reimbursementDate: '',
        internalReimbursementDate: '',
        reimbursementAddress: '',
        reporterName: '',
        reporterPhone: '',
        writeOffCode: '',
        reimbursementAddr: '',
        reimbursementProvinceCode: '',
        reimbursementCityCode: '',
        reimbursementCountiesCode: ''
      },
      pageType: 1,
      accountForm: {
        objectType: 0,
        accountType: 0,
        branchBankCode: '',
        accountName: '',
        accountNo: '',
        bankCity: '',
        payeeIDCardType: '',
        payeeIDCardNo: '',
        payeePhone: '',
        handlerName: '',
        handlerPhone: ''
      },
      saveObj: {},
      materialForm: {
        idCard: [],
        idCardBack: [],
        billInfo: [],
        otherInfo: []
      },
      serviceItemsList: [],
      dialogVisible: false,
      accountMatchResultList: [],
      detailOrderStatus: 0,
      matchResultDesc: {
        1: '支付账号异常',
        2: '金额过大'
      },
      // 弹窗
      showNoPassDialog: false,
      showPassedDialog: false,
      noPassObj: {
        reason: '',
        desc: ''
      },
      noPassForm: [
        {
          label: '原因:',
          name: 'reason',
          type: 'select',
          isClear: true,
          placeholder: '请选择原因',
          optionList: [
            {
              confId: 1,
              confName: '拒赔'
            },
            {
              confId: 2,
              confName: '资料不清晰'
            }
          ],
          optionId: 'confId',
          optionLabel: 'confName'
        },
        {
          label: '具体描述:',
          name: 'desc',
          type: 'input',
          inputType: 'textarea',
          rows: 3,
          isClear: true,
          maxlength: 200,
          placeholder: '请输入具体描述'
        }
      ],
      pageShow: false,
      noPassMap: {
        1: '拒赔',
        2: '资料不清晰'
      },
      reasonForFailureCode: 1,
      isWatchOrder: false,
      refitInfo: {}
    }
  },
  created() {
    this.initSaveObj()
    const urlParam = this.$route.params
    const urlQuery = JSON.parse(decodeURIComponent(urlParam.id))
    this.pageType = urlQuery.editNo
    this.routeInfo = urlQuery
    this.handleFormInfo(urlQuery.contractNo, urlQuery.isGH)
    if (this.pageType == 2) {
      this.isWatchOrder = true
    }
    if (this.routeInfo.orderId) {
      this.getDetailById()
    } else {
      this.pageShow = true
    }
  },
  computed: {
    totalPrice() {
      let total = this.serviceItemsList.reduce(function(prev, cur) {
        return prev + +(cur.approveAmount * 100).toFixed(0)
      }, 0)
      return total / 100
    }
  },
  mounted() {},
  methods: {
    // 校验上传资料是否填完
    verifyWarningImage() {
      if (!this.queryList) {
        this.queryList = this._temp_queryList
      }
      if (!this.queryList.length) {
        this.$message.error(`请填写风险预警信息补充`)
        return false
      }
      let flag = false,
        imgFlag = false,
        curImgIndex,
        curIndex = 0
      this.queryList.forEach((el, index) => {
        if (el.matchType != 1) {
          if (!el.verifyResultDesc) {
            flag = true
            curIndex = index
          }
          if (!el.accountVerifyImagesList || !el.accountVerifyImagesList.length) {
            imgFlag = true
            curImgIndex = index
          }
          if (el.accountVerifyImagesList && el.accountVerifyImagesList.length) {
            el.accountVerifyImagesList.forEach((k, i) => {
              if (!k.verifyImage) {
                imgFlag = true
                curImgIndex = index
              }
            })
          }
        }
      })
      if (flag) {
        this.$message.error(`请填写风险预警${curIndex + 1}的核实情况说明`)
        return false
      }
      if (imgFlag) {
        this.$message.error(`请上传风险预警${curImgIndex + 1}的核实资料补充`)
        return false
      }
      return true
    },
    // 处理审核时需要的核赔参数
    handlerClaimsQueryForCheck() {
      const params = { ...this.editForm, ...this.accountForm }
      if (params.accountType !== 1) {
        params.accountType = 0
      }
      params.reimbursementDate = params.reimbursementDate ? util.dateFormat(params.reimbursementDate, 'YYYY-MM-DD HH:mm:ss') : ''
      params.internalReimbursementDate = params.internalReimbursementDate ? util.dateFormat(params.internalReimbursementDate, 'YYYY-MM-DD HH:mm:ss') : ''
      params.reportDate = params.reportDate ? util.dateFormat(params.reportDate, 'YYYY-MM-DD HH:mm:ss') : ''
      if (params.reimbursementAddress.length == 3) {
        params.reimbursementProvinceCode = params.reimbursementAddress[0]
        params.reimbursementCityCode = params.reimbursementAddress[1]
        params.reimbursementCountiesCode = params.reimbursementAddress[2]
      }
      params.approveAmounts = ''
      let tagetObj = {},
        lossAssessmentTarget = {},
        customesPriceObj = {}
      this.serviceItemsList.forEach(item => {
        tagetObj[item.serviceItemCode] = item.approveAmount
        customesPriceObj[item.serviceItemCode] = item.customerApplyAmount
        if (item.lossAssessmentFlag) {
          lossAssessmentTarget[item.serviceItemCode] = item.lossAssessmentAmount
        }
      })
      params.approveAmounts = JSON.stringify(tagetObj)
      params.customerApplyAmounts = JSON.stringify(customesPriceObj)
      params.lossAssessmentAmounts = JSON.stringify(lossAssessmentTarget)
      delete params.reimbursementAddress
      params.fileList = []
      for (let key in this.materialForm) {
        this.materialForm[key].forEach((item, index) => {
          const obj = {}
          obj.fileType = item.fileType
          obj.fileUrl = item.url
          obj.fileCode = key == 'idCard' || key == 'idCardBack' ? 1 : key == 'billInfo' ? 31 : 4
          obj.fileName = item.name
          params.fileList.push(obj)
        })
      }
      return params
    },
    cancleNoPass() {
      this.showNoPassDialog = false
    },
    // 点击不通过
    comfirmNoPass() {
      let _para = {
        reasonForFailureCode: this.noPassObj.reason,
        reasonForFailure: this.noPassObj.desc
      }
      this.toCheckOrder(this.noPass_operation, _para)
    },
    // 审核
    toCheckOrderByYY(operation) {
      if (operation == 22 || operation == 25) {
        this.showNoPassDialog = true
        this.noPass_operation = operation
      } else {
        const _target = this.serviceItemsList?.find(item => item.approveAmount && item.lossAssessmentFlag && !item.lossAssessmentAmount)
        if (_target) return this.$message.error(`请输入${_target.serviceItemName}的保险公司定损金额`)
        const allEmpty = this.serviceItemsList?.find(item => item.approveAmount)
        if (!allEmpty) return this.$message.error(`请至少输入一项定损批准金额`)
        const _approveTarget = this.serviceItemsList?.find(item => !item.approveAmount && item.lossAssessmentFlag && item.lossAssessmentAmount)
        if (_approveTarget) return this.$message.error(`请输入${_approveTarget.serviceItemName}的定损批准金额`)
        const priceTarget = this.serviceItemsList?.find(item => item.serviceItemType == 1 && item.approveAmount > 0 && !item.purchaseTax && !item.depreciation && !item.commercialInsurance && !item.registrationFee && !item.retrofits && !item.scooterFare)
        if (priceTarget) {
          this.$message.error(`${priceTarget.serviceItemName}的购置税、折旧费、商业险保费、登记费、加改装件费用、代步车费用,至少输入一个`)
          return false
        }
        const injureTarget = this.serviceItemsList?.find(item => item.serviceItemType == 2 && item.approveAmount > 0 && !item?.damageType?.length)
        if (injureTarget) {
          this.$message.error(`至少选择一个${injureTarget.serviceItemName}的损伤类型`)
          return false
        }
        this.toCheckOrder(operation)
      }
    },
    toCheckOrder(operation, addQuery = {}) {
      let claimsQuery = {},
        _accountMatchResultList = []
      claimsQuery = this.handlerClaimsQueryForCheck()
      if (operation == 20) {
        const flag = this.verifyWarningImage()
        if (!flag) return
      }
      if (this.queryList && this.queryList.length > 0) {
        const _temArr = JSON.stringify(this.queryList)
        _accountMatchResultList = JSON.parse(_temArr)
        _accountMatchResultList.forEach(el => {
          delete el.matchType
        })
      }
      let _para = {
        operation,
        id: this.orderDetailInfo.id,
        accountMatchResultList: _accountMatchResultList || [],
        equitySource: 2,
        ...addQuery,
        ...claimsQuery
      }
      _para.serviceItemsList = this.serviceItemsList.map(item => {
        const { purchaseTax, depreciation, commercialInsurance, registrationFee, retrofits, scooterFare, serviceItemCode, serviceItemType, damageType } = item
        return {
          purchaseTax: purchaseTax ? NP.times(purchaseTax, 100) : purchaseTax,
          depreciation: depreciation ? NP.times(depreciation, 100) : depreciation,
          serviceItemCode,
          commercialInsurance: commercialInsurance ? NP.times(commercialInsurance, 100) : commercialInsurance,
          registrationFee: registrationFee ? NP.times(registrationFee, 100) : registrationFee,
          retrofits: retrofits ? NP.times(retrofits, 100) : retrofits,
          scooterFare: scooterFare ? NP.times(scooterFare, 100) : scooterFare,
          damageType: item.serviceItemType == 2 && item?.damageType?.length ? item.damageType.join(',') : ''
        }
      })
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      this.$apis.claims.commitClaimsOrder(_para).then(res => {
        loading.close()
        if (res) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.handleCancel()
        }
      })
    },
    getWarningData(e) {
      if (e) {
        let arr = []
        e.forEach(el => {
          let obj = {
            id: el.id,
            verifyResultDesc: el.verifyResultDesc,
            accountVerifyImagesList: el.accountVerifyImagesList,
            matchType: el.matchType
          }
          arr.push(obj)
        })
        this.queryList = arr
      }
    },
    changeObjectType(newVal) {
      if (newVal === 1) {
        this.saveObj.objectType = newVal
        delete this.saveObj.handlerName
        delete this.saveObj.handlerPhone
        this.accountForm = { ...this.accountForm, ...this.saveObj }
      } else {
        this.saveObj = { ...this.accountForm }
        this.getAccountInfo(this.editForm.contractNo)
      }
    },
    initSaveObj() {
      this.saveObj = { ...this.accountForm }
    },
    //详情
    getDetailById() {
      this.$apis.claims.getClaimsDetail({ id: this.routeInfo.orderId }).then(res => {
        this.refitInfo = res?.equityOrderDetail || {}
        // 以下是report数据
        for (let key in this.editForm) {
          this.editForm[key] = res[key]
        }
        this.editForm.reportDate = res.reporterDate
        this.editForm.reimbursementAddress = []
        const { reimbursementCityCode, reimbursementCountiesCode, reimbursementProvinceCode, serviceItemsList } = res
        this.editForm.reimbursementAddress.push(reimbursementProvinceCode, reimbursementCityCode, reimbursementCountiesCode)
        // 以下是repair数据
        for (let key in this.accountForm) {
          this.accountForm[key] = res[key]
        }
        if (this.accountForm.objectType !== 1) {
          this.accountForm.accountType = 0
          this.accountForm.objectType = 0
        }
        if (this.accountForm.accountType !== 1) this.accountForm.accountType = 0
        this.serviceItemsList =
          serviceItemsList.map(item => {
            return {
              ...item,
              purchaseTax: item.purchaseTax ? NP.divide(item.purchaseTax, 100) : item.purchaseTax,
              depreciation: item.depreciation ? NP.divide(item.depreciation, 100) : item.depreciation,
              commercialInsurance: item.commercialInsurance ? NP.divide(item.commercialInsurance, 100) : item.commercialInsurance,
              registrationFee: item.registrationFee ? NP.divide(item.registrationFee, 100) : item.registrationFee,
              retrofits: item.retrofits ? NP.divide(item.retrofits, 100) : item.retrofits,
              scooterFare: item.scooterFare ? NP.divide(item.scooterFare, 100) : item.scooterFare,
              damageType: item?.damageType ? item.damageType.split(',').map(ele => Number(ele)) : []
            }
          }) || []

        console.log(this.serviceItemsList, ' this.serviceItemsList ')
        // 以下是文件数据
        res.files.forEach(item => {
          let obj = { url: item.fileUrl, fileType: item.fileType, name: item.fileName, progress: 100 }
          if (item.fileCode == '1') {
            if (item.fileName.indexOf('&front&_') === 0) {
              this.materialForm.idCard.push(obj)
            } else {
              this.materialForm.idCardBack.push(obj)
            }
          } else if (item.fileCode == '31') {
            this.materialForm.billInfo.push(obj)
          } else if (item.fileCode == '4') {
            this.materialForm.otherInfo.push(obj)
          }
        })
        if (res.status == 19) {
          this.dangerWran()
          this.pageType = 2
        }
        this.detailOrderStatus = res.status
        let _tempArr = []
        res.accountMatchResultList.forEach(el => {
          let arr = []
          el.accountVerifyImagesList.forEach(ele => {
            let obj = { verifyImage: ele.verifyImage }
            arr.push(obj)
          })
          el.accountVerifyImagesList = arr
          let _temp = {
            id: el.id,
            accountVerifyImagesList: arr,
            verifyResultDesc: el.verifyResultDesc,
            matchType: el.matchType
          }
          _tempArr.push(_temp)
        })
        this._temp_queryList = _tempArr
        this.accountMatchResultList = res.accountMatchResultList
        this.orderDetailInfo = res
        this.reasonForFailure = res.reasonForFailure
        this.reasonForFailureCode = res.reasonForFailureCode
        this.pageShow = true
      })
    },
    // 新增的时候,输入合同号,带出信息
    toSearchOrderDetail() {
      let param = {}
      param.contractNo = this.editForm.contractNo
      let targetAPI = this.$apis.claims.checkContractNo
      if (this.routeInfo.isGH) {
        param.writeOffCode = this.editForm.writeOffCode
        targetAPI = this.$apis.claims.getDetailByWOCode
      }
      targetAPI(param).then(res => {
        this.permitDraft = true
        const { serviceItemsList, contractNo } = res
        for (let key in this.editForm) {
          this.editForm[key] = res[key] || this.editForm[key]
        }
        this.serviceItemsList =
          serviceItemsList.map(item => {
            return {
              ...item,
              damageType: []
            }
          }) || []
        this.getAccountInfo(contractNo)
      })
    },
    // 点击同步,获取收款人信息
    getAccountInfo(contractNo) {
      if (!contractNo) return
      this.$apis.claims.getAccountInfo({ contractNo }).then(res => {
        const { accountName, accountCityCode: bankCity, openBankCode: branchBankCode, accountNo, accountType, cardNo: payeeIDCardNo, cardTypeCode: payeeIDCardType, phone: payeePhone } = res || {}
        const result = { accountName, bankCity, branchBankCode, accountNo, accountType, payeeIDCardNo, payeeIDCardType, payeePhone }
        // for (let key in this.accountForm) {
        //   this.accountForm[key] = result[key] || this.accountForm[key]
        // }
        this.accountForm = { ...this.accountForm, ...result }
        if (this.accountForm.accountType !== 1) this.accountForm.accountType = 0
        if (this.accountForm.objectType !== 1) this.accountForm.accountType = 0
      })
    },
    // 根据页面跳转参数处理表单信息-自动填入
    // 步骤流程:拿到核销码/合同号后==》请求接口获取该合同号/核销码下对应的套餐,下发数据到维修信息模块,上传资料模块,报案信息模块
    handleFormInfo(contractNo, isGH) {
      if (isGH) {
        this.editForm.writeOffCode = contractNo
      }
      this.editForm.contractNo = contractNo
    },
    // 提交的时候校验,滴加不校验经办人信息
    validAccountInfo() {
      let valid = false
      this.$refs.repairRef.$refs.accountRef.$refs.formRef.validate(aValid => {
        this.$refs.reportRef.$refs.editFormRefReport.$refs.formRef.validate(eValid => {
          if (aValid && eValid) {
            valid = true
          }
          if (this.routeInfo.isGH) {
            this.$refs.repairRef.$refs.handlerRef.$refs.formRef.validate(hValid => {
              valid = hValid
            })
          }
        })
      })
      if (!valid) return valid
      let requirePrice = true,
        lossAssTipItem = null,
        approItem = null,
        custPriTag = null
      this.serviceItemsList.forEach(item => {
        if (item.approveAmount > 0) {
          requirePrice = false
        }
        if (item.approveAmount > 0 && !item.customerApplyAmount && !this.routeInfo.isGH) {
          custPriTag = item
        }
        if (item.approveAmount && item.lossAssessmentFlag && !item.lossAssessmentAmount) {
          lossAssTipItem = item
        }
        if (!item.approveAmount && ((item.lossAssessmentFlag && item.lossAssessmentAmount) || item.customerApplyAmount)) {
          approItem = item
        }
      })
      if (requirePrice) {
        this.$message.error('至少输入一项服务的定损批准金额')
        return false
      }
      if (custPriTag) {
        this.$message.error(`请输入${custPriTag.serviceItemName}的申请金额`)
        return false
      }
      if (approItem) {
        this.$message.error(`请输入${approItem.serviceItemName}的定损批准金额`)
        return false
      }
      if (lossAssTipItem) {
        this.$message.error(`请输入${lossAssTipItem.serviceItemName}的保险公司定损金额`)
        return false
      }
      const priceTarget = this.serviceItemsList?.find(item => item.serviceItemType == 1 && item.approveAmount > 0 && !item.purchaseTax && !item.depreciation && !item.commercialInsurance && !item.registrationFee && !item.retrofits && !item.scooterFare)
      if (priceTarget) {
        this.$message.error(`${priceTarget.serviceItemName}的购置税、折旧费、商业险保费、登记费、加改装件费用、代步车费用,至少输入一个`)
        return false
      }
      const injureTarget = this.serviceItemsList?.find(item => item.serviceItemType == 2 && item.approveAmount > 0 && !item?.damageType?.length)
      console.log(injureTarget, 'injureTarget')
      if (injureTarget) {
        this.$message.error(`至少选择一个${injureTarget.serviceItemName}的损伤类型`)
        return false
      }
      let fileTip = false
      for (let key in this.materialForm) {
        if (this.materialForm[key].length < 1 && !fileTip) {
          fileTip = true
        }
      }
      if (fileTip) {
        this.$message.error(`请补全资料`)
        return false
      }
      return valid
    },
    // 提交核赔
    confirmSubmit(type) {
      if (type == 1 && !this.validAccountInfo()) {
        return false
      }
      let isUpload = false
      for (let key in this.materialForm) {
        this.materialForm[key].forEach(item => {
          if (!item.url) isUpload = true
        })
      }
      if (isUpload) {
        this.$message.error(`文件正在上传,请稍后再${type == 1 ? '提交' : '保存草稿'}`)
        return false
      }
      if (!this.routeInfo.orderId && type == 2 && !this.permitDraft) {
        this.$message.error('请同步信息之后再保存草稿')
        return
      }
      const params = { ...this.editForm, ...this.accountForm }
      if (params.accountType !== 1) {
        params.accountType = 0
      }
      params.operation = type
      params.reimbursementDate = params.reimbursementDate ? util.dateFormat(params.reimbursementDate, 'YYYY-MM-DD HH:mm:ss') : ''
      params.internalReimbursementDate = params.internalReimbursementDate ? util.dateFormat(params.internalReimbursementDate, 'YYYY-MM-DD HH:mm:ss') : ''
      params.reportDate = params.reportDate ? util.dateFormat(params.reportDate, 'YYYY-MM-DD HH:mm:ss') : ''
      if (params.reimbursementAddress.length == 3) {
        params.reimbursementProvinceCode = params.reimbursementAddress[0]
        params.reimbursementCityCode = params.reimbursementAddress[1]
        params.reimbursementCountiesCode = params.reimbursementAddress[2]
      }
      params.approveAmounts = ''
      let tagetObj = {},
        lossAssessmentTarget = {},
        customesPriceObj = {}
      this.serviceItemsList.forEach(item => {
        tagetObj[item.serviceItemCode] = item.approveAmount
        customesPriceObj[item.serviceItemCode] = item.customerApplyAmount
        if (item.lossAssessmentFlag) {
          lossAssessmentTarget[item.serviceItemCode] = item.lossAssessmentAmount
        }
      })
      params.serviceItemsList = this.serviceItemsList.map(item => {
        const { purchaseTax, depreciation, commercialInsurance, registrationFee, retrofits, scooterFare, serviceItemCode, serviceItemType, damageType } = item
        return {
          purchaseTax: purchaseTax ? NP.times(purchaseTax, 100) : purchaseTax,
          depreciation: depreciation ? NP.times(depreciation, 100) : depreciation,
          serviceItemCode,
          commercialInsurance: commercialInsurance ? NP.times(commercialInsurance, 100) : commercialInsurance,
          registrationFee: registrationFee ? NP.times(registrationFee, 100) : registrationFee,
          retrofits: retrofits ? NP.times(retrofits, 100) : retrofits,
          scooterFare: scooterFare ? NP.times(scooterFare, 100) : scooterFare,
          damageType: item.serviceItemType == 2 && item?.damageType?.length ? item.damageType.join(',') : ''
        }
      })
      params.approveAmounts = JSON.stringify(tagetObj)
      params.customerApplyAmounts = JSON.stringify(customesPriceObj)
      params.lossAssessmentAmounts = JSON.stringify(lossAssessmentTarget)
      delete params.reimbursementAddress
      params.fileList = []
      for (let key in this.materialForm) {
        this.materialForm[key].forEach((item, index) => {
          const obj = {}
          obj.fileType = item.fileType
          obj.fileUrl = item.url
          obj.fileCode = key == 'idCard' || key == 'idCardBack' ? 1 : key == 'billInfo' ? 31 : 4
          obj.fileName = item.name
          params.fileList.push(obj)
        })
      }
      if (this.routeInfo.orderId) {
        params.id = this.routeInfo.orderId
      }
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      if (!this.routeInfo.isGH) {
        params.equitySource = 2
      }
      this.$apis.claims.commitClaimsOrder(params).then(res => {
        loading.close()
        if (res) {
          if (res.accountMatchResultList && res.accountMatchResultList.length) {
            res.accountMatchResultList.forEach(el => {
              el.accountVerifyImagesList = el.accountVerifyImagesList || []
            })
            this.accountMatchResultList = res.accountMatchResultList || []
            this.dialogVisible = true
            this.needBack = true
          }
          this.$message({
            message: type == 1 ? '提交成功' : '保存草稿成功',
            type: 'success'
          })
          if (type != 1 || !res.accountMatchResultList || !res.accountMatchResultList.length) {
            this.handleCancel()
          }
        }
      })
    },
    handleCancel() {
      this.$router.push({ path: '/claims/index' })
    },
    // 风险预警
    dangerWran() {
      this.dialogVisible = true
    },
    cancelWarning() {
      if (this.needBack) {
        this.handleCancel()
      }
      this.dialogVisible = false
    },
    handleWarning() {
      this.cancelWarning()
    }
  }
}
</script>
<style lang="scss" scoped>
.title {
  padding: 0 20px;
  font-size: 16px;
  font-weight: bold;
  height: 58px;
  line-height: 58px;
  border-bottom: 1px solid #d8d8d8;
  margin: 0 0;
  color: #333;
}
.refit-info {
  margin-top: 20px;
  background-color: #ffffff;
  .refit-img {
    padding: 20px;
    display: inline-block;
  }
  .label {
    vertical-align: top;
    width: 154px;
    height: 20px;
    display: inline-block;
    font-weight: 400;
    font-size: 14px;
    color: #666666;
    text-align: right;
    line-height: 20px;
  }
  .img {
    height: 104px;
    width: 104px;
    border-radius: 4px;
  }
}
.fail_status_widget {
  width: 100%;
  height: 40px;
  background: #ffeed9;
  border-radius: 4px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding-left: 16px;
  i {
    color: #fdb757;
  }
  span {
    font-weight: 400;
    font-size: 14px;
    color: #000000a6;
    margin-left: 8px;
  }
}
.footer {
  width: 100%;
  position: fixed;
  bottom: 0;
  height: 64px;
  left: 0;
  text-align: center;
  line-height: 64px;
  background: #ffffff;
}
.warning_body {
  .maxtitle {
    font-weight: 600;
    font-size: 20px;
    color: #333333;
  }
  .header {
    display: flex;
    flex-direction: column;
    align-items: center;
    i {
      color: #fdb757;
      font-size: 48px;
    }
    .title {
      font-weight: 600;
      font-size: 16px;
      color: #333333;
      line-height: 24px;
      margin: 8px 0 4px 0;
    }
    .cont {
      font-weight: 400;
      font-size: 14px;
      color: #666666;
      margin-bottom: 20px;
    }
  }
  .main {
    .element {
      background: #f9f9f9;
      box-sizing: border-box;
      padding: 12px 16px;
      margin-bottom: 10px;
      .e_title {
        font-weight: 400;
        font-size: 14px;
        color: #333333;
        margin-bottom: 4px;
        line-height: 20px;
      }
      .e_desc {
        font-weight: 400;
        font-size: 14px;
        color: #999999;
        line-height: 20px;
      }
    }
  }
}
/deep/ .el-dialog__footer {
  text-align: center;
}
/deep/ .el-dialog__header {
  padding: 16px 20px;
  .el-dialog__title {
    font-weight: 600;
  }
}
</style>