<template>
  <div class="inline-16">
    <el-button type="text" size="mini" @click="releaseNotice">{{data.status === '发布'?'取消发布':'发布'}}</el-button>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {}
  },
  methods:{
    async releaseNotice () {
      const res = await this.$api.requested({
        "classname": "webmanage.saletool.notice.notice",
        "method": this.data.status === "发布"?"undercarriage":"release",
        "content": {
          "sat_noticeids":[this.data.sat_noticeid]
        }
      })
      console.log(res)
      if (res.code === 1) {
        this.$notify({
          title: '成功',
          message: this.data.status === "发布"?'下架成功':'发布成功',
          type: 'success'
        });
        this.$emit('onSuccess')
      } else {
        this.$notify({
          title: '失败',
          message: res.data,
          type: 'error'
        });
      }
    }
  }
}

</script>
<style>
</style>