<template>
  <div class="pledge-way">
    <ol class="breadcrumb">
      <i class="icon-chevron-sign-left newBackBtn" @click="() => { $router.go(-1) }"></i>
      <li>业务管理</li>
      <li>保证方式确认</li>
    </ol>
    <up-down-drag>
      <div slot="top">
        <business-view></business-view>
      </div>
      <div slot="bar">
        <div>
          保证方式确认
        </div>
      </div>
      <div slot="bottom">
        <div class="tempalte-content" style="min-height: auto; padding: 0px 20px ">
          <pledge-way-content ref="pledgeWayContent"></pledge-way-content>
        </div>
      </div>
    </up-down-drag>
    <div class="submit-btn">
      <el-button type="primary" @click="onSubmit" style="width: 150px;">确定</el-button>
      <el-button @click="() => { $router.go(-1) }" style="width: 150px;">取消</el-button>
    </div>
  </div>
</template>

<script>
module.exports = {
  components: {
    PledgeWayContent: httpVueLoader('./components/PledgeWayContent.vue'),
    BusinessView: httpVueLoader('./components/BusinessView.vue')
  },
  data() {
    return {

    }
  },
  methods: {
    onSubmit() {
      this.$refs.pledgeWayContent.getSubmit().then(data => {
        const { taskId, businessKey } = this.$route.query
        const params = {
          Loading: true,
          ...data,
          taskId,
          businessBasicInfoId: businessKey
        }
        this.$api.businessManage.businessPledgeWaySubmit(params).then(() => {
          this.$message.success('保证方式确认成功')
          this.$router.push({ path: '/businessManage' })
        })
      })
    }
  },
}
</script>

<style scoped>
.pledge-way .submit-btn {
  position: absolute;
  bottom: 20px;
  right: 40px;
  width: 100%;
  background: #fff;
}
</style>
