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

<script>
import topInfo from '@/layout/common/topInfo.vue';
import list from '@/layout/intelligentDocking/list.vue';
import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
const { mapActions: intelligentDocking } = createNamespacedHelpers('intelligentDocking');
export default {
  name: 'index',
  props: {},
  components: {
    topInfo, //头部
    list, //列表
  },
  data: () => ({
    topTitle: '银企对接已完成列表',
    display: 'block',
    debtTable: [],
    total: 0,
  }),
  created() {
    this.searchInfo();
  },
  computed: {
    ...mapState(['user']),
  },
  methods: {
    ...intelligentDocking(['dockingSearch']),
    // 查询列表
    async searchInfo({ skip = 1, limit = 10, ...info } = {}) {
      const res = await this.dockingSearch({ skip, limit, ...info });
      this.$set(this, `debtTable`, res.result);
      this.$set(this, `total`, res.total);
    },
    // 分页
    async pagechange(data) {
      var skip = data.skip;
      var limit = 10;
      var jg_id = this.user.userid;
      const res = await this.dockingSearch({ skip, limit });
      this.$set(this, `debtTable`, res.result);
      this.$set(this, `total`, res.total);
    },
    async handleCurrentChange({ skip, limit, currentPage }) {
      const res = await this.dockingSearch({ skip, limit });
      this.$set(this, `debtTable`, res.result);
      this.$set(this, `total`, res.total);
    },
  },
};
</script>

<style lang="less" scoped>
.top {
  height: 50px;
  margin: 0 0 10px 0;
}
.main {
  height: 765px;
  background: #ffffff;
}
</style>
