commonElectricalEnergy.vue 29.5 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
<template>
  <a-spin :spinning="confirmLoading">
    <a-form :form="form">
      <a-card title="基本信息" :bordered="false" class="scoped-approval">
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:16}" label="婚否">
            <a-radio-group v-decorator="['cusSupplementaryInfo.marriageStatus',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.marriageStatus:''}]">
              <a-radio :value="0">未知</a-radio>
              <a-radio :value="1">已婚</a-radio>
              <a-radio :value="2">未婚</a-radio>
              <a-radio :value="3">离异</a-radio>
            </a-radio-group>
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-item :labelCol="{span:12}" :wrapperCol="{span:10}" label="是否有实控人">
              <a-radio-group v-decorator="['cusSupplementaryInfo.actualControllersStatus',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.actualControllersStatus:''}]" @change="onChangePerson">
                <a-radio :value="0">无</a-radio>
                <a-radio :value="1">有</a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :span="8" v-show="actualShow">
            <a-form-item label="实控人姓名" :labelCol="{span:10}" :wrapperCol="{span:14}">
              <a-input v-decorator="['cusSupplementaryInfo.actualControllersName',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.actualControllersName:''}]" />
            </a-form-item>
          </a-col>
          <a-col :span="8" v-show="actualShow">
            <a-form-item label="实控人电话" :labelCol="{span:10}" :wrapperCol="{span:14}">
              <a-input v-decorator="['cusSupplementaryInfo.actualControllersPhone',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.actualControllersPhone:''}]" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:7}" label="从业年限(年)">
            <a-input v-decorator="['cusSupplementaryInfo.workingYear',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.workingYear:''}]" />
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:7}" label="是否有被执行信息">
            <a-input v-decorator="['cusSupplementaryInfo.executedInformation',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.executedInformation:''}]" />
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:7}" label="与所留联系人的关系">
            <a-input v-decorator="['cusSupplementaryInfo.relation',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.relation:''}]" />
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:7}" label="居住地址">
            <a-input v-decorator="['cusSupplementaryInfo.homeAddress',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.homeAddress:''}]" />
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item :labelCol="{span:10}" :wrapperCol="{span:8}" label="实际地址与注册地是否一致">
              <a-radio-group v-decorator="['cusSupplementaryInfo.registeredPlaceStatus',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.registeredPlaceStatus:''}]" @change="onChangeAddress">
                <a-radio :value="true">是</a-radio>
                <a-radio :value="false">否</a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
          <a-col :span="12" v-show="!addressShow">
            <a-form-item :labelCol="{span:4}" :wrapperCol="{span:20}" label="实际地址">
              <a-input v-decorator="['cusSupplementaryInfo.registeredPlace',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.registeredPlace:''}]" />
            </a-form-item>
          </a-col>
        </a-row>
      </a-card>
      <a-card title="经营模式及规模" :bordered="false">
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:20}" label="是否有集散场地">
            <a-radio-group v-decorator="['cusSupplementaryInfo.distributingCenterStatus',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.distributingCenterStatus:''}]">
              <a-radio :value="true">有</a-radio>
              <a-radio :value="false">无</a-radio>
            </a-radio-group>
          </a-form-item>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-item :labelCol="{span:12}" :wrapperCol="{span:12}" label="自有车辆数">
              <a-input v-decorator="['cusSupplementaryInfo.vehicleNumber',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.vehicleNumber:''}]" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item :labelCol="{span:12}" :wrapperCol="{span:12}" label="挂靠车辆数">
              <a-input v-decorator="['cusSupplementaryInfo.anchoredVehicleNumber',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.anchoredVehicleNumber:''}]" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:20}" label="企业类型">
            <a-radio-group :options="childDotData" v-decorator="['cusSupplementaryInfo.enterprisesType',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.enterprisesType:''}]" @change="onChange" />
            </a-radio-group>
          </a-form-item>
        </a-row>
        <a-row :gutter="24" v-if="dedicatedShow">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:20}" label="专线">
            <a-table ref="table" size="middle" bordered rowKey="id" :columns="specialLineData" :dataSource="cusDedicatedLineList" :pagination="false" :loading="loading" style="padding-top:40px;">
              <template v-if="(typeof record.id )!='number'" slot="departureLine" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChange(record.id,'departureLine', $event)" />
              </template>
              <template v-if="(typeof record.id )!='number'" slot="monthAverageDeparture" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChange(record.id,'monthAverageDeparture', $event)" />
              </template>
              <template v-if="(typeof record.id )!='number'" slot="singleFreight" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChange(record.id,'singleFreight', $event)" />
              </template>
            </a-table>
          </a-form-item>
        </a-row>
        <a-row :gutter="24" v-if="motorcadeShow">
          <a-form-item :labelCol="{span:4}" :wrapperCol="{span:20}" label="车队及三方">
            <a-table ref="table" size="middle" bordered rowKey="id" :columns="motorcadeData" class="noneIcon" :dataSource="cusThreePartyInfoList" :pagination="false" :loading="loading" style="padding-top:40px;">
              <template slot="sourceName" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChangeSpecial(record.id,'sourceName', $event)" />
              </template>
              <template slot="ratio" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChangeSpecial(record.id,'ratio', $event)" />
              </template>
              <template slot="freight" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChangeSpecial(record.id,'freight', $event)" />
              </template>
              <template slot="cooperationYears" slot-scope="text, record">
                <editable-cell :text="text" @change="onCellChangeSpecial(record.id,'cooperationYears', $event)" />
              </template>
            </a-table>
          </a-form-item>
        </a-row>
      </a-card>
      <a-card title="成本" :bordered="false">
        <a-table ref="table" size="middle" bordered rowKey="id" :columns="costData" class="noneIcon" :dataSource="cusCostInfoList" :pagination="false" :loading="loading" style="padding-top:20px;">
          <template slot="amount" slot-scope="text, record">
            <editable-cell :text="text" @change="onCellChangeCost(record.id,'amount', $event)" />
          </template>
          <template slot="remark" slot-scope="text, record">
            <editable-cell :text="text" @change="onCellChangeCost(record.id,'remark', $event)" />
          </template>
        </a-table>
      </a-card>
      <a-card title="负债" :bordered="false">
        <a-table ref="table" size="middle" bordered rowKey="id" :columns="liabilitiesData" :dataSource="cusLiabilitiesInfoList" class="noneIcon" :pagination="false" :loading="loading" style="padding-top:20px;">
          <template slot="amount" slot-scope="text, record">
            <editable-cell :text="record.amountRatio?record.amountRatio:record.amount" @change="onCellChangeLiabi(record.id,'amount', $event)" />
          </template>
          <template slot="remark" slot-scope="text, record">
            <editable-cell :text="text" @change="onCellChangeLiabi(record.id,'remark', $event)" />
          </template>
        </a-table>
      </a-card>
      <a-card title="备注" :bordered="false">
        <a-form-item label="">
          <a-textarea rows="4" placeholder="最多输入2000字" v-decorator="['cusSupplementaryInfo.remark',{'initialValue':cusSupplementaryInfo?cusSupplementaryInfo.remark:''}]" />
        </a-form-item>
      </a-card>
      <a-row :gutter="24" style="float:right;margin-right:20px;margin-bottom:20px;">
        <a-button type="primary" @click="handleSubmit">确定</a-button>
      </a-row>
    </a-form>
  </a-spin>
</template>
<script>
import { JeecgListMixin } from '@/mixins/CoreListMixin'
import { queryCusPhoneCheckInfo, saveCusPhoneCheckInfo } from '@/api/configApi'
import EditableCell from './EditableCell'
export default {
  name: 'personApprovalRecord',
  mixins: [JeecgListMixin],
  components: {
    EditableCell,
  },
  props: {
    userType: {
      type: Number,
      default: null,
    },
    customerNo: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      disRead: true,
      confirmLoading: false,
      current: 3,
      actualShow: true, // 是否有实控人 否 隐藏
      addressShow: false, // 实际地址与注册地址是否一致  是 隐藏
      phoneCheckLoanTypeCode: JSON.parse(sessionStorage.getItem('PHONE_CHECK_LOAN_TYPE_CODE')), // 电核负债类型
      phoneCheckCostTypeCode: JSON.parse(sessionStorage.getItem('PHONE_CHECK_COST_TYPE_CODE')), // 电核成本类型
      dedicatedShow: false, // 专线
      motorcadeShow: false, // 车队及三方
      freightSum: 0, // 车队及三方专线总费用   销售负债比计算用
      cusSupplementaryInfo: '', // 基本信息
      cusLiabilitiesInfoList: [],// 负债信息
      cusCostInfoList: [], // 成本信息
      cusDedicatedLineList: [], // 专线信息
      cusThreePartyInfoList: [], // 三方及车队信息 
      childDotData: [
        {
          label: '专线',
          value: '1',
        },
        {
          label: '车队',
          value: '2',
        },
        {
          label: '三方',
          value: '3',
        },
        {
          label: '专线 + 车队',
          value: '12',
        },
        {
          label: '专线 + 三方',
          value: '13',
        },
      ],
      specialLineData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
            return typeof (t.id) == 'number' ? '运费合计' : '线路' + (parseInt(index) + 1)
          }
        },
        {
          title: '线路',
          align: 'center',
          dataIndex: 'departureLine',
          scopedSlots: { customRender: 'departureLine' },
        },
        {
          title: '月均发车趟',
          align: 'center',
          dataIndex: 'monthAverageDeparture',
          scopedSlots: { customRender: 'monthAverageDeparture' },
        },
        {
          title: '单趟运费(元)',
          align: 'center',
          dataIndex: 'singleFreight',
          scopedSlots: { customRender: 'singleFreight' },
        },
        {
          title: '运费(元)',
          align: 'center',
          dataIndex: 'freight',
        }
      ],
      motorcadeData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
            return typeof (t.id) == 'number' ? '运费合计' : '货源' + (parseInt(index) + 1)
          }
        },
        {
          title: '货源方名称',
          align: 'center',
          dataIndex: 'sourceName',
          scopedSlots: { customRender: 'sourceName' },
        },
        {
          title: '占比(%)',
          align: 'center',
          dataIndex: 'ratio',
          scopedSlots: { customRender: 'ratio' },
        },
        {
          title: '运费',
          align: 'center',
          dataIndex: 'freight',
          scopedSlots: { customRender: 'freight' },
        },
        {
          title: '合作年限',
          align: 'center',
          dataIndex: 'cooperationYears',
          scopedSlots: { customRender: 'cooperationYears' },
        },
      ],
      costData: [
        {
          title: '成本项目',
          align: 'center',
          dataIndex: 'costNameCode',
          customRender: (t, r, index) => {
            if (t == '成本合计') {
              return t
            } else {
              for (var i = 0; i < this.phoneCheckCostTypeCode.length; i++) {
                if (t === this.phoneCheckCostTypeCode[i].name) {
                  return this.phoneCheckCostTypeCode[i].title
                }
              }
            }
          }
        },
        {
          title: '金额(元)',
          align: 'center',
          dataIndex: 'amount',
          scopedSlots: { customRender: 'amount' },
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remark',
          scopedSlots: { customRender: 'remark' },
        },
      ],
      liabilitiesData: [
        {
          title: '贷款种类',
          align: 'center',
          dataIndex: 'loanTypeCode',
          customRender: (t, r, index) => {
            if (t == '销售负债比') {
              return t;
            } else {
              for (var i = 0; i < this.phoneCheckLoanTypeCode.length; i++) {
                if (t === this.phoneCheckLoanTypeCode[i].name) {
                  return this.phoneCheckLoanTypeCode[i].title
                }
              }
            }
          }
        },
        {
          title: '金额(元)',
          align: 'center',
          dataIndex: 'amount',
          scopedSlots: { customRender: 'amount' },
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remark',
          scopedSlots: { customRender: 'remark' },
        },
      ],
      form: this.$form.createForm(this),
      disableMixinCreated: true,
      url: {
        list: '/admin/collPersonalApply/queryCollPersonalApplyList',
      },
    }
  },
  created () {
    console.log(this.customerNo)
    this.defineAssignment()
  },
  methods: {
    loadData () {
      this.cusSupplementaryInfo = '';
      let _p = { 'customerNo': this.customerNo }
      // let _p = { 'customerNo': 'E20200317150433938058' } 
      queryCusPhoneCheckInfo(_p).then(res => {
        console.log(res.result)
        if (res.status.statusCode == 0) {
          let data = res.result
          this.cusSupplementaryInfo = data.cusSupplementaryInfo
          // 是否有实控人
          if (this.cusSupplementaryInfo.actualControllersStatus == 0) {
            this.actualShow = false;
          } else {
            this.actualShow = true;
          }
          // 地址是否一致
          if (this.cusSupplementaryInfo.registeredPlaceStatus) {
            this.addressShow = true
          } else {
            this.addressShow = false;
          }
          let type = this.cusSupplementaryInfo.enterprisesType
          if (type == 1) { // 根据类型展示专线 车队及三方
            this.dedicatedShow = true;
            this.cusDedicatedLineList = this.Total(data.cusDedicatedLineList)
          } else if (type == 2 || type == 3) {
            this.cusThreePartyInfoList = this.Total(data.cusThreePartyInfoList)
            this.motorcadeShow = true;
          } else if (type == 12 || type == 13) {
            this.dedicatedShow = true;
            this.motorcadeShow = true;
            this.cusThreePartyInfoList = this.Total(data.cusThreePartyInfoList)
            this.cusDedicatedLineList = this.Total(data.cusDedicatedLineList)
          }
          this.cusCostInfoList = data.cusCostInfoList.length > 0 ? this.Total(data.cusCostInfoList) : this.cusCostInfoList
          this.cusLiabilitiesInfoList = data.cusLiabilitiesInfoList.length > 0 ? this.TotalLiabilities(data.cusLiabilitiesInfoList) : this.cusLiabilitiesInfoList // 需计算
        } else {
          this.$message.warning(res.status.statusReason)
          this.defineAssignment()
          this.dedicatedShow = false;
          this.motorcadeShow = false;
        }
      })
    },
    Total (data) { // 合计处理
      console.log(data)
      let
        freightSum = 0, // 专线 车队及三方 =>运费
        ratioSum = 0, // 车队及三方 =>占比
        cooperationYearsSum = 0, // 车队及三方 =>合作年限
        amountSum = 0; // 成本=>金额(元)
      data.map(v => {
        freightSum += v.freight
        ratioSum += v.ratio
        cooperationYearsSum += v.cooperationYears
        amountSum += v.amount
      })
      if (freightSum) {
        this.freightSum += freightSum
      }
      let total = {
        'id': new Date().getTime(),
        'departureLine': '',
        'sourceName': '',
        'costNameCode': '成本合计',
        'loanTypeCode': '销售负债比',
        'remark': '',
        'monthAverageDeparture': '', // monthAverageDepartureSum
        'singleFreight': '', // singleFreightSum
        'ratio': ratioSum.toFixed(2),
        'cooperationYears': cooperationYearsSum.toFixed(2),
        'freight': freightSum.toFixed(2),
        'amount': amountSum.toFixed(2),
      }
      data.push(total)
      return data;
    },
    TotalLiabilities (data) {
      let amountRatio = 0; // 负债=>销售负债比
      data.map(v => {
        amountRatio += v.amount
      })
      let total = {
        'id': new Date().getTime(),
        'loanTypeCode': '销售负债比',
        'remark': '',
        'amountRatio': (amountRatio / this.freightSum).toFixed(2)
      }
      data.push(total)
      return data;
    },
    onChangeAddress (e) {
      // 实际地址与注册地址是否一致 false 否  true 是
      this.addressShow = e.target.value
    },
    onChangePerson (e) {
      // 是否有实控人  0 无   1  有
      if (e.target.value == 0) {
        this.actualShow = false;
      } else {
        this.actualShow = true;
      }
    },
    onChange (e) {
      // 企业类型 1专线 2车队 3三方 12专线+车队 13专线+三方
      switch (e.target.value) {
        case '1':
          this.dedicatedShow = true;
          this.motorcadeShow = false;
          break;
        case '2':
          this.motorcadeShow = true;
          this.dedicatedShow = false;
          break;
        case '3':
          this.motorcadeShow = true;
          this.dedicatedShow = false;
          break;
        case '12':
          this.dedicatedShow = true;
          this.motorcadeShow = true;
          break;
        case '13':
          this.dedicatedShow = true;
          this.motorcadeShow = true;
          break;
        default:
          break;
      }
    },
    onCellChange (id, dataIndex, value) { // table 专线 录入
      this.initCusLiablities();
      const cusDedicatedLineList = [...this.cusDedicatedLineList];
      const target = cusDedicatedLineList.find(item => item.id === id);
      if (target) {
        target[dataIndex] = value;
        this.cusDedicatedLineList = cusDedicatedLineList;
      }
      let freightSum = 0;
      this.cusDedicatedLineList.map((v, i) => {
        v.freight = v.monthAverageDeparture * v.singleFreight
        freightSum += v.freight
        if (i + 1 == this.cusDedicatedLineList.length) {
          v.freight = freightSum
        }
      })
    },
    onCellChangeSpecial (id, dataIndex, value) { // table 车队及三方 录入
      this.initCusLiablities();
      const cusThreePartyInfoList = [...this.cusThreePartyInfoList];
      const target = cusThreePartyInfoList.find(item => item.id === id);
      if (target) {
        target[dataIndex] = value;
        this.cusThreePartyInfoList = cusThreePartyInfoList;
      }
      let ratioSum = 0, // 车队及三方 =>占比
        freightSum = 0, // 专线 车队及三方 =>运费
        cooperationYearsSum = 0; // 车队及三方 =>合作年限
      this.cusThreePartyInfoList.map((v, i) => {
        if (i + 1 != this.cusThreePartyInfoList.length) {
          ratioSum += v.ratio * 1
          freightSum += v.freight * 1
          cooperationYearsSum += v.cooperationYears * 1
        } else {
          let item = {
            id: new Date().getTime(),
            ratio: ratioSum.toFixed(2),
            freight: freightSum.toFixed(2),
            cooperationYears: cooperationYearsSum.toFixed(2),
          }
          this.$set(this.cusThreePartyInfoList, i, item)
        }
      })
    },
    onCellChangeCost (id, dataIndex, value) { // table 成本 录入
      const cusCostInfoList = [...this.cusCostInfoList];
      const target = cusCostInfoList.find(item => item.id === id);
      if (target) {
        target[dataIndex] = value;
        this.cusCostInfoList = cusCostInfoList;
      }
      let amountSum = 0; // 成本合计
      this.cusCostInfoList.map((v, i) => {
        if (i + 1 != this.cusCostInfoList.length) {
          amountSum += v.amount * 1
        } else {
          let item = {
            id: new Date().getTime(),
            costNameCode: '成本合计',
            amount: amountSum.toFixed(2),
          }
          this.$set(this.cusCostInfoList, i, item)
        }
      })
    },
    onCellChangeLiabi (id, dataIndex, value) { // table 负债 录入
      const cusLiabilitiesInfoList = [...this.cusLiabilitiesInfoList];
      const target = cusLiabilitiesInfoList.find(item => item.id === id);
      if (target) {
        target[dataIndex] = value;
        this.cusLiabilitiesInfoList = cusLiabilitiesInfoList;
      }
      let sum = 0; // 车队和专线运费合计 计算负债比 
      if (this.dedicatedShow && this.motorcadeShow) { // 全部勾选 
        sum = this.cusDedicatedLineList[3].freight * 1 + this.cusThreePartyInfoList[3].freight * 1
      } else if (this.dedicatedShow) { // 勾选专线 
        sum = this.cusDedicatedLineList[3].freight
      } else if (this.motorcadeShow) { // 勾选车队或者三方
        sum = this.cusThreePartyInfoList[3].freight
      }
      let amountSum = 0; // 成本合计
      this.cusLiabilitiesInfoList.map((v, i) => {
        if (i + 1 != this.cusLiabilitiesInfoList.length) {
          amountSum += v.amount * 1
        } else {
          let item = {
            id: new Date().getTime(),
            loanTypeCode: '销售负债比',
            amount: amountSum / sum != 'Infinity' ? (amountSum / sum).toFixed(2) : 0.00,
          }
          this.$set(this.cusLiabilitiesInfoList, i, item)
        }
      })
    },
    handleSubmit () {
      // 触发表单验证
      this.form.validateFields((err, values) => {
        console.log(err, values)
        if (!err) {
          if (!this.actualShow) { // 没有实控人的话 清空实控人姓名和电话
            values.cusSupplementaryInfo.actualControllersName = ''
            values.cusSupplementaryInfo.actualControllersPhone = ''
          }
          if (this.addressShow) { // 地址一致的话 清空地址内容
            values.cusSupplementaryInfo.registeredPlace = ''
          }
          let formData = Object.assign({}, values)
          formData.cusLiabilitiesInfoList = [...this.cusLiabilitiesInfoList] // 负债信息
          formData.cusLiabilitiesInfoList.pop()
          this.delId(formData.cusLiabilitiesInfoList)
          formData.cusCostInfoList = [...this.cusCostInfoList] // 成本信息
          formData.cusCostInfoList.pop()
          this.delId(formData.cusCostInfoList)

          if (this.dedicatedShow && this.motorcadeShow) { // 专线
            formData.cusDedicatedLineList = [...this.cusDedicatedLineList] // 专线信息
            formData.cusDedicatedLineList.pop()
            this.delId(formData.cusDedicatedLineList)
            formData.cusThreePartyInfoList = [...this.cusThreePartyInfoList] // 三方及车队信息
            formData.cusThreePartyInfoList.pop()
            this.delId(formData.cusThreePartyInfoList)
          } else if (this.motorcadeShow) {
            formData.cusThreePartyInfoList = [...this.cusThreePartyInfoList] // 三方及车队信息
            formData.cusThreePartyInfoList.pop()
            this.delId(formData.cusThreePartyInfoList)
          } else if (this.dedicatedShow) {
            formData.cusDedicatedLineList = [...this.cusDedicatedLineList] // 专线信息
            formData.cusDedicatedLineList.pop()
            this.delId(formData.cusDedicatedLineList)
          }
          formData.customerNo = this.customerNo
          this.confirmLoading = true
          saveCusPhoneCheckInfo(formData).then(res => {
            if (res.status.statusCode == 0) {
              this.$message.success(res.status.statusReason)
            } else {
              this.$message.warning(res.status.statusReason)
            }
          }).finally(() => {
            this.confirmLoading = false
          })
        }
      })
    },
    delId (data) {
      data.map(v => {
        v.id ? delete v.id : ''
      })
    },
    initCusLiablities () {
      this.cusLiabilitiesInfoList.map((v, i) => {
        if (i + 1 == this.cusLiabilitiesInfoList) {
          v.id = v.id + '1' * 1
        } else {
          v.id = v.id + '1'
        }
        v.amount = ''
      })
    },
    defineAssignment () {
      this.cusLiabilitiesInfoList = [
        {
          id: '1',
          loanTypeCode: "TOTAL_CREDIT_CARD_USAGE",
          amount: '',
          remark: '',
        },
        {
          id: '2',
          loanTypeCode: "LIABILITIES_BALANCE",
          amount: '',
          remark: '',
        },
        {
          id: 3,
          loanTypeCode: '销售负债比',
          amount: '',
          remark: '',
        },
      ];
      this.cusCostInfoList = [
        {
          id: '1',
          amount: '',
          costNameCode: "FUEL_COST",
          remark: '',
        },
        {
          id: '2',
          amount: '',
          costNameCode: "TOLL_FEE",
          remark: '',
        },
        {
          id: '3',
          amount: '',
          costNameCode: "WAGE",
          remark: '',
        },
        {
          id: '4',
          amount: '',
          costNameCode: "CAR_LOAN",
          remark: '',
        },
        {
          id: '5',
          amount: '',
          costNameCode: "DISPATCH_CHARGE",
          remark: '',
        },
        {
          id: '6',
          amount: '',
          costNameCode: "OTHER",
          remark: '',
        },
        {
          id: 7,
          costNameCode: '成本合计',
          amount: '',
          remark: '',
        },
      ];
      this.cusDedicatedLineList = [
        {
          id: '1',
          departureLine: '',
          monthAverageDeparture: '',
          singleFreight: '',
          freight: '',
        },
        {
          id: '2',
          departureLine: '',
          monthAverageDeparture: '',
          singleFreight: '',
          freight: '',
        },
        {
          id: '3',
          departureLine: '',
          monthAverageDeparture: '',
          singleFreight: '',
          freight: '',
        },
        {
          id: 4,
          departureLine: '',
          monthAverageDeparture: '',
          singleFreight: '',
          freight: ''
        }
      ]
      this.cusThreePartyInfoList = [
        {
          id: '1',
          sourceName: '',
          ratio: '',
          freight: '',
          cooperationYears: ''
        },
        {
          id: '2',
          sourceName: '',
          ratio: '',
          freight: '',
          cooperationYears: ''
        },
        {
          id: '3',
          sourceName: '',
          ratio: '',
          freight: '',
          cooperationYears: ''
        },
        {
          id: 4,
          sourceName: '',
          ratio: '',
          freight: '',
          cooperationYears: ''
        },
      ]
    }
  }
}
</script>
<style>
.editable-cell {
  position: relative;
}

.editable-cell-input-wrapper,
.editable-cell-text-wrapper {
  padding-right: 24px;
}

.editable-cell-text-wrapper {
  padding: 5px 24px 5px 5px;
}

.editable-cell-icon,
.editable-cell-icon-check {
  position: absolute;
  right: 0;
  width: 20px;
  cursor: pointer;
}

.editable-cell-icon {
  line-height: 18px;
  display: none;
}

.editable-cell-icon-check {
  line-height: 28px;
}

.editable-cell:hover .editable-cell-icon {
  display: inline-block;
}

.editable-cell-icon:hover,
.editable-cell-icon-check:hover {
  color: #108ee9;
}

.editable-add-btn {
  margin-bottom: 8px;
}
.noneIcon tr:last-child .editable-cell-icon {
  display: none;
}
</style>