<template>
  <div class="inline-16">
    <el-button size="mini" :type="disabled || data.status === '已无效'?'':'primary'" :disabled="disabled || data.status === '已无效'" @click="dialog=true">无 效</el-button>
    <el-dialog append-to-body width="30%" title="无效" :visible.sync="dialog">
      <el-input type="textarea" v-model="deletereason" size="small" placeholder="无效原因"></el-input>
      <div class="dialog-footer">
        <el-button size="small" @click="dialog = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
/* 
id:数据id
nameId:接口id
nameKey:接口字段
 */
export default {
  props: ['id','disabled','data'],
  data () {
    return {
      deletereason:'',
      dialog:false
    }
  },
  methods: {
    async onSubmit() {
      let res = await this.$api.requested({
        'id':'20221208100602',
        "content": {
            "sat_orderclueid": this.id,
            "content": this.deletereason,
            "followupmode": "", //当面拜访、电话沟通
            "logtype": '无效', //跟进、成交、丢单、无效
            "competitor": "",
            "sat_ordercluefollowuplogid":'0'
        }
      })
      this.tool.showMessage(res,() => {
        this.$emit('onSuccess')
      })
    },
  },
  created () {
  }
}

</script>
