index.vue 11.1 KB
<!-- 权益订单 -->
<template>
  <div>
    <div class="header_btn_widget flex_sc">
      <GLButton size="small" fn="订单详情" icon="el-icon-plus" type="primary" @click="handleEdit(1)">新增核赔</GLButton>
    </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">
          <!-- <GLButton v-if="[0].includes(scope.scope.status)" fn="去处理" type="text" @click="handleEdit(4, scope.scope)">去处理</GLButton>
          <GLButton v-if="[1, 3, 4].includes(scope.scope.status)" fn="查看" type="text" @click="handleEdit(2, scope.scope)">查看</GLButton>
          <GLButton v-if="[2].includes(scope.scope.status)" fn="重新提交" type="text" @click="handleEdit(3, scope.scope)">重新提交</GLButton> -->
          <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: '支付失败'
  }
]
export default {
  name: 'index',
  data() {
    return {
      orderCount: {},
      buttonList: [
        {
          type: 'GLButton',
          name: row => {
            return '去处理'
          },
          condition: row => {
            return [0].includes(row.scope.status)
          },
          attrs: {
            type: 'text',
            fn: '去处理'
          },
          listeners: {
            click: row => this.handleEdit(4, row.scope)
          }
        },
        {
          type: 'GLButton',
          name: row => {
            return '查看'
          },
          condition: row => {
            return [1, 3, 4].includes(row.scope.status)
          },
          attrs: {
            type: 'text',
            fn: '查看'
          },
          listeners: {
            click: row => this.handleEdit(2, row.scope)
          }
        },
        {
          type: 'GLButton',
          name: row => {
            return '重新提交'
          },
          condition: row => {
            return [2].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: ''
      },
      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: 'contractNo',
            width: 200,
            formatter: cellValue => {
              return cellValue.contractNo || '-'
            }
          },
          {
            label: '价格区间',
            prop: 'priceSection',
            width: 100,
            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
      }
      if (this.showGh) {
        // 广汇的用核销码
        urlParam.contractNo = editNo == 1 ? '' : row.writeOffCode
      }
      const temp = encodeURIComponent(JSON.stringify(urlParam))
      this.$router.push({ path: '/claims/order/' + temp })
    },
    handleOkFn() {
      this.getParams()
      this.getTableData()
    },
    handleRestFn() {
      this.searchForm = {
        searchText: '',
        status: '',
        commitDate: ''
      }
      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() }
      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()
      })
    }
  }
}
</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 #5850ff;
  padding: 0 16px;
  border-radius: 4px;
  .el-icon-warning {
    font-size: 16px;
    color: #5850ff;
    margin-right: 8px;
  }
  .count_num {
    font-size: 14px;
    color: #5850ff;
    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>