<template>
  <div id="followList">
    <el-row>
      <el-col :span="24">
        <el-table ref="debtTable" :data="debtTable" style="width: 100%" border>
          <el-table-column type="index" label="序号" width="50" align="center"> </el-table-column>
          <el-table-column label="企业名称" align="center">
            <template slot-scope="scope">
              <span class="hand"  @click="$router.push({ path: '/follow/followDetail', query: { id: scope.row.clamnew._id, sxid: scope.row._id, orcredit: scope.row.orcredit } })">{{ scope.row.comnewname}}</span>
            </template>
          </el-table-column>
          <el-table-column property="clamnew.money" label="融资金额(万元)" align="center"> </el-table-column>
          <el-table-column property="clamnew.use" label="融资用途" align="center"> </el-table-column>
          <el-table-column label="当前状态" align="center">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{scope.row.orcredit == '0' ? '已接单' : scope.row.orcredit == '2' ? '已通过' : scope.row.orcredit == '3' ? '已拒绝' : ' '}}</span>
            </template>
          </el-table-column>
          <el-table-column label="期望利率范围" align="center">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.clamnew.mongey_min_rate }}%~{{ scope.row.clamnew.mongey_max_rate }}%</span>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" align="center">
            <template slot-scope="scope">
              <el-button v-if="scope.row.orcredit == 0" @click.prevent="tongguosp(scope.row.orcredit,scope.row._id)" type="text" icon="el-icon-s-help" title="通过"></el-button>
              <el-button v-if="scope.row.orcredit == 2" @click.prevent="tongguosp(scope.row.orcredit,scope.row._id)" type="text" icon="el-icon-s-check" title="放款"></el-button>
              <el-button @click.prevent="deleteRow(scope.row._id,'')" type="text" icon="el-icon-warning-outline" title="拒绝"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row class="page">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-size="10"
            layout="total, prev, pager, next, jumper"
            :total="total"
          >
          </el-pagination>
        </el-row>
      </el-col>
    </el-row>
    <el-row>
      <el-dialog title="分配" :visible.sync="dialogFormVisible" :show-close="false" width="30%">
        <el-form :model="dialogform">
          <el-form-item label="放款额度" :label-width="formLabelWidth">
            <el-input  style="width: 50%" v-model="dialogform.money" autocomplete="off"></el-input>万元
          </el-form-item>
          <el-form-item label="放款产品" :label-width="formLabelWidth">
            <el-input style="width: 50%" v-model="dialogform.sxcpname" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="放款期限" :label-width="formLabelWidth">
            <el-input style="width: 50%" v-model="dialogform.sxhowlong" autocomplete="off"></el-input>个月
          </el-form-item>
          <el-form-item label="放款利率" :label-width="formLabelWidth">
            <el-input style="width: 50%" v-model="dialogform.sxcplilue" autocomplete="off"></el-input>%
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="quxiao">取 消</el-button>
          <el-button type="primary" @click="queding">确 定</el-button>
        </div>
      </el-dialog>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'followList',
  props: {
    debtTable: null,
    total: null,
    dialogFormVisible: null,
    dialogform:null,
  },
  components: {},
  data: () => ({
    currentPage: 1,
  }),
  created() {},
  computed: {},
  methods: {
    deleteRow(id,delValue) {
      this.$emit('deleteRow', id,delValue);
    },
    clickRest(id) {
      this.$emit('clickRest', id);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.$emit('pagechange', { skip: val });
    },
    tongguosp(orcredit,followid) {
      this.$emit('tongguosp', orcredit,followid);
    },
    quxiao() {
      this.$emit('quxiao');
    },
    queding() {
      this.$emit('queding', { data: this.dialogform });
    },
  },
};
</script>

<style lang="less" scoped>
.page {
  text-align: center;
  padding: 15px 0;
}
.hand:hover{
  cursor: pointer;
  color: dodgerblue;
  margin-left: 10px;
}
</style>
