<template>
  <div v-loading="loading">
    <div class="white-box">
      <el-table :data="tableData" stripe style="width: 100%;">
        <el-table-column label="会员编号" prop="USER_NAME"></el-table-column>
        <el-table-column label="姓名">
          <template slot-scope="scope">
            {{scope.row.BASE_INFO.REAL_NAME}}
          </template>
        </el-table-column>
        <el-table-column label="手机">
          <template slot-scope="scope">
            {{scope.row.BASE_INFO.MOBILE}}
          </template>
        </el-table-column>
        <el-table-column label="民族">
          <template slot-scope="scope">
            {{scope.row.BASE_INFO.NATION}}
          </template>
        </el-table-column>
        <el-table-column label="加入时间" width="200">
          <template slot-scope="scope">
            {{tool.formatDate(scope.row.CREATED_AT)}}
          </template>
        </el-table-column>
      </el-table>
      <div class="white-box-footer">
        <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
      </div>
    </div>
  </div>
</template>

<script>
import network from './../../utils/network'
import tool from './../../utils/tool'
import store from '@/utils/vuexStore'
import Pagination from '@/components/Pagination'

export default {
  name: 'user_index',
  components: {Pagination},
  mounted () {
    this.getData()
  },
  data () {
    return {
      tableData: null,
      loading: true,
      currentPage: 1,
      totalPages: 1,
      totalCount: 1,
      pageSize: 20,
      tool: tool,
    }
  },
  methods: {
    handleCurrentChange (page) {
      this.getData(page, this.pageSize)
    },
    handleSizeChange (pageSize) {
      this.getData(this.currentPage, pageSize)
    },
    getData (page, pageSize) {
      network.getPageData(this, 'user/rec-user', page, pageSize)
    }
  }
}

</script>

<style scoped>

</style>