<template>
  <div class="app-container">
    <h2>{{ this.$route.params.CustomerName }}额度调整记录</h2>
    <el-table
      :data="sData"
      border
      height="660"
    >
      <el-table-column label="调整时间" prop="CreateTime">
        <template scope="r">
          {{ r.row.CreateTime.replace('T',' ') }}
        </template>
      </el-table-column>
      <el-table-column label="调整人" prop="CreateUserName" />
      <el-table-column label="调整前额度" prop="OldValue" />
      <el-table-column label="调整后额度" prop="NewValue" />
    </el-table>
    <el-pagination
      :page-sizes="[100, 200, 300, 400]"
      :current-page="pagerDto.PageIndex"
      :page-size="pagerDto.PageSize"
      background
      layout="prev, pager, next ,total ,jumper,sizes,slot "
      :total="pagerDto.total"
      @current-change="pagerSerach"
    />
  </div>
</template>
<script>

import { _getAdjustmentQuotaLogs } from '@/api/customerBillCard'
export default {
  name: 'AdjustmentQuotaLogs',
  data() {
    return {
      sourceTargets: [],
      sData: [],
      ladding: false,
      pagerDto:
            {
              PageIndex: 1,
              PageSize: 100,
              total: 0,
              QuerySort: [{ Field: 'Id', IsDesc: true }],
              _Eq_Id: ''
            }
    }
  },
  mounted() {
    this.pagerDto._Eq_Id = this.$route.params.CustomerId
    this.pagerSerach()
  },
  methods: {
    pagerSerach(pageIndex) {
      if (pageIndex && pageIndex > 0) { this.pagerDto.PageIndex = pageIndex } else { this.pagerDto.PageIndex = 1 }

      this.ladding = true
      _getAdjustmentQuotaLogs(this.pagerDto)
        .then(response => {
          this.pagerDto.total = response.TotalCount
          this.sData = response.Result
          this.ladding = false
        })
        .catch(response => {
          this.ladding = false
        })
    }
  }
}
</script>
