<template>
  <div id="financeClaimIndex">
    <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">
        <financeClaimIndexInfo @clickBtn="clickBtn"></financeClaimIndexInfo>
      </el-col>
      <el-col :span="24" class="main">
        <financeclaimsList :debtTable="debtTable" :total="total" :region="region" @pagechange="pagechange" ></financeclaimsList>
      </el-col>
    </el-col>
  </div>
</template>

<script>
import topInfo from '@/layout/common/detailTopInfo.vue';
import financeClaimIndexInfo from '@/layout/financeclaims/financeClaimInfo.vue';
import financeclaimsList from '@/layout/financeclaims/financeclaimsList.vue';
import { createNamespacedHelpers, mapGetters } from 'vuex';
const { mapActions: financeclaims } = createNamespacedHelpers('financeclaim');
export default {
  name: 'financeClaimIndex',
  props: {},
  components: {
    topInfo, //头部导航
    financeClaimIndexInfo, //搜素
    financeclaimsList, //债权产品列表
  },
  data: () => ({
    topTitle: '债权产品列表',
    display: 'none',
    debtTable: [],
    total: '',
    cpname: '',
    jgname:'',
    region:'1'

  }),
  created() {
    this.financeclaimsList();
  },
  computed: {},
  methods: {
    ...financeclaims(['fclaimsList', 'orUpdate', 'one', 'dupdate','fetch','update']),
    async financeclaimsList({ skip = 1, limit = 10,type=0,status=this.region} = {}) {
      const res = await this.fclaimsList({ skip, limit ,type,status});
      this.$set(this, `debtTable`, res.res);
      this.$set(this, `total`, res.total);
    },
    async pagechange(data) {
      var skip = data.skip;
      var limit = 10;
      var innewname=this.jgname;
      var name = this.cpname ;
      var status=this.region;
   //   var  uid = '5e79672d0217a7336048b4c5' ;
      var type=0;
      const res = await this.fclaimsList({ skip, limit ,type,innewname,name,status});
      this.$set(this, `debtTable`, res.res);
      this.$set(this, `total`, res.total);
    },
    //查询
    async clickBtn(data) {
      var innewname=data.innewname;
      var name = data.name;
      this.cpname = data.name;
      this.jgname = data.innewname;
      this.region=data.region;
      var status=data.region;
      var skip = 0;
      var limit = 10;
     // var  uid = '5e79672d0217a7336048b4c5' ;
      var type=0;
      const res = await this.fclaimsList({ skip, limit ,type,innewname,name,status});
      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;
}
.search {
        width: 97%;
        height: 35px;
        margin: 20px;
}
</style>
