<template>
  <div id="intelligentDockingFollowList">
    <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 property="intelligent.company_name" label="企业名称" align="center"> </el-table-column>-->
          <el-table-column label="企业名称" align="center">
            <template slot-scope="scope">
              <span class="hand" @click="$router.push({ path: '/intelligentDocking/intelligentDockingFollowDetail', query: { intelligentId: scope.row.intelligentId, creditStatus: scope.row.creditStatus } })">{{ scope.row.intelligent.company_name}}</span>
            </template>
          </el-table-column>

          <el-table-column property="intelligent.money" label="融资金额(万元)" align="center"> </el-table-column>
          <!--<el-table-column label="利率范围" align="center">-->
            <!--<template slot-scope="scope">-->
              <!--<span style="margin-left: 10px">{{ scope.row.intelligent.mongey_min_rate }}%~{{ scope.row.intelligent.mongey_max_rate }}%</span>-->
            <!--</template>-->
          <!--</el-table-column>-->
          <el-table-column label="当前状态" align="center">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{
                scope.row.creditStatus == '0'
                  ? '已接单'
                  : scope.row.creditStatus == '1'
                  ? '已放款'
                  : scope.row.creditStatus == '2'
                  ? '已通过'
                  : scope.row.creditStatus == '3'
                  ? '已拒绝'
                  : ' '
              }}</span>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" align="center">
            <template slot-scope="scope">
              <!--<el-button-->
                <!--@click="$router.push({ path: '/intelligentDocking/intelligentDockingFollowDetail', query: { intelligentId: scope.row.intelligentId } })"-->
                <!--type="text"-->
                <!--icon="el-icon-view"-->
                <!--title="查看详情"-->
              <!--&gt;</el-button>-->

              <el-button v-if="scope.row.creditStatus == 0" @click.prevent="tongguosp(scope.row.creditStatus,scope.row._id)" type="text" icon="el-icon-s-help" title="通过"></el-button>
              <el-button v-if="scope.row.creditStatus == 2" @click.prevent="tongguosp(scope.row.creditStatus,scope.row._id)" type="text" icon="el-icon-s-check" title="放款"></el-button>

              <span v-if="scope.row.intelligent.refuse_times != '3'">
                <el-button @click.prevent="deleteRow(scope.row)" type="text" icon="el-icon-warning-outline" title="拒绝"></el-button>
              </span>
            </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="dialogFormVisible2" :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-dialog title="拒绝" :visible.sync="dialogFormVisible" :show-close="false" :destroy-on-close="true">
        <el-form :model="dockForm">
          <el-form-item label="拒绝理由">
            <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" v-model="dockForm.reason"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dockOut">取 消</el-button>
          <el-button type="primary" @click="dockDormBtn">确 定</el-button>
        </div>
      </el-dialog>
    </el-row>

  </div>
</template>

<script>
export default {
  name: 'intelligentDockingFollowList',
  props: {
    debtTable: null,
    total: null,
    dockForm: null,
    dialogform:null,
    dialogFormVisible2: null,

  },
  components: {},
  data: () => ({
    currentPage: 1,
    dialogFormVisible: false,
    formLabelWidth: '80px',
  }),
  created() {},
  computed: {},
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.$emit('pagechange', { skip: val });
    },
    // 拒接按钮
    deleteRow(val) {
      this.dialogFormVisible = true;
      this.$emit('deleteRow', val);
    },
    // 拒绝提交按钮
    dockDormBtn() {
      this.$emit('dockDormBtn', { data: this.dockForm });
      this.dialogFormVisible = false;
    },
    // 取消
    dockOut() {
      this.dialogFormVisible = false;
      this.$emit('dockOut');
    },
    tongguosp(creditStatus,followid) {
      console.log(creditStatus,followid)
      this.$emit('tongguosp', creditStatus,followid);
    },
    quxiao() {
      this.$emit('quxiao');
    },
    queding() {
      this.$emit('queding', { data: this.dialogform });
    },
  },
};
</script>

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