<!--
  @description: 运营明细表
  @Modifier: 樊涛
  @routerPath: /expert/expertQuitEnterAudit-list
  @date: 2020/9/3
-->
<template>
  <div>
    <!--标题-->
    <div class="title title_border p0-16">
      <i class="el-icon-s-home" />运营明细表
    </div>
    <section class="p0-16">
      <!--查询条件-->
      <div class="crud_menu_title clearfix">
        <span class="icon-line fl">查询条件</span>
        <span class="fr pointer" @click="handleToggleSearch">
          <el-link
            :underline="false"
            :class="toggleSearchStatus?'arrow-is-active':''"
            type="primary"
            class="toggleSearchStatus icon el-icon-arrow-down"
          />
          {{ toggleSearchStatus?'收起高级查询' :'展开高级查询' }}
        </span>
      </div>
      <div :class="{'SearchContent_show':toggleSearchStatus}" class="clearfix SearchContent">
        <div class="SearchContent_leftInput fl">
          <el-form
            ref="searchForm"
            :model="searchForm"
            inline
            label-width="100px"
            label-position="left"
          >
            <!--开标时间-->
            <el-form-item
              label="开标时间"
              prop="createEndTime"
            >
              <el-date-picker
                v-model="searchForm.openTimeBegin"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="开始日期"
              />
              至
              <el-date-picker
                v-model="searchForm.openTimeEnd"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="结束日期"
              />
            </el-form-item>
          </el-form>
        </div>
        <div class="fr">
          <el-button type="primary" @click="onSearch">
            搜 索
          </el-button>
          <el-button plain type="info" @click="resetForm('searchForm')">
            重 置
          </el-button>
        </div>
      </div>
      <div class="crud_menu_title clearfix">
        <el-button
          type="primary"
          class="mb10 ml10"
          plain
          @click="exportTenderFeeInfoList"
        >
          导出列表
        </el-button>
      </div>
      <!-- <el-row class="table-alert-info">
        <el-col>
          <el-link :underline="false">
            合计投标服务费:<span class="sum_color"> {{ statistics.totalDocumentPrice }} </span>元
          </el-link>
        </el-col>
      </el-row> -->
      <div>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
          class="tableLimit"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            prop="areaName"
            align="center"
            label="区域"
            min-width="170"
          />
          <el-table-column
            align="center"
            prop="openBidStartTime"
            label="开标日期"
            min-width="200"
          />
          <el-table-column
            align="center"
            prop="tenderName"
            label="项目名称"
            min-width="200"
          />
          <el-table-column
            align="center"
            prop="supplierName"
            label="投标人单位名称"
            min-width="120"
          />
          <el-table-column
            align="center"
            prop="agentName"
            label="招标公司"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="buyersName"
            label="招标人公司名称（业主单位）"
            min-width="120"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="contractBudget"
            label="项目金额/元"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="finalPrice"
            label="中标金额/元"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="payPrice"
            label="缴费金额（元）"
            min-width="150"
          >
            <template slot-scope="scope">
              {{ numFilter(scope.row.payPrice) }}
            </template>
          </el-table-column>
        </el-table>
        <!--分页组件-->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
  </div>
</template>
<script>
/* 接口*/
import { getTenderFeeInfoList, exportTenderFeeInfoList } from '@/api/bidService/bidServiceStatistics.js'// 投标服务费
/* 公用方法*/
import { filterObj, download, filterDictText, restoreInitialValue, numFilter } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { commonMxin } from '@/mixins/commonMxin'
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'BidServiceStatisticsList',
  components: {
    pagination // 分页
  },
  mixins: [ListMixin, commonMxin],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        openTimeBegin: '', // 开标开始时间
        openTimeEnd: '' // 开标结束时间
      },
      // 开标费用统计数据
      statistics: {
        pageDocumentPrice: 0, // 单页开票金额
        pageNoTaxRatePrice: 0, // 单页开票不含税金额
        pageTaxAmount: 0, // 单页开票税额
        totalDocumentPrice: 0, // 总开票金额
        totalNoTaxRatePrice: 0, // 总开票不含税金额
        totalTaxAmount: 0 // 总页开票税额
      },
      payTypeList: [
        { typename: '支付宝', typecode: '00' },
        { typename: '微信', typecode: '01' },
        { typename: '银联', typecode: '02' },
        { typename: '广发', typecode: '03' },
        { typename: '中金支付', typecode: '04' }
      ], // 支付方式数据字典
      kpztTypeList: [
        { typename: '未开票', typecode: '00' },
        { typename: '开票失败', typecode: '01' },
        { typename: '已开票', typecode: '02' }
      ],
      tableData: []
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
    // 获得数据字典
    // this.getGroupType()
  },
  methods: {
    numFilter,
    filterDictText, // 字典值替换文本通用方法
    // 获得数据字典
    /* getGroupType() {
      this.$store.dispatch('getGroupType', ['paytype']).then((data) => {
        this.payTypeList = data.bidTypeData.paytypeList
      })
    },*/
    // 获取数据
    loadData() {
      const params = this.getQueryParams()// 查询条件
      getTenderFeeInfoList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {
        this.loading = false
      })
      // this.queryBiServiceStatistics(params)
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    /* queryBiServiceStatistics(params) {
      queryBiServiceStatistics(params).then(response => {
        this.statistics = response.data
      }).catch(() => {
      })
    }, */
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      restoreInitialValue(this.searchForm)
      // 获取列表信息
      this.onSearch()
    },
    // 导出
    exportTenderFeeInfoList() {
      const params = this.getQueryParams()// 查询条件
      exportTenderFeeInfoList(params).then(res => {
        download(res, '项目收费情况列表.xls')
      })
    },
    // 查看
    preview(row) {
      this.$router.push({
        name: 'bidServiceBasicInfo',
        params: {
          bidServiceStatisticsId: row.id
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>

.crud_menu_title{
  .el-button{
    margin-top: 8px;
  }
}

</style>
