<template>
  <div class="inline-16">
    <el-button type="text" :disabled="data.status === '结束'" size="small" @click="changeStatus">{{data.status === '新建'?'发 布':data.status === '结束'?'发 布':'取消发布'}}</el-button>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {}
  },
  methods:{
    async changeStatus () {
      if (this.data.status === '新建') {
        const res = await this.$api.requested({
          "classname": "webmanage.saletool.orderclue.ordercluecampaign",
          "method": "release",
          "content": {
            "sat_campaignids": [this.data.sat_campaignid]
          }
        })
        this.tool.showMessage(res,()=>{
          this.$emit('onSuccess')
        })
      } else {
        const res = await this.$api.requested({
          "classname": "webmanage.saletool.orderclue.ordercluecampaign",
          "method": "undercarriage",
          "content": {
            "sat_campaignids": [this.data.sat_campaignid]
          }
        })
        this.tool.showMessage(res,()=>{
          this.$emit('onSuccess')
        })
      }
    }
  }
}

</script>
<style>
</style>