<template>
  <div v-loading="loading">
    <div class="white-box">
      <leo-filter :filter="handleFilter" :dateRangePickerDisplay="false" :dateMonthPickerDisplay="true"></leo-filter>
      <el-table ref="multipleTable" :data="tableData" stripe style="width: 100%;">
        <el-table-column label="金额">
          <template slot-scope="scope">
            <span :class="incrClassArr[Number.parseInt(scope.row.IS_INCR)]">{{scope.row.AMOUNT}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="TOTAL" label="当前余额"></el-table-column>
        <el-table-column label="备注">
          <template slot-scope="scope">
            <el-tag v-show="scope.row.REMARK!==''">{{scope.row.REMARK}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="PERIOD_NUM" label="所在期数"></el-table-column>
        <el-table-column label="所在结算年月">
          <template slot-scope="scope">
            {{scope.row.CALC_MONTH}}
          </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 Vue from 'vue'
  import network from './../../utils/network'
  import tool from '@/utils/tool'
  import store from '@/utils/vuexStore'
  import LeoFilter from '@/components/Filter'
  import Pagination from '@/components/Pagination'

  export default {
    name: 'finance_flow-bonus',
    components: {LeoFilter, Pagination},
    mounted() {
      this.getData()
    },
    data() {
      return {
        tableData: null,
        bonusDetailData: {},
        loading: true,
        currentPage: 1,
        totalPages: 1,
        totalCount: 1,
        pageSize: 20,
        tool: tool,
        filterData: null,
        incrClassArr: ['text-success', 'text-danger', 'text-warning', 'text-info'],
      }
    },
    methods: {
      handleCurrentChange(page) {
        this.getData(page, this.pageSize)
      },
      handleSizeChange(pageSize) {
        this.getData(this.currentPage, pageSize)
      },
      handleFilter(model) {
        this.filterData = model
        this.getData(1, this.pageSize)
      },
      getData(page, pageSize) {
        network.getPageData(this, 'finance/flow-bonus', page, pageSize, this.filterData, function (response) {

        })
      },
    }
  }
</script>

<style scoped>

</style>