<!--
  @description: 发布中标结果公示
  @Modifier: 肖文龙
  @Modifier: hfx联调 2020/2/19-09:54
  @routerPath: /bidding/publishResultBulletin
  @date: 2020/1/9-19:28
-->
<template>
  <div>
    <div class="title p0-16 clearfix">
      <div class="title-back pointer" @click="back">
        <i class="iconfont icon-fanhui mr10" />中标结果公示发布列表
      </div>
    </div>
    <!--公示内容预览-->
    <resultBulletinDetail />
    <!--保存按钮-->
    <div class="but_footer">
      <div class="but_footer-h" />
      <div class="but_footer-but">
        <el-button :loading="confirmLoading" type="primary" @click="publishBulletin">
          发布中标结果公示
        </el-button>
        <el-button :loading="confirmLoading" @click="back">
          返 回
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { uploadResultBulletinCms } from '@/api/bidding/bidCalibration'
import resultBulletinDetail from '../resultBulletin/resultBulletin-detail'
export default {
  name: 'SendSuccessfulPublicityPublish',
  components: {
    resultBulletinDetail
  },
  data() {
    return {
      confirmLoading: false,
      winBidResultBulletinId: this.$route.query.winBidResultBulletinId // 结果公示Id
    }
  },
  created() {
  },
  methods: {
    back() {
      this.$router.push('/bidding/resultBulletinPublish')
    },
    // 发布公告
    publishBulletin() {
      this.$confirm('确认发布?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.confirmLoading = true
        uploadResultBulletinCms(this.winBidResultBulletinId).then(response => {
          this.$message({
            message: '发布成功',
            type: 'success'
          })
          this.$router.push({
            path: '/bidding/resultBulletinPublish'
          })
          this.confirmLoading = false
        }).catch(() => {
          this.confirmLoading = false
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
