<template>
  <div id="debt">
    <el-row>
      <el-col :span="24" class="debt">
        <el-col :span="24" class="top">
          <topInfo :topTitle="topTitle"></topInfo>
        </el-col>
        <el-col :span="24" class="search"> </el-col>
        <el-col :span="24" class="main">
          <newsInfo
            :debtTable="debtTable"
            :total="total"
            @clickRest="clickRest"
            @handleClick="handleClick"
            :noshenhetable="noshenhetable"
            :shenheTable="shenheTable"
          ></newsInfo>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import topInfo from '@/layout/common/topInfo.vue';

import newsInfo from '@/layout/supermarket/newsInfo.vue';
// import { createNamespacedHelpers } from 'vuex';
// const { mapActions } = createNamespacedHelpers('companyup');
export default {
  name: 'dept',
  props: {},
  components: {
    topInfo, //头部导航
    // searchInfo, //搜素
    newsInfo, //其他用户列表
  },
  data: () => ({
    topTitle: '债权产品',
    display: 'none',
    debtTable: [
      {
        name: '产品1',
        status: '0',
        publish_time: '13:34',
        mongey_min_rate: '1',
        mongey_max_rate: '1',
        claims_min_term: '1',
        claims_max_term: '2',
      },
    ],
    shenheTable: [],
    noshenhetable: [],
    total: 1,
  }),
  created() {
    // this.search();
  },
  computed: {},
  methods: {
    // ...mapActions(['query', 'delete','update','fetch']),
    // async search({ skip = 0, limit = 10, ...info } = {}) {
    // const res = await this.query({ skip, limit, ...info });
    // var weishenhe = res.data.filter(item => item.status === '0');
    // var success = res.data.filter(item => item.status === '1');
    // var shibai = res.data.filter(item => item.status === '2');
    // this.$set(this, `debtTable`, weishenhe);
    // this.$set(this, `shenheTable`, success);
    // this.$set(this, `noshenhetable`, shibai);
    // },

    async clickRest(newid) {
      //   const res = await this.fetch(newid);
      //   if (res.data.top == '0') {\
      //res.data.id = newid;
      //     res.data.top = 1;
      //     let res = this.update(res.data);
      //   } else {
      //     res.data.top = '0';
      //res.data.id = newid;
      //     let res = this.update(res.data);
      //   }
    },

    // 修改
    handleClick(newid) {
      this.$router.push({ path: '/supermarket/debtdetail', query: { id: newid } });
    },
  },
};
</script>

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