<template>
  <div v-if="data.status !== '结束'" class="inline-16">
      <el-button :type="!data.disabled?'':'primary'" :disabled="!data.disabled" slot="reference" size="mini" @click="onShow">结 束</el-button>
  </div>
</template>

<script>
export default {
  props:['data'],
  methods:{
    onShow() {
      this.$confirm('确定结束该活动吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal:false
      }).then(() => {
        this.finishRow()
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消结束该活动'
        });
      });
    },
    async finishRow () {
      const res = await this.$api.requested({
        "classname": "webmanage.saletool.orderclue.ordercluecampaign",
        "method": "endcampaign",
        "content": {
          "sat_campaignids": [this.data.sat_campaignid]
        }
      })
      this.tool.showMessage(res,()=>{
        this.$emit('onSuccess')
      })
    }
  }
}

</script>
<style>
</style>