<template>
    <div id="loanFollowndex">
        <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="search">
                <searchInfo @clickBtn="clickBtn"></searchInfo>
            </el-col>
            <el-col :span="24" class="main">
                <loanfollowLists :debtTable="debtTable" :total="total" @pagechange="pagechange" @deleteRow="deleteRow"></loanfollowLists>
            </el-col>
        </el-col>
    </div>
</template>

<script>
  import topInfo from '@/layout/common/topInfoloan.vue';
  import searchInfo from '@/layout/common/needSearchInfo.vue';
  import loanfollowLists from '@/layout/financeclaims/loanfollowList.vue';
  import { createNamespacedHelpers, mapGetters,mapState } from 'vuex';
  const { mapActions: loanfollow } = createNamespacedHelpers('loanfollow');
  export default {
    name: 'loanFollowndex',
    props: {},
    components: {
      topInfo, //头部导航
      searchInfo,
      loanfollowLists, //债权需求列表
    },
    data: () => ({
      topTitle: '授信小微数贷列表',
      display: 'none',
      debtTable: [],
      total: '',
      orcredit: '0'
    }),
    created() {
      this.loanfollowList();
    },
    computed: {
      ...mapState(['user']),
    },
    methods: {
      ...loanfollow(['credit','loanfLists','loanfOne']),
      async loanfollowList({ skip = 1, limit = 10,jkid =this.user.userid,orcredit=this.orcredit} = {}) {//this.user.userid
        const res = await this.loanfLists({ skip, limit,jkid, orcredit});
        this.$set(this, `debtTable`, res.res);
        this.$set(this, `total`, res.total);
      },

      async pagechange(data) {
        var skip = data.skip;
        var limit = 10;
        var jkid =this.user.userid;
        var orcredit = this.orcredit;
        const res = await this.loanfLists({ skip, limit,jkid,orcredit });
        this.$set(this, `debtTable`, res.res);
        this.$set(this, `total`, res.total);
      },
      async clickBtn(message) {//查询
        this.orcredit = message;
        var skip = 0;
        var limit =10;
        var jkid =this.user.userid;
        var orcredit =message;
        const res = await this.loanfLists({ skip, limit,jkid,orcredit });
        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>

