<template>
  <div id="doneclaim">
    <el-col :span="24" class="debt">
      <el-col :span="24" class="top">
        <topInfo :topTitle="topTitle" :display="display"></topInfo>
      </el-col>
      <el-col :span="24" class="main">
        <followHistoryList :debtTable="debtTable" :total="total" @pagechange="pagechange"></followHistoryList>
      </el-col>
    </el-col>
  </div>
</template>

<script>
import topInfo from '@/layout/common/topInfo.vue';
import followHistoryList from '@/layout/done/followHistoryList.vue';
import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
const { mapActions: financefollow } = createNamespacedHelpers('follow');
export default {
  name: 'doneclaim',
  props: {},
  components: {
    topInfo, //头部导航
    followHistoryList, //债权需求列表
  },
  data: () => ({
    topTitle: '授信债权需求历史',
    display: 'none',
    debtTable: [],
    total: '',
  }),
  created() {
    this.followHistoryList();
  },
  computed: {
    ...mapState(['user']),
  },
  methods: {
    ...financefollow(['credit', 'followClaimHistory', 'delete']),
    async followHistoryList({ skip = 1, limit = 10, userid = this.user.userid } = {}) {
      const res = await this.followClaimHistory({ skip, limit, userid });
      this.$set(this, `debtTable`, res.res);
      this.$set(this, `total`, res.total);
    },
    data: () => ({
      topTitle: '授信债权需求历史',
      display: 'none',
      debtTable: [],
      total: '',
    }),
    created() {
      this.followHistoryList();
    },
    computed: {
      ...mapState(['user']),
    },
    methods: {
      ...financefollow(['credit','followClaimHistory','delete']),
      async followHistoryList({ skip = 1, limit = 10,userid = this.user.userid,uid = this.user.uid} = {}) {
        const res = await this.followClaimHistory({ skip, limit,userid,uid});
        this.$set(this, `debtTable`, res.res);
        this.$set(this, `total`, res.total);
      },

      async pagechange(data) {
        var skip = data.skip;
        var limit = 10;
        var userid =  this.user.userid;
        var uid = this.user.uid;
        const res = await this.followClaimHistory({ skip, limit,userid ,uid});
        this.$set(this, `debtTable`, res.res);
        this.$set(this, `total`, res.total);
      },
    },
  },
};
</script>

<style lang="less" scoped>
.debt {
  padding: 20px;
}
.top {
  border-bottom: 1px solid #ccc;
}
</style>
