<template>
  <div>
    <el-button size="mini"  :type="!disabled?'':'primary'" block @click="onshow" :disabled="!disabled">退回至公海</el-button>
  </div>
</template>

<script>
export default {
  name: "toBack",
  props:["data","disabled"],
  methods:{
    onshow() {
      this.$confirm('此操作会将客户退回公海, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.goBack()
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消退回'
        });
      });
    },
    async goBack(){
      const res = await this.$api.requested({
        "id": 20221014102602,
        "content": {
          "sa_customerpoolid":this.data.sa_customerpoolid_source,//公海池id
          "sa_customersid":this.data.sa_customersid//客户id
        },
      })
      this.tool.showMessage(res,()=>{
        this.$store.dispatch('changeDetailDrawer',false)
        this.$emit("backSuccess")
      })
    }
  }
}
</script>

<style scoped>

</style>