import { activity, User } from "@/config/api.js"; let app = getApp(); export default { methods: { //报名/取消报名 signupIsAddOfCancel(type, valName = "") { if (this.detailData.IsSignup == 1) { const str = this.detailData.ActivityTime.replace(/-/g, "/"); const date = new Date(str); const times = date.getTime(); const num = new Date().getTime(); if (times - num <= 3600000) { uni.showModal({ confirmText: "知道了", showCancel: false, confirmColor: "#3385FF", content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理", }); return; } uni.showModal({ content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?", confirmColor: "#3385FF", cancelColor: "#606266", success: async (res) => { if (res.confirm) { const res = await activity.signupCancel({ ActivityId: this.detailData.ActivityId, SignupType: type }); if (res.Ret === 200) { type == 1 ? uni.showToast({ title: "预约外呼已取消", duration: 2000, }) : uni.showToast({ title: "已取消报名", duration: 2000, }); this.getActivityDetail(); } } }, }); } else { let timer = null; if (this.flag) return; clearTimeout(timer); this.flag = true; this.selectShow = false; activity .signupAdd({ ActivityId: this.detailData.ActivityId, SignupType: type, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType; this.countryCode = res.Data.CountryCode; this.mobileEdit = res.Data.Mobile; this.goOnNextStep = res.Data.GoFollow; this.idTypeCancel = { cutId: res.Data.ActivityId, state: 1, }; if (res.Data.GoBindEmail) { this.mailboxBinding = true; return; } if (res.Data.SignupStatus !== "Success") { this.isShow = true; } else { if (res.Data.GoOutboundMobile) { this.editIsShow = true; } else if (res.Data.GoFollow) { this.goFollow = res.Data.GoFollow; } else if (res.Data.SignupStatus == "Success") { this.isShow = true; } } } }); timer = setTimeout(() => { this.flag = false; }, 500); } }, // 预约/取消 async summaryIsHandel() { if (this.detailData.IsAppointment == 0) { const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id) }); if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; this.signupType = "summaryIsHandel"; this.goOnNextStep = res.Data.GoFollow; if (res.Data.SignupStatus !== "Success") { this.isShow = true; } else { if (res.Data.GoFollow) { this.goFollow = res.Data.GoFollow; } else if (res.Data.SignupStatus == "Success") { this.isShow = true; } } this.selectShow = false; } } else { uni.showModal({ content: "确定要取消预约本场调研的纪要吗?", confirmColor: "#3385FF", cancelColor: "#606266", success: async (res) => { if (res.confirm) { const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id) }); if (res.Ret === 200) { this.getActivityDetail(); } } }, }); } }, // 取消会议提醒接口 meetingReminderCancel() { if (this.detailData.IsCancelMeetingReminder == 1) { activity .meetingReminderCancel({ ActivityId: Number(this.id), }) .then((res) => { if (res.Ret == 200) { uni.showModal({ confirmText: "知道了", confirmColor: "#3385FF", content: res.Msg, showCancel: false, success: (res) => { if (res.confirm) { this.getActivityDetail(); } }, }); } }); } else { this.meetingReminderAdd(); } }, // 添加会议提醒 meetingReminderAdd() { activity .meetingReminderAdd({ ActivityId: Number(this.id), }) .then((res) => { if (res.Ret == 200) { uni.showModal({ confirmText: "知道了", confirmColor: "#3385FF", content: res.Msg, showCancel: false, success: (res) => { if (res.confirm) { this.getActivityDetail(); } }, }); } }); }, // 我要报名 wanttosignup() { if (this.detailData.IsLimitPeople == 1 && this.detailData.ActivityTypeName == "公司调研电话会") { this.selectShow = true; } else { this.signupIsAddOfCancel(3); } }, // 提问 askingGo(type = "") { uni.navigateTo({ url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type, }); }, }, };