renew.vue 12.3 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
<!-- 权益订单 -->
<template>
  <div>
    <div class="header_btn_widget flex_sc">
      <el-button size="small" fn="订单详情" icon="el-icon-plus" type="primary" @click="handleEdit(1)">新增核赔</el-button>
    </div>
    <div class="header_info_widget">
      <span class="el-icon-warning"></span>
      请注意:订单列表还有
      <span class="count_num">{{ orderCount.toBeCommitCount || 0 }}</span>
      单待提交国任,
      <span class="count_num">{{ orderCount.noPassCount || 0 }}</span>
      单校验不通过退回处理,为保障客户权益,请尽快处理哦!
    </div>
    <div class="search_container">
      <GLCombiForm :rowNumber="1" ref="showSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOkFn" @handleRest="handleRestFn()"></GLCombiForm>
    </div>
    <div class="table_widget">
      <el-button plain style="float: right; margin-bottom: 10px" size="small" @click="exportList">导出</el-button>
      <GLTable ref="equityRef" :pageSizes="sizeList" :getListApi="getListApi" :searchForm="searchParams" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :pageConf="batchPageConf">
        <div class="table-btns" slot="table-btns" slot-scope="scope">
          <!-- <el-button v-if="[0].includes(scope.scope.status)" fn="去处理" type="text" @click="handleEdit(4, scope.scope)">去处理</el-button>
          <el-button v-if="[1, 3, 4].includes(scope.scope.status)" fn="查看" type="text" @click="handleEdit(2, scope.scope)">查看</el-button>
          <el-button v-if="[2].includes(scope.scope.status)" fn="重新提交" type="text" @click="handleEdit(3, scope.scope)">重新提交</el-button> -->
          <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
        </div>
      </GLTable>
    </div>
  </div>
</template>
<script>
import * as dayjs from 'dayjs'
const statusList = [
  {
    confId: '',
    confName: '全部'
  },
  {
    confId: 0,
    confName: '待提交国任'
  },
  {
    confId: 2,
    confName: '校验不通过'
  },
  {
    confId: 1,
    confName: '待支付'
  },
  {
    confId: 3,
    confName: '支付成功'
  },
  {
    confId: 4,
    confName: '支付失败'
  },
  {
    confId: 14,
    confName: '草稿'
  },
  {
    confId: 15,
    confName: '待定损'
  },
  {
    confId: 16,
    confName: '定损不通过'
  },
  {
    confId: 17,
    confName: '定损通过'
  }
]
export default {
  name: 'renew',
  data() {
    return {
      orderCount: {},
      buttonList: [
        {
          type: 'el-button',
          name: row => {
            return '去处理'
          },
          condition: row => {
            return [15, 0].includes(row.scope.status)
          },
          attrs: {
            type: 'text',
            fn: '去处理'
          },
          listeners: {
            click: row => this.handleEdit(4, row.scope)
          }
        },
        {
          type: 'el-button',
          name: row => {
            return '查看'
          },
          condition: row => {
            return [1, 3, 4, 17, 2, 14, 16].includes(row.scope.status)
          },
          attrs: {
            type: 'text',
            fn: '查看'
          },
          listeners: {
            click: row => this.handleEdit(2, row.scope)
          }
        }
        // {
        //   type: 'el-button',
        //   name: row => {
        //     return '重新提交'
        //   },
        //   condition: row => {
        //     return [16].includes(row.scope.status)
        //   },
        //   attrs: {
        //     type: 'text',
        //     fn: '重新提交'
        //   },
        //   listeners: {
        //     click: row => this.handleEdit(3, row.scope)
        //   }
        // }
      ],
      getListApi: this.$apis.claims.getclaimsList,
      sizeList: [5, 10, 20, 30, 40],
      pageConf: { pageSize: 'pageCount', pageNum: 'pageNum', totalCount: 'total' },
      batchPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      searchForm: {
        searchText: '',
        status: '',
        commitDate: '',
        equitySource: 1
      },
      searchParams: {},
      searchFormData: [
        {
          name: 'searchText',
          type: 'input',
          placeholder: '请输入客户名|核销码|合同号|报案号',
          isClear: true,
          maxlength: 200
          // isHide: true
        },
        {
          label: '服务状态',
          name: 'status',
          type: 'select',
          isClear: true,
          optionList: statusList,
          optionId: 'confId',
          optionLabel: 'confName'
        },
        {
          label: '提交国任日期',
          name: 'commitDate',
          type: 'datePicker',
          pickerOptions: 'beforeRangePickerOptions',
          isClear: true
        }
      ],
      tableParams: {
        listName: 'list',
        tableOption: false,
        tableColumns: [
          {
            label: '核销码',
            prop: 'writeOffCode',
            width: 100,
            formatter: cellValue => {
              return cellValue.writeOffCode || '-'
            }
          },
          {
            label: '报案号',
            prop: 'registNo',
            width: 220,
            formatter: cellValue => {
              return cellValue.registNo || '-'
            }
          },
          {
            label: '客户名称',
            prop: 'reporterName',
            width: 160,
            formatter: cellValue => {
              return cellValue.reporterName || '-'
            }
          },
          {
            label: '车牌号',
            prop: 'vehicleLicensePlate',
            width: 160,
            formatter: cellValue => {
              return cellValue.vehicleLicensePlate || '-'
            }
          },
          {
            label: '合同号',
            prop: 'contractNo',
            width: 200,
            formatter: cellValue => {
              return cellValue.contractNo || '-'
            }
          },
          {
            label: '价格区间',
            prop: 'priceSection',
            width: 120,
            formatter: cellValue => {
              return cellValue.priceSection || '-'
            }
          },
          {
            label: '门店提交时间',
            prop: 'commitTime',
            width: 180,
            formatter: cellValue => {
              return cellValue.commitTime ? dayjs(cellValue.commitTime).format('YYYY-MM-DD HH:mm:ss') : '-'
            }
          },
          {
            label: '提交国任时间',
            prop: 'commitGuoRenDate',
            width: 180,
            formatter: cellValue => {
              return cellValue.commitGuoRenDate ? dayjs(cellValue.commitGuoRenDate).format('YYYY-MM-DD HH:mm:ss') : '-'
            }
          },
          {
            label: '服务名称',
            prop: 'serviceName',
            width: 300,
            line: 1,
            formatter: cellValue => {
              return cellValue.serviceName || '-'
            }
          },
          {
            label: '服务状态',
            prop: 'status',
            width: 120,
            formatter: cellValue => {
              if (!cellValue) return '-'
              return statusList.map(item => item.confId).includes(cellValue.status) ? statusList.find(item => item.confId === cellValue.status).confName : '-'
            }
          },
          {
            label: '状态描述',
            prop: 'statusDesc',
            width: 250,
            line: 1,
            formatter: cellValue => {
              return cellValue.statusDesc || '-'
            }
          },
          {
            label: '批准金额/元',
            prop: 'approvalAmount',
            width: 150,
            align: 'right',
            formatter: cellValue => {
              return cellValue.approvalAmount || '-'
            }
          },
          {
            label: '支付金额/元',
            prop: 'paymentAmount',
            align: 'right',
            width: 150,
            formatter: cellValue => {
              return cellValue.paymentAmount || '-'
            }
          },
          {
            label: '操作人',
            prop: 'operatorName',
            width: 100,
            formatter: cellValue => {
              return cellValue.operatorName || '-'
            }
          },
          {
            label: '操作',
            prop: '',
            width: 100,
            fixed: 'right',
            addHtml: 'table-btns'
          }
        ]
      }
    }
  },
  created() {
    this.diffHost()
    this.getClaimsCount()
  },
  mounted() {
    // this.handleUploadBefore()
  },
  methods: {
    getClaimsCount() {
      this.$apis.claims.getclaimsCount({}).then(res => {
        this.orderCount = res
      })
    },
    // 从域名判断是不是广汇的
    diffHost() {
      let href = window.location.host
      this.showGh = href.indexOf('cgacar') != -1
      if (!this.showGh) this.searchFormData[0].placeholder = '请输入客户名 | 合同号 | 报案号'
    },
    // 1.新增  2.查看 3.重新提交  4.去处理
    handleEdit(editNo, row) {
      let urlParam = {
        editNo,
        isGH: this.showGh,
        // isGH: true,
        contractNo: editNo == 1 ? '' : row.contractNo, // 嘀加的用合同号
        orderId: editNo == 1 ? '' : row.id,
        status: row.status
      }
      if (this.showGh) {
        // 广汇的用核销码
        urlParam.contractNo = editNo == 1 ? '' : row.writeOffCode
      }
      const title = this.jumpTitle(editNo)
      const temp = encodeURIComponent(JSON.stringify(urlParam))
      this.$router.push({ path: '/GH/Renew/detail/' + temp, query: { $title: title } })
    },
    handleOkFn() {
      this.getParams()
      this.getTableData()
    },
    handleRestFn() {
      this.searchForm = {
        searchText: '',
        status: '',
        commitDate: '',
        equitySource: 1
      }
      this.getTableData()
    },
    beforeSearchFn() {
      return new Promise((resolve, reject) => {
        this.searchParams = { ...this.getParams() }
        resolve()
      })
    },
    getParams() {
      let params = JSON.parse(JSON.stringify(this.searchForm))
      if (Array.isArray(params.commitDate) && params.commitDate.length > 0) {
        params.commitTimeStart = dayjs(params.commitDate[0]).format('YYYY-MM-DD') + ' 00:00:00'
        params.commitTimeEnd = dayjs(params.commitDate[1]).format('YYYY-MM-DD') + ' 23:59:59'
      }
      delete params.commitDate
      return params
    },
    getTableData() {
      this.$refs.equityRef.refreshTable()
    },
    exportList() {
      const parmas = { ...this.getParams(), equitySource: 1 }
      this.$apis.claims.exportClaimsData(parmas).then(data => {
        var a = document.createElement('a')
        a.setAttribute('id', 'exportToExport')
        a.setAttribute('href', data)
        a.setAttribute('target', '_blank')
        document.body.appendChild(a)
        a.click()
      })
    },
    jumpTitle(addOrEdit) {
      // 1.新增  2.查看 3.重新提交  4.去处理
      let title = '查看'
      switch (addOrEdit) {
        case 1:
          title = '新增'
          break
        case 2:
          title = '查看'
          break
        case 3:
          title = '重新提交'
          break
        case 4:
          title = '去处理'
          break
        default:
          title = '查看'
          break
      }
      return title
    }
  }
}
</script>
<style lang="scss" scoped>
.header_info_widget {
  box-sizing: border-box;
  margin: 16px 0;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.65);
  background-color: #e6e9ff;
  border: 1px solid #2a58ad;
  padding: 0 16px;
  border-radius: 4px;
  .el-icon-warning {
    font-size: 16px;
    color: #2a58ad;
    margin-right: 8px;
  }
  .count_num {
    font-size: 14px;
    color: #2a58ad;
    letter-spacing: 0;
    font-weight: 500;
    margin: 0 8px;
  }
}
.search_container {
  background: #ffffff;
  box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
  padding: 20px 20px 0;
}
.table_widget {
  padding: 0px 20px 20px;
  background: #ffffff;
  box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
}
/deep/ .el-form {
  .el-form-item {
    margin-right: 12px !important;
    &:first-child {
      .el-input {
        width: 312px !important;
      }
    }
  }
}
</style>