<template>
  <div class="container-remindDlg">
    <el-dialog
      :title="remindList.IsRemind ? '取消提醒' : '互动提醒'"
      v-dialogDrag
      :visible.sync="isShowRemindDlg"
      :close-on-click-modal="false"
      :modal-append-to-body="false"
      @close="cancelHandle"
      center
      width="500px"
    >
      <div>
        <p v-if="remindList.IsRemind">请选择取消范围</p>
        <p v-else>设置提醒后，联系人的互动行为都将通过【查研观向小助手】提醒你，请选择设置范围</p>
        <div style="margin-top: 20px">
          <el-radio-group v-model="remindRadio">
            <el-radio :label="1" style="display: block">{{ remindList.IsRemind ? "单独取消此联系人的提醒" : "对此联系人单独设置" }}</el-radio>
            <el-radio :label="2" style="margin: 20px 0">{{ remindList.IsRemind ? "对该机构下的联系人批量取消" : "对该机构下的联系人批量设置" }}</el-radio>
          </el-radio-group>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelHandle">取 消</el-button>
        <el-button type="primary" @click="remindBtnHandler">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { customInterence, equityContacts } from "@/api/api.js";
export default {
  name: "",
  components: {},
  props: {
    isShowRemindDlg: {
      default: false,
      type: Boolean,
    },
    remindList: {
      default: {},
      type: Object,
    },
  },
  data() {
    return {
      remindRadio: 1,
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // 弹框关闭的事件
    cancelHandle() {
      this.remindRadio = 1;
      this.$parent.isShowRemindDlg = false;
      this.$emit("update:remindList", {});
    },
    // 确认事件
    async remindBtnHandler() {
      const res = await equityContacts.postUserRemind({
        UserId: this.remindList.UserId,
        SourceType: this.remindRadio,
        DoType: this.remindList.IsRemind ? 2 : 1,
      });
      if (res.Ret === 200) {
        this.cancelHandle();
        this.$parent.getCygxContactsList();
        this.$message.success("操作成功！");
      }
    },
  },
};
</script>
<style scoped lang="scss">
.container-remindDlg {
  display: block;
}
</style>
