<template>
  <div>
    <el-button type="primary" size="mini" @click="check('关闭')" v-if="data.status != '关闭' && tool.checkAuth($route.name,'close')">关 闭</el-button>
    <el-button type="primary" size="mini" @click="check('取消关闭')" v-else-if="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 isclose
        status == '关闭' ? isclose = true : isclose = false
        let res = await this.$api.requested({
          "id": 20230102095403,
          "version":1,
          "content": {
              "sa_promotionid": this.$route.query.id,
              "isclose":isclose
          }
        })
        this.tool.showMessage(res,() => {
          this.$emit('onSuccess')
        })
      })
    }
  },
};
</script>

<style scoped>

</style>
