<!--
  @description: 变更公告发布
  @Modifier: haoFx
  @routerPath:
  @date: 2020/3/12-15:37
-->
<template>
  <div>
    <div class="title p0-16 clearfix">
      <div class="title-back pointer" @click="back">
        <i class="iconfont icon-fanhui mr10" />变更公告发布列表
      </div>
    </div>
    <!--公示内容预览-->
    <makeChangeBulletinPdfDetail />
    <!--保存按钮-->
    <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>
import { releaseChangeBulletin } from '@/api/bidding/changeBulletin'
import makeChangeBulletinPdfDetail from '../tenderChangeBulletin/makeChangeBulletinPdf-detail'
export default {
  name: 'SendSuccessfulPublicityPublish',
  components: {
    makeChangeBulletinPdfDetail
  },
  data() {
    return {
      confirmLoading: false,
      changeBulletinId: this.$route.query.changeBulletinId // 变更公告Id
    }
  },
  methods: {
    back() {
      this.$router.push('/bidding/changeBulletinPublishList')
    },
    // 发布公告
    publishBulletin() {
      this.$confirm('确认发布?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.confirmLoading = true
        releaseChangeBulletin(this.changeBulletinId).then(response => {
          this.$message({
            message: '发布成功',
            type: 'success'
          })
          this.$router.push({
            path: '/bidding/changeBulletinPublishList'
          })
          this.confirmLoading = false
        }).catch(() => {
          this.confirmLoading = false
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
