<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="Transfer accounts" prop="OUT_WALLET_NAME"></el-table-column> <!-- 转出账户 -->
        <el-table-column label="Receiving Member Code" prop="LAST_IN_USER_NAME"></el-table-column> <!-- 接收会员编号 -->
        <el-table-column label="Receiving Member Name" prop="LAST_IN_REAL_NAME"></el-table-column> <!-- 接收会员姓名 -->
        <el-table-column label="Transfer into account" prop="IN_WALLET_NAME"></el-table-column> <!-- 转入账户 -->
        <el-table-column label="Transfer amount" 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="Transfer time"> <!-- 转账时间 -->
          <template slot-scope="scope">
            {{tool.formatDate(scope.row.CREATED_AT)}}<br>
          </template>
        </el-table-column>
        <el-table-column label="Note" 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>
