<!--
  @description:投标服务费财务管理-投标服务费统计
  @Modifier:肖文龙
  @routerPath:/bidServiceFee/bidServiceFeeStatisticsList
  @date:2019-12-9 14:42:36
-->
<template>
  <div style="height: 100%;">
    <section class="title p0-16">
      投标服务费统计
    </section>
    <!--搜索-->
    <section :class="{'SearchContent_show':toggleSearchStatus}" class="p0-16 clearfix SearchContent">
      <div class="SearchContent_leftInput fl">
        <el-form ref="searchForm" :model="searchForm" inline>
          <el-form-item label="代理机构名称" label-width="100px" prop="paymentInstitution">
            <el-input v-model="searchForm.paymentInstitution" placeholder="代理机构名称" style="width:240px" />
          </el-form-item>
          <el-form-item label="招标业务部门" label-width="100px" prop="paymentInstitution">
            <el-input v-model="searchForm.paymentInstitution" placeholder="招标业务部门" style="width:240px" />
          </el-form-item>
          <el-form-item label="项目编号" label-width="100px" prop="paymentInstitution">
            <el-input v-model="searchForm.paymentInstitution" placeholder="项目编号" style="width:240px" />
          </el-form-item>
          <el-form-item label="项目名称" label-width="100px" prop="paymentInstitution">
            <el-input v-model="searchForm.title" placeholder="项目名称" style="width:240px" />
          </el-form-item>
          <el-form-item label="缴费机构" label-width="100px" prop="paymentMode">
            <el-input v-model="searchForm.paymentInstitution" placeholder="缴费机构" style="width:240px" />
          </el-form-item>
          <el-form-item label="支付方式" label-width="100px" prop="paymentMode">
            <el-select v-model="searchForm.paymentMode" placeholder="请选择" style="width:240px">
              <el-option v-for="item in paymentModeOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item label="缴费时间" label-width="100px" prop="effectEndDate">
            <el-date-picker
              v-model="applyDate"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width:240px"
              @change="chooseTimeRange"
            />
          </el-form-item>
          <el-form-item label="开票时间" label-width="100px" prop="effectEndDate">
            <el-date-picker
              v-model="applyDate"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width:240px"
              @change="chooseTimeRange"
            />
          </el-form-item>
        </el-form>
      </div>
      <div class="fr">
        <el-button
          v-if="toggleSearchStatus"
          icon="el-icon-arrow-up"
          class="toggleSearchStatus"
          type="gray"
          @click="handleToggleSearch"
        />
        <el-button
          v-else
          icon="el-icon-arrow-down"
          class="toggleSearchStatus"
          type="gray"
          @click="handleToggleSearch"
        />
        <el-button type="primary" icon="iconfont icon-search" @click="onSearch('searchForm')">
          搜索
        </el-button>
        <el-button plain type="info" @click="resetForm('searchForm')">
          重置
        </el-button>
      </div>
    </section>
    <!--金额-->
    <section class="derivedScore">
      <div class="derivedScore_div">
        <el-button type="primary" size="small" plain icon="iconfont icon-export" @click="exportExcel">
          导出
        </el-button>
      </div>
      <div class="derivedScore_div derivedScore_orange">
        费用统计：<span>123456</span>
      </div>
      <div class="derivedScore_div" />
    </section>
    <!--列表-->
    <section class="main">
      <el-table id="tableData" :data="tableData" :fit="true" style="width: 100%" size="small">
        <el-table-column type="selection" width="60" />
        <el-table-column type="index" label="序号" width="60" align="center" />
        <el-table-column prop="serialNumber" min-width="70%" align="center" label="流水号" />
        <el-table-column prop="agency" width="120px" min-width="100%" label="代理机构名称" />
        <el-table-column prop="zhaobiao" width="120px" min-width="100%" label="招标业务部门" />
        <el-table-column prop="projectCode" min-width="100%" label="项目编号" />
        <el-table-column prop="title" min-width="100%" label="项目名称" />
        <el-table-column prop="baojian" min-width="100%" label="包件编号" />
        <el-table-column prop="paymentInstitution" min-width="100%" label="缴费机构" />
        <el-table-column prop="paymentAmount" min-width="200px" label="缴费数量" />
        <el-table-column prop="paymenAamount" min-width="200px" label="缴费金额（元）" />
        <el-table-column prop="PayData" min-width="200px" label="缴费时间" />
        <el-table-column prop="billingStatus" min-width="200px" label="开票状态">
          <template slot-scope="scope">
            <span v-if="scope.row.billingStatus==='00'">未开票</span>
            <span v-if="scope.row.billingStatus==='01'">已开票</span>
          </template>
        </el-table-column>
        <el-table-column prop="electronicsMail" min-width="200px" label="电子邮箱" />
        <el-table-column prop="invoice" min-width="200px" label="发票号" />
        <el-table-column prop="invoiceCode" min-width="200px" label="发票代码" />
        <el-table-column prop="invoiceVerificationCode" min-width="200px" label="发票效验码" />
        <el-table-column prop="billingData" min-width="200px" label="开票时间" />
        <el-table-column prop="isrefund" min-width="200px" label="是否可以退款">
          <template slot-scope="scope">
            <span v-if="scope.row.isrefund==='00'">否</span>
            <span v-if="scope.row.isrefund==='01'">是</span>
          </template>
        </el-table-column>
        <el-table-column prop="refund" min-width="200px" label="退款">
          <template slot-scope="scope">
            <span v-if="scope.row.refund==='00'">否</span>
            <span v-if="scope.row.refund==='01'">是</span>
          </template>
        </el-table-column>
        <el-table-column prop="openingStartData" min-width="200px" label="开标时间" />
        <el-table-column prop="purchaseType" fixed="right" label="操作" align="center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="info"
              plain
              @click="auditBtn(scope.row.id)"
            >
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="getData" />
    </section>
  </div>
</template>

<script>
import { getList } from '@/api/purchase/purchaseMain'
import { ListMixin } from '@/mixins/ListMixin'
import pagination from '@comp/common/pagination/pagination'
export default {
  name: 'StatisticsList',
  components: {
    pagination
  },
  mixins: [ListMixin],
  data() {
    return {
      searchForm: {
        applyEndDate: '', // 发布结束日期
        applyStartDate: '', // 发布开始日期
        purchaseNo: '', // 采购项目编号
        purchaseType: '', // 采购方式
        stage: '', // 项目所处阶段
        title: '', // 采购项目名称
        auditStatus: '' // 审核状态
      },
      applyDate: '', // 时间
      // 制作状态
      productionStatusOptions: [{
        value: '00',
        label: '未制作'
      }, {
        value: '01',
        label: '已制作'
      }],
      // 是否开取专票
      specialTicketOptions: [{
        value: '00',
        label: '否'
      }, {
        value: '01',
        label: '是'
      }],
      // 开票状态
      billingStatusOptions: [{
        value: '00',
        label: '未开票'
      }, {
        value: '01',
        label: '已开票'
      }],
      // 服务类型
      serviceTypeOptions: [{
        value: '00',
        label: '证书办理'
      }, {
        value: '01',
        label: '证书延期'
      }, {
        value: '02',
        label: '损坏/遗失补办'
      }, {
        value: '03',
        label: '证书更新'
      }],
      // CA类型
      caTypeOptions: [{
        value: '00',
        label: '单位身份证书'
      }, {
        value: '01',
        label: '个人数字证书'
      }],
      // 支付方式
      paymentModeOptions: [{
        value: '00',
        label: '易宝支付'
      }, {
        value: '01',
        label: '支付宝'
      }, {
        value: '02',
        label: '微信'
      }, {
        value: '03',
        label: '其他'
      }],
      // 数据列表
      tableData: [{}]

    }
  },
  mounted() {
  },
  methods: {
    // 路径跳转
    auditBtn(id) { // 项目id//采购方式//公开性//是否审核
      this.$router.push({
        path: '/bidServiceFee/bidServiceFeeStatisticsList/serviceChargeDetail',
        query: {
          id: id
        }
      })
    },
    // 时间转换
    chooseTimeRange(t) {
      const timeArr = t
      if (timeArr) {
        const moment = require('moment')
        for (const i in timeArr) {
          timeArr[i] = moment(timeArr[i]).format('YYYY-MM-DD')
        }
        this.searchForm.applyEndDate = timeArr[1] // 结束日期
        this.searchForm.applyStartDate = timeArr[0] // 开始日期
      }
    },
    // Excel导出
    exportExcel() {
    },
    // 初始化分页
    initData(tableData) {
      if (tableData === false) {
        this.tableData = []
      } else {
        const moment = require('moment')
        this.tableData = tableData.data.results
        this.pageNo = tableData.data.pageNo || 1
        this.totalPage = tableData.data.total || 1
        for (let i = 0; i < this.tableData.length; i++) {
          this.tableData[i].createDate = moment(this.tableData[i].createDate).format('YYYY-MM-DD')
          // 审核状态
          if (this.tableData[i].auditStatus === '00') {
            this.tableData[i].auditStatus = '待审核'
          } else if (this.tableData[i].auditStatus === '01') {
            this.tableData[i].auditStatus = '审核通过'
          } else {
            this.tableData[i].auditStatus = '审核不通过'
          }
        }
      }
    },
    // 获取列表
    getData(searchForm) {
      const data = {
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize,
        orgMethod: '00', // 自主采购
        ...searchForm
      }
      getList(data).then(response => {
        this.initData(response)
      }).catch(res => {})
    },

    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      this.getData(this.searchForm)
    },
    // 搜索重置
    resetForm(formName) {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      this.searchForm.title = ''
      this.$refs[formName].resetFields()
      this.getData(this.searchForm)
    }
  }
}
</script>

<style lang="less">

</style>
