<template>
  <div class="sales-contract-review">
    <cy-up-down-drag>
      <div slot="top">
        <sales-contract-management-view></sales-contract-management-view>
      </div>
      <div slot="bar">
        <div>
          合同审核
        </div>
      </div>
      <div slot="bottom">
        <div class="tempalte-content" style="min-height: auto; padding: 0px 20px ">
          <sales-contract-review-content ref="salesContractReview" :details-info="detailsInfo" />
          <div class="submit-btn">
            <el-button type="primary" style="width: 150px;" @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 setup>
import { approvalDetail, salesContractApprovalDoAudit } from '@/api/salesContractManagement/salesContractManagement'
import SalesContractReviewContent from './components/SalesContractReviewContent.vue'
import salesContractManagementView from './components/salesContractManagementView.vue'
export default {
  name: 'BiddingManagementTemplateReview',
  components: {
    SalesContractReviewContent,
    salesContractManagementView
  },
  data() {
    return {
      detailsInfo: {}
    }
  },
  created() {
    this.approvalDetail()
  },
  methods: {
    approvalDetail() {
      const { id } = this.$route.query
      approvalDetail({ id }).then(response => {
        this.detailsInfo = response.data
      })
    },
    onSubmit() {
      this.$refs.salesContractReview.getParams().then(data => {
        const params = {
          Loading: true,
          ...data
        }
        salesContractApprovalDoAudit(params).then(() => {
          this.$message.success('合同审核成功')
          this.$router.push({ name: 'SalesContractManagement' })
        })
      })
    }
  }
}
</script>

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