<template>
  <div v-loading="loading">
    <div class="white-box">
      <el-tabs v-model="filterStatus" @tab-click="handleFilterStatusClick">
        <el-tab-pane label="会员用户" name="1" :lazy="true"></el-tab-pane>
        <el-tab-pane label="后台操作人" name="2" :lazy="true"></el-tab-pane>
      </el-tabs>
      <el-table :data="tableData" stripe style="width: 100%;" >
        <el-table-column label="用户编号">
          <template slot-scope="scope">
            {{scope.row.ID}}
          </template>
        </el-table-column>
        <el-table-column label="用户姓名">
          <template slot-scope="scope">
            {{scope.row.REAL_NAME}}
          </template>
        </el-table-column>
        <el-table-column label="最后操作时间">
          <template slot-scope="scope">
            {{scope.row.UPDATE_TIME}}
          </template>
        </el-table-column>
      </el-table>
      <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
    </div>
  </div>
</template>

<script>
  import network from '@/utils/network'
  import tool from '@/utils/tool'
  import FilterUser from '@/components/FilterUser'
  import baseInfo from '@/utils/baseInfo'
  import permission from '@/utils/permission'
  import Pagination from '@/components/Pagination'
  import filterHelper from '@/utils/filterHelper'

  export default {
    name: 'leo-balance-audit-table',
    components: {FilterUser,Pagination},
    mounted() {
      network.getData('finance/change-balance-type').then(response => {
        this.type = response.type
        this.dealTypes = response.dealTypes
        this.getData()
      })
    },
    data() {
      return {
        tableHeaders: null,
        tableData: null,
        loading: true,
        multipleSelection: [],
        currentPage: 1,
        totalPages: 1,
        totalCount: 1,
        pageSize: 20,
        tool: tool,
        permission: permission,
        baseDecLevels: baseInfo.decLevels(),
        filterTypes: {},
        filterModel: {},
        filterStatus: '1',
        filterData: null,
        type: null,
        dealTypes: null,
        dialogEditLoading: false,
        dialogAuditLoading: false,
        dialogEditFormVisible: false,
        dialogAuditFormVisible: false,
        auditPassButtonStat: true,
      }
    },
    methods: {
      handleFilterStatusClick(tab, event) {
        filterHelper.clearFilterOption(this)
        this.getData()
      },
      handleCurrentChange(page) {
        this.getData(page, this.pageSize)
      },
      handleSizeChange(pageSize) {
        this.getData(this.currentPage, pageSize)
      },
      handleFilterUser(filterData) {
        filterHelper.handleFilterUser(this, filterData)
      },
      getData(page, pageSize) {
        let filterData = this.filterModel
        let vueObj=this
        filterData.filterStatus = this.filterStatus
        network.getPageData(this, 'config/user-online', page, pageSize, filterData, function (response) {
          vueObj.tableData = response.list
        })
      },
      handleExport(){
        this.$confirm(`确定要导出当前数据吗？`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          return network.getData(`finance/balance-audit-list-export`, this.filterModel)
        }).then(response => {
          this.$message({
            message: response,
            type: 'success'
          })
        }).catch(response => {

        })
      },
    }
  }
</script>

<style scoped>

</style>
