<template>
  <div v-loading="loading">
    <div class="white-box">
      <filter-transfer :filter="handleFilter" :dateRangePickerDisplay="true"></filter-transfer>
      <el-table :data="tableData" stripe style="width: 100%;">
        <el-table-column label="转出账户" prop="OUT_WALLET_NAME"></el-table-column>
        <el-table-column label="接收会员编号" prop="LAST_IN_USER_NAME"></el-table-column>
        <el-table-column label="接收会员姓名" prop="LAST_IN_REAL_NAME"></el-table-column>
        <el-table-column label="转入账户" prop="IN_WALLET_NAME"></el-table-column>
        <el-table-column label="转账金额" prop="ORI_AMOUNT">
          <template slot-scope="scope">
            {{tool.formatPrice(scope.row.ORI_AMOUNT)}}<br>
          </template>
        </el-table-column>
        <el-table-column label="手续费" prop="FEE" v-if="showFee">
          <template slot-scope="scope">
            {{tool.formatPrice(scope.row.FEE)}}<br>
          </template>
        </el-table-column>
        <el-table-column label="实际入账金额" prop="AMOUNT" v-if="showFee">
          <template slot-scope="scope">
            {{tool.formatPrice(scope.row.AMOUNT)}}<br>
          </template>
        </el-table-column>
        <el-table-column label="转账时间">
          <template slot-scope="scope">
            {{tool.formatDate(scope.row.CREATED_AT)}}<br>
          </template>
        </el-table-column>
        <el-table-column label="备注" prop="REMARK"></el-table-column>
      </el-table>
      <div class="white-box-footer">
        <el-button type="primary" size="small" @click="handleAdd">我要转账</el-button>
        <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 baseInfo from '@/utils/baseInfo'
  import Pagination from '@/components/Pagination'
  import FilterTransfer from "../../components/FilteTransfer";

  export default {
    name: 'finance_transfer-list',
    components: {
        FilterTransfer,
        Pagination},
    mounted () {
      this.getData()
    },
    data () {
      return {
        tableData: null,
        loading: true,
        currentPage: 1,
        totalPages: 1,
        totalCount: 1,
        pageSize: 20,
        tool: tool,
        showFee: false,
        filterData: null,
      }
    },
    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)
      },
      handleAdd () {
        this.$router.push({path: `/finance/transfer-add`})
      },
      getData (page, pageSize) {
        let vueObj = this;
        network.getPageData(this, 'finance/transfer-list', page, pageSize, this.filterData, function (response) {
          vueObj.showFee = response.showFee
        })
      },
    }
  }
</script>

<style scoped>

</style>