<!--
  @description:待确认标书列表
  @Modifier: haofengxian
  @routerPath: /fee/docPayAuditList
  @date: 2020-9-1-16:29
-->
<template>
  <div>
    <table-crud
      :search-form="searchForm"
      search-label-width="100px"
      @on-load="loadData"
    >
      <template v-slot:header>
        待确认标书列表
      </template>
      <template v-slot:search="search">
        <el-form-item ref="tenderNo" label="招标项目编号" prop="tenderNo">
          <el-input
            v-model.trim="searchForm.tenderNo"
            placeholder="招标项目编号"
            style="width:228px"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
        <el-form-item ref="tenderName" label="招标项目名称" prop="tenderName">
          <el-input
            v-model.trim="searchForm.tenderName"
            placeholder="招标项目名称"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
        <el-form-item ref="supplierName" label="供应商名称" prop="supplierName">
          <el-input
            v-model.trim="searchForm.supplierName"
            placeholder="供应商名称"
            @keyup.enter.native="search.onSearch"
          />
        </el-form-item>
        <!--缴费时间-->
        <el-form-item label="缴费时间">
          <el-date-picker
            v-model="searchForm.createTime"
            type="daterange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            @change="handleCreateTime"
          />
        </el-form-item>
      </template>
      <template v-slot:GXTable>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            prop="tenderNo"
            align="center"
            label="招标项目编号"
            width="170"
          />
          <el-table-column
            header-align="center"
            prop="tenderName"
            label="招标项目名称"
            min-width="230"
          />
          <el-table-column
            header-align="center"
            prop="supplierName"
            label="供应商名称"
            min-width="230"
          />
          <el-table-column
            header-align="center"
            align="right"
            prop="payPrice"
            label="缴费金额"
            width="90"
          />
          <el-table-column
            header-align="center"
            label="缴费时间"
            prop="payTime"
            align="left"
            width="160"
          />
          <el-table-column
            label="缴费方式"
            prop="payType"
            width="110"
          >
            <template slot-scope="scope">
              <span
                v-for="(item,index) in payTypeList"
                v-if="scope.row.payType===item.typecode"
                :key="index"
              >{{ item.typename }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            align="center"
            label="操作"
            width="90"
          >
            <!--审核状态 00:待审核 01:审核通过 02:审核不通过-->
            <template slot-scope="scope">
              <el-link
                v-if="scope.row.auditStatus!=='01'"
                type="primary"
                @click.stop="auditDoc(scope.row)"
              >
                [审核]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </table-crud>
    <!--确认标书费审核弹框-->
    <docPayAuditDialog ref="docPayAudit" @loadData="loadData" />
  </div>
</template>
<script>
/* 接口*/
import { waitAuditDocfeeList } from '@api/fee/docfee'
/* 组件*/
import docPayAuditDialog from './docPayAudit-dialog'
import { TenderFeeGroupMixin } from '../mixins/tenderFeeGroupMixin'

export default {
  name: 'TenderProjectList',
  components: {
    docPayAuditDialog
  },
  mixins: [TenderFeeGroupMixin],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        createTime: '',
        createBeginTime: '', // 创建开始时间
        createEndTime: '', // 创建结束时间
        supplierName: '', // 供应商名称
        tenderName: '', // 项目名称
        tenderNo: '' // 项目编号
      },
      tableData: []
    }
  },
  methods: {
    // 获取数据
    loadData(params, callback) {
      waitAuditDocfeeList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    },
    // 审核标书费凭证
    auditDoc(row) {
      this.$refs.docPayAudit.openDocPayAuditDialog(row)
    },
    // 处理搜索时间格式
    handleCreateTime(val) {
      if (val) {
        this.searchForm.createBeginTime = this.$Moment(val[0]).format(this.momentDate)// 创建开始时间
        this.searchForm.createEndTime = this.$Moment(val[1]).format(this.momentDate)// 创建结束时间
      }
    }
  }
}
</script>
<style lang="less" scoped>

</style>
