<template>
  <div v-if="(data.status == '审核' && tool.checkAuth($route.name,'send')) || (data.status == '发布' && tool.checkAuth($route.name,'cancelClose'))">
    <el-button type="primary" size="mini" @click="check('发布')" v-if="data.status == '审核' && tool.checkAuth($route.name,'send')">发 布</el-button>
    <el-button type="primary" size="mini" @click="check('取消发布')" v-else-if="data.status == '发布' && tool.checkAuth($route.name,'cancelClose')">取 消 发 布</el-button>
  </div>
</template>

<script>
export default {
  name: '',
  props:['data'],
  data() {
    return {
    };
  },
  computed:{
  },
  watch:{
  },
  methods: {
    check (status) {
      this.$confirm(`确定${status}当前促销方案吗?`,'提示',{
        confirmButtonText:'确定',
        cancelButtonText:'取消',
        type:'warning'
      }).then(async () => {
        let isrecheck
        status == '发布' ? isrecheck = true : isrecheck = false
        let res = await this.$api.requested({
          "id": 20221230145203,
          "version":1,
          "content": {
              "sa_promotionid": this.$route.query.id,
              "isrecheck":isrecheck
          }
        })
        this.tool.showMessage(res,() => {
          this.$emit('onSuccess')
        })
      })
    }
  },
};
</script>

<style scoped>

</style>
