<template>
  <div class="business-review">
    <cy-up-down-drag>
      <div slot="top">
        <invoices-management-view></invoices-management-view>
      </div>
      <div slot="bar">
        <div>
          业务审核
        </div>
      </div>
      <div slot="bottom">
        <div class="tempalte-content" style="min-height: auto; padding: 0px 20px ">
          <business-review-content ref="businessReviewContent" />
          <div class="submit-btn">
            <el-button style="width: 150px;" type="primary" @click="onSubmit">确定</el-button>
            <el-button style="width: 150px;" @click="() => { $router.go(-1) }">取消</el-button>
          </div>
        </div>
      </div>
    </cy-up-down-drag>
  </div>
</template>

<script>
import { saleInvoiceApproval } from '@/api/invoicesManagement/invoicesManagement'
import BusinessReviewContent from './components/BusinessReviewContent.vue'
import InvoicesManagementView from './components/InvoicesManagementView.vue'
export default {
  name: 'BiddingManagementTemplateReview',
  components: {
    BusinessReviewContent,
    InvoicesManagementView
  },
  data() {
    return {
      Loading: false
    }
  },
  methods: {
    onSubmit() {
      this.$refs.businessReviewContent.getSubmit().then(data => {
        const { taskId, businessKey } = this.$route.query
        const params = {
          Loading: true,
          ...data,
          taskId,
          businessBasicInfoId: businessKey
        }
        saleInvoiceApproval(params).then(() => {
          this.$message.success('业务审核成功')
          this.$router.push({ name: 'InvoicesManagement' })
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  /* .template-examine .submit-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
  } */
</style>
