<template>
  <div id="column">
    <el-row>
      <el-col :span="24" class="info">
        <el-col :span="24" class="top">
          <el-col :span="12" class="topTitle">
            <span>审核信息列表</span>
          </el-col>
        </el-col>
        <el-col :span="24" class="list">
          <template>
            <el-table :data="recruitInfo" style="width: 100%">
              <el-table-column prop="username" label="购买人名称" align="center"> </el-table-column>
              <el-table-column prop="market_username" label="营销人名称" align="center"> </el-table-column>
              <el-table-column prop="product_name" label="商品名称 " align="center"> </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-column label="操作" align="center">
                <template slot-scope="scoped">
                  <el-tooltip content="审核" placement="bottom" effect="light">
                    <el-button
                      type="text"
                      size="small"
                      @click="
                        $router.push({
                          path: '/enterprise/detail',
                          query: {
                            id: scoped.row.id,
                            name: scoped.row.product_name,
                            oneid: scoped.row.username,
                            twoid: scoped.row.market_username,
                          },
                        })
                      "
                      ><i class="el-icon-edit"></i
                    ></el-button>
                  </el-tooltip>

                  <el-tooltip content="删除" placement="bottom" effect="light">
                    <el-button type="text" size="small" @click="handleDelete(scoped.row)"><i class="el-icon-delete"></i></el-button>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
            <el-col :span="24" class="page">
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage"
                layout="total, prev, pager, next, jumper"
                :total="total"
                :page-size="pageSize"
              >
              </el-pagination>
            </el-col>
          </template>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'column',
  props: {
    recruitInfo: null,
    total: null,
  },
  components: {},
  data: () => ({
    currentPage: 0,
    pageSize: 10,
  }),
  created() {},
  computed: {},
  methods: {
    addData() {
      this.$router.push({ path: '/personnel/recruitDetail' });
    },
    handleDelete(item) {
      this.$emit('delete', item);
    },
    handleEdit(row) {
      this.$emit('edit', { data: row });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(currentPage) {
      console.log(currentPage);
      this.$emit('handleCurrentChange', { skip: (currentPage - 1) * this.pageSize, limit: this.pageSize, currentPage });
    },
  },
};
</script>

<style lang="less" scoped>
.top {
  padding: 15px 0;
  border-bottom: 1px solid #cccc;
}
.top .topTitle {
  padding: 0 10px;
}
.top .topAdd {
  padding: 0 10px 0 0;
  text-align: right;
}
.page {
  padding: 20px 0;
  text-align: center;
}
</style>

