<template>
  <div id="tablelist">
    <el-row>
      <el-col :span="24">
        <el-col :span="24" class="infoTop">
          <span>交易展示</span>
        </el-col>
        <el-col :span="24" class="tableInfo">
          <el-table :data="tableData" style="width: 100%" stripe border>
            <el-table-column prop="market_username" label="营销单位" align="center" :show-overflow-tooltip="true"> </el-table-column>
            <el-table-column prop="username" label="采购单位" align="center" :show-overflow-tooltip="true"> </el-table-column>
            <el-table-column prop="product_name" label="产品交易" align="center" :show-overflow-tooltip="true"> </el-table-column>
            <el-table-column prop="state" label="状态" align="center">
              <template v-slot="scoped">
                {{
                  `${scoped.row.status}` === `0`
                    ? '未交易'
                    : `${scoped.row.status}` === `1`
                    ? '交易中'
                    : `${scoped.row.status}` === `2`
                    ? '交易成功'
                    : `${scoped.row.status}` === `3`
                    ? '交易失败'
                    : ''
                }}
              </template>
            </el-table-column>
          </el-table>
        </el-col>
        <el-col :span="24" class="page">
          <el-pagination
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-size="10"
            layout="total, prev, pager, next, jumper"
            :total="total"
          >
          </el-pagination>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'tablelist',
  props: {
    tableData: null,
    total: null,
  },
  components: {},
  data: () => ({
    currentPage: 1,
  }),
  created() {},
  computed: {},
  methods: {
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.$emit('query', val);
    },
  },
};
</script>

<style lang="less" scoped>
.infoTop {
  height: 60px;
  border-bottom: 1px solid #22529a;
  margin: 0 0 30px 0;
}
.infoTop span:only-child {
  width: 15%;
  height: 60px;
  background-color: #22529a;
  color: #fff;
  text-align: center;
  line-height: 60px;
  font-size: 20px;
  display: block;
}
.tableInfo {
  margin: 0 auto;
  width: 90%;
  float: none;
  height: 630px;
}
/deep/.el-table th {
  background-color: #f3f3f3;
  color: rgba(1, 1, 1, 0.5);
  font-size: 18px;
  text-align: center;
}
/deep/.el-table td {
  color: rgba(1, 1, 1, 0.7);
  font-size: 18px;
  text-align: center;
}
.page {
  margin: 20px 0;
  text-align: center;
}
</style>
