index.vue 17.4 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
<template>
  <div>
    <div class="widget">
      <div class="title">维修信息</div>
      <div class="content pad3220">
        <div class="element_wrap">
          <div class="label">批准金额:</div>
          <div class="pannel">
            <template v-for="(item, index) in itemsList">
              <div :key="index" class="wrapper">
                <div class="name">{{ item.serviceItemName }}</div>
                <div v-if="item.serviceItemType == 5" style="height: 36px" class="messag flex_sc">
                  <div class="ms flex_sc">
                    <span>损失类型:</span>
                    <el-radio v-model="item.lossType" label="1">全损</el-radio>
                    <el-radio v-model="item.lossType" label="2">局部</el-radio>
                  </div>
                </div>
                <div v-if="item.serviceItemType == 4" style="height: 36px" class="messag flex_sc">
                  <div class="ms flex_sc">
                    <span>服务类型:</span>
                    <el-checkbox-group v-model="item.lossTypeList" @change="changeType">
                      <el-checkbox label="3">钥匙</el-checkbox>
                      <el-checkbox label="4">车牌重置</el-checkbox>
                    </el-checkbox-group>
                  </div>
                </div>
                <div class="messag" :class="[{ pad20: item.serviceItemType != 5 && item.serviceItemType != 4 }]">
                  <div class="ms flex_sc">
                    <div class="ms_lab">预估损失金额/元:</div>
                    <el-input @input="validPrice($event, index, 'applyAmount')" @blur="changePrice($event, index, 'applyAmount')" v-model="item.applyAmount" size="mini" class="w432" maxlength="10"></el-input>
                  </div>
                  <div v-if="item.lossAssessmentFlag" class="ma20 ms flex_sc">
                    <div class="ms_lab">保险公司定损金额/元:</div>
                    <el-input @input="validPrice($event, index, 'lossAssessmentAmount')" @blur="changePrice($event, index, 'lossAssessmentAmount')" v-model="item.lossAssessmentAmount" size="mini" class="w432" maxlength="10"></el-input>
                  </div>
                  <div class="ms flex_sc ma20">
                    <div class="ms_lab">定损批准金额/元:</div>
                    <el-input @input="validPrice($event, index, 'approveAmount')" @blur="changePrice($event, index, 'approveAmount')" v-model="item.approveAmount" size="mini" class="w432" maxlength="10"></el-input>
                  </div>
                  <template v-if="item.serviceItemType == 1">
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">购置税/元:</div>
                      <el-input @input="validPrice($event, index, 'purchaseTax')" @blur="changePrice($event, index, 'purchaseTax')" v-model="item.purchaseTax" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">折旧费/元:</div>
                      <el-input @input="validPrice($event, index, 'depreciation')" @blur="changePrice($event, index, 'depreciation')" v-model="item.depreciation" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">商业险保费/元:</div>
                      <el-input @input="validPrice($event, index, 'commercialInsurance')" @blur="changePrice($event, index, 'commercialInsurance')" v-model="item.commercialInsurance" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">登记费/元:</div>
                      <el-input @input="validPrice($event, index, 'registrationFee')" @blur="changePrice($event, index, 'registrationFee')" v-model="item.registrationFee" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">加改装件费用/元:</div>
                      <el-input @input="validPrice($event, index, 'retrofits')" @blur="changePrice($event, index, 'retrofits')" v-model="item.retrofits" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                    <div class="ms flex_sc ma20">
                      <div class="ms_lab">代步车费用/元:</div>
                      <el-input @input="validPrice($event, index, 'scooterFare')" @blur="changePrice($event, index, 'scooterFare')" v-model="item.scooterFare" size="mini" class="w432" maxlength="10"></el-input>
                    </div>
                  </template>
                  <div class="ms flex_sc ma20" v-if="item.serviceItemType == 2">
                    <div class="ms_lab">损伤类型:</div>
                    <el-checkbox-group v-model="item.damageType">
                      <el-checkbox :label="1">鼓包</el-checkbox>
                      <el-checkbox :label="2">爆胎</el-checkbox>
                      <el-checkbox :label="3">开裂</el-checkbox>
                      <el-checkbox :label="4">扎伤</el-checkbox>
                    </el-checkbox-group>
                  </div>
                </div>
              </div>
            </template>
            <div class="total flex_scb">
              <span>合计</span>
              <span>
                <span>预估损失金额:{{ repotData.applyAmount }}元</span>
                <span style="margin: 0 10px">|</span>
                <span>定损批准金额:{{ repotData.approveAmount }}元</span>
              </span>
            </div>
          </div>
        </div>

        <div class="element_wrap ma20">
          <div class="label">收款对象:</div>
          <div class="pannel">
            <div class="wrapper">
              <div class="name">
                <el-radio>{{ accountForm.objectType ? '其他' : '店面' }}</el-radio>
                <!-- <el-radio-group disabled  @change="changeObjectType" v-model="accountForm.objectType">
                  <el-radio :label="0">店面</el-radio>
                  <el-radio :label="1">其他</el-radio>
                </el-radio-group> -->
              </div>
              <div class="pannel_box">
                <glsx-combi-form ref="accountRef" :formRules="accountRule" labelWidth="154px" defaultWidth="432px" :formObj="accountForm" :formData="accountData"></glsx-combi-form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div>
      <uploadMaterial :isClaims="true" :lossTypeList.sync="lossTypeList" :insuranceAttachmentConfigs.sync="insuranceAttachmentConfigs"></uploadMaterial>
    </div>
    <div class="widget ma16">
      <div class="title">寄回原件说明</div>
      <div class="content pad20">
        <div class="flex_sc" v-for="(first, ind) in repotData.claimsAttachmentConfigs2" :key="ind">
          <div v-for="(img, i) in first.secondClassifyList" :key="i" class="img_box">
            <div class="title_tip flex_sc">
              <div class="">{{ img.secondClassifyName || '' }}</div>
            </div>
            <div v-if="img.exampleUrl" class="img_pannel flex_cc">
              <el-image :preview-src-list="[img.exampleUrl]" style="width: 216px; height: 135px; border-radius: 4px" :src="img.exampleUrl" :fit="fit"></el-image>
              <div class="egTag flex_cc">示例</div>
            </div>
          </div>
        </div>
        <div class="messag">
          <div class="ms flex_sc">
            <div class="ms_txt">寄件快递公司:</div>
            <el-input v-model="repotData.expressName" size="mini" class="w432" disabled></el-input>
          </div>
          <div class="ms flex_sc ma20">
            <div class="ms_txt">寄件快递单号:</div>
            <el-input v-model="repotData.expressNo" size="mini" class="w432" disabled></el-input>
          </div>
        </div>
      </div>
    </div>
    <div>
      <explanation :supplementList="repotData.supplementList2" :operatorName="repotData.updatedBy" :id="repotData.id"></explanation>
    </div>
    <div v-if="accountMatchResultList.length" class="widget">
      <wraning style="margin-top: 16px" :isWatchOrder="isWatchOrder" @getWarningData="getWarningData" :list="accountMatchResultList"></wraning>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
import * as dayjs from 'dayjs'
const phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
import glsxCombiForm from '@/components/glsx-combi-form'
import uploadMaterial from '../uploadMaterial.vue'
import explanation from '../explanation.vue'
import wraning from '../wraning/index.vue'
export default {
  name: 'checkClaimsPage',
  components: {
    glsxCombiForm,
    uploadMaterial,
    explanation,
    wraning
  },
  data() {
    return {
      accountRule: {
        accountType: [{ required: true, message: '请选择账户类型', trigger: 'change' }],
        branchBankCode: [{ required: true, message: '请选择开户行名称', trigger: 'change' }],
        openBankCode: [{ required: true, message: '请选择开户行名称', trigger: 'change' }],
        accountName: [{ required: true, message: '请输入账户名称', trigger: 'change' }],
        accountNo: [
          {
            required: true,
            validator: (rule, value, callback) => {
              let numRef = /^[0-9]{1,25}$/
              if (!value) {
                callback(new Error('请输入收款账号'))
              } else if (numRef.test(value)) {
                callback()
              } else {
                callback(new Error('请输入正确的收款账号'))
              }
            },
            trigger: 'change'
          }
        ],
        bankCity: [{ required: true, message: '请选择收款账号所在省市', trigger: 'change' }],
        accountCityCode: [{ required: true, message: '请选择收款账号所在省市', trigger: 'change' }],
        payeeIDCardType: [{ required: true, message: '请选择收款人证件类型', trigger: 'change' }],
        cardTypeCode: [{ required: true, message: '请选择收款人证件类型', trigger: 'change' }],
        handlerName: [{ required: true, message: '请输入经办人', trigger: 'change' }],
        payeeIDCardNo: [{ required: true, message: '请输入收款人证件号码', trigger: 'change' }],
        cardNo: [{ required: true, message: '请输入收款人证件号码', trigger: 'change' }],
        payeePhone: [{ required: true, message: '请输入联系号码', trigger: 'change' }],
        handlerPhone: [
          {
            required: true,
            validator: (rule, value, callback) => {
              if (!value) {
                callback(new Error('请输入手机号'))
              } else if (phoneReg.test(value)) {
                callback()
              } else {
                callback(new Error('请输入正确的手机号'))
              }
            },
            trigger: 'change'
          }
        ],
        phone: [
          {
            required: true,
            validator: (rule, value, callback) => {
              if (!value) {
                callback(new Error('请输入手机号'))
              } else if (phoneReg.test(value)) {
                callback()
              } else {
                callback(new Error('请输入正确的手机号'))
              }
            },
            trigger: 'change'
          }
        ],
        reimbursementDesc: [{ required: true, message: '请输入出险经过描述', trigger: 'change' }]
      },
      accountData: [
        // {
        //   label: '账户类型',
        //   name: 'accountType',
        //   type: 'radio',
        //   optionList: [
        //     {
        //       confId: 0,
        //       confName: '对公'
        //     },
        //     {
        //       confId: 1,
        //       confName: '对私'
        //     }
        //   ],
        //   optionId: 'confId',
        //   optionLabel: 'confName',
        //   isHide: true,
        //   isClear: true,
        // },
        {
          label: '开户行名称',
          name: 'openBankCode',
          type: 'select',
          optionList: [],
          optionId: 'code',
          optionLabel: 'name',
          isClear: true
        },
        {
          label: '账户名称',
          name: 'accountName',
          type: 'input',
          maxlength: 60,
          isClear: true
        },
        {
          label: '收款账号',
          name: 'accountNo',
          type: 'input',
          maxlength: 25,
          isClear: true
        },
        {
          label: '收款账号所在省市',
          name: 'accountCityCode',
          type: 'select',
          placeholder: '可输入所在市关键词查询',
          optionList: [],
          optionId: 'code',
          optionLabel: 'name',
          isClear: true
        },
        {
          label: '收款人证件类型',
          name: 'cardTypeCode',
          type: 'select',
          optionList: [],
          optionId: 'code',
          optionLabel: 'name',
          isClear: true
        },
        {
          label: '收款人证件号码',
          name: 'cardNo',
          type: 'input',
          maxlength: 25,
          isClear: true
        },
        {
          label: '收款人联系电话',
          name: 'phone',
          type: 'input',
          maxlength: 15,
          isClear: true
        }
      ]
    }
  },
  props: {
    repotData: Object,
    accountForm: Object,
    itemsList: Array,
    insuranceAttachmentConfigs: Array,
    lossTypeList: Array,
    accountMatchResultList: Array,
    isWatchOrder: Boolean
  },
  watch: {
    'accountForm.objectType': {
      handler(newVal, oldVal) {
        const item = this.accountData.find(item => {
          return item.name == 'accountType'
        })
        item.isHide = newVal == 0
      },
      immediate: true
    }
  },
  mounted() {
    this.getBankList()
  },
  methods: {
    changeType(e) {
      this.lossTypeList = e
      this.$emit('getCurrentLoosType', e)
    },
    changeObjectType(newVal) {
      this.$emit('changeObjectType', newVal)
    },
    // 获取银行信息
    getBankList() {
      this.$apis.claims.getBankList({}).then(res => {
        const branchBankList = this.accountData.find(item => item.name === 'openBankCode')
        branchBankList.optionList = res.branchBank
        const accountCityList = this.accountData.find(item => item.name === 'accountCityCode')
        accountCityList.optionList = res.accountCity
        const IDCardTypeList = this.accountData.find(item => item.name === 'cardTypeCode')
        IDCardTypeList.optionList = res.cardType
      })
    },
    validPrice(e, id, type) {
      let checkPlan = '' + this.itemsList[id][type]
      checkPlan = checkPlan
        .replace(/[^\d.]/g, '')
        .replace(/\.{2,}/g, '.')
        .replace(/^\./g, '')
        .replace('.', '$#$')
        .replace(/\./g, '')
        .replace('$#$', '.')
      if (checkPlan.indexOf('.') < 0 && checkPlan !== '') {
        checkPlan = parseFloat(checkPlan) + ''
      } else if (checkPlan.indexOf('.') >= 0) {
        checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
      }
      this.$set(this.itemsList[id], type, checkPlan)
      this.getTotal(type)
    },
    changePrice(e, id, type) {
      if (!e.target.value) return
      const len = e.target.value.length
      let lastStr = e.target.value.charAt(len - 1)
      if (lastStr === '.') {
        this.$set(this.itemsList[id], type, e.target.value.substr(0, len - 1))
      }
      const minPrice = 1
      if (Number(e.target.value) < minPrice) {
        this.$set(this.itemsList[id], type, 1)
      }
      let maxPrice = 2000000
      if(type == 'applyAmount' || type == 'approveAmount') {
        maxPrice = 200000
      }
      if (Number(e.target.value) > maxPrice) {
        this.$set(this.itemsList[id], type, maxPrice)
      }
      this.getTotal(type)
    },
    getTotal(type) {
      let total = this.itemsList.reduce(function (prev, cur) {
        let curPrice = cur.checked ? cur[type] : 0
        return prev + +(curPrice * 100).toFixed(0)
      }, 0)
      this.repotData[type] = (total / 100).toFixed(2)
    },
    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)
        })
        console.log(arr)
        this.$emit('getWarningInfo', arr)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.pad3220 {
  padding: 32px 20px;
}
.pad20 {
  padding: 20px !important;
}
.ms_lab {
  width: 154px;
  text-align: right;
}
.w432 {
  width: 432px !important;
}
.ma20 {
  margin-top: 20px;
}
.ma16 {
  margin-top: 16px;
}
.img_box {
  margin-bottom: 16px;
  margin-right: 16px;
  .service_title {
    margin: 8px 0;
  }
  .title_tip {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
  }
  .img_pannel {
    width: 216px;
    height: 135px;
    margin: 8px 0;
    border: 1px solid #e5e5e5;
    background: #f5f5f5;
    position: relative;
    border-radius: 4px;
    .egTag {
      position: absolute;
      right: 8px;
      top: 8px;
      width: 36px;
      height: 18px;
      color: #666;
      font-size: 12px;
      border-radius: 2px;
      background: #e5e5e5;
    }
  }
}
.ms_txt {
  font-size: 14px;
  font-weight: 400;
  color: #666666;
}
</style>