<template>
  <div class="business-review">
    <cy-up-down-drag>
      <div slot="top">
        <financing-view-content></financing-view-content>
      </div>
      <div slot="bar">
        <div>
          {{ $route.query.approvalType === 'business' ? '豁免-业务审核' : '豁免-风控审核' }}
        </div>
      </div>
      <div slot="bottom">
        <approve-content ref="approvecContent"></approve-content>
        <div class="submit-btn">
          <el-button @click="() => { $router.go(-1) }">取消</el-button>
          <el-button type="primary" @click="onSubmit">提交</el-button>
        </div>
      </div>
    </cy-up-down-drag>
  </div>
</template>

<script>
import { businessReviewSubmit, businessRiskControlSubmit } from '@/api/financingManage'
export default {
  components: {
    ApproveContent: () => import('./components/ApproveContent'),
    FinancingViewContent: () => import('./components/FinancingViewContent.vue')
  },
  data() {
    return {

    }
  },
  methods: {
    async onSubmit() {
      const { id } = this.$route.params
      const { taskId, approvalType } = this.$route.query
      const data = await this.$refs.approvecContent.getParams()
      const params = {
        Loading: true,
        financingBasicInfoId: id,
        taskId,
        ...data
      }
      if (approvalType === 'business') {
        businessReviewSubmit(params).then(res => {
          this.$message.success('提交成功')
          this.$router.go(-1)
        })
      } else {
        businessRiskControlSubmit(params).then(res => {
          this.$message.success('提交成功')
          this.$router.go(-1)
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
