<!--
  @description: 发布终止公告
  @Modifier: haoFx
  @routerPath: /bidding/stopbiddingPublish-add
  @date: 2020/12/21
-->
<template>
  <div>
    <div class="title p0-16 clearfix">
      <div class="title-back pointer" @click="back">
        <i class="iconfont icon-fanhui mr10" />终止公告发布
      </div>
    </div>
    <!--公告内容预览-->
    <stopbiddingRecordPdfPdfDetail />
    <!--保存按钮-->
    <div class="but_footer">
      <div class="but_footer-h" />
      <div class="but_footer-but">
        <el-button type="primary" :loading="confirmLoading" @click="publishBulletin">
          发布公告
        </el-button>
        <el-button :loading="confirmLoading" @click="back">
          返 回
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
/* api */
import { releaseStopBulletin } from '@/api/bidding/stopbiddingRecord'// 公告发布列表
/* 组件 */
import stopbiddingRecordPdfPdfDetail from '../tenderStopbidding/makeStopbiddingRecordPdf-detail'
export default {
  name: 'StopbiddingPublishAdd',
  components: {
    stopbiddingRecordPdfPdfDetail
  },
  data() {
    return {
      confirmLoading: false,
      stopBulletinId: this.$route.params.stopBulletinId // 招标终止id
    }
  },
  created() {
    sessionStorage.setItem('bizId', this.stopBulletinId)// 招标终止id
  },
  methods: {
    // 返回发布列表
    back() {
      this.$router.push('/bidding/stopbiddingPublish-list')
    },
    // 发布公告
    publishBulletin() {
      this.$confirm('确认发布?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.confirmLoading = true
        releaseStopBulletin({ stopBulletinId: this.stopBulletinId }).then(response => {
          this.$message({
            message: '发布成功',
            type: 'success'
          })
          this.back()// 返回
          this.confirmLoading = false
        }).catch(() => {
          this.confirmLoading = false
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
