import { activity, User } from "@/config/api.js"; import { isTimeGreaterThanCurrent, isWithinOneHour } from "@/config/util.js"; export default { methods: { //报名/取消报名 signupIsAddOfCancel(type, valName = "") { type = type ? type : valName; if (this.detailData.IsSignup == 1) { if (this.detailData.IsResearchPoints) { if (isTimeGreaterThanCurrent(this.detailData.CancelDeadline)) { uni.showModal({ confirmText: "知道了", showCancel: false, confirmColor: "#376cbb", content: "当前时间点已无法取消报名,若想取消,请联系对口销售", }); return; } } if (isWithinOneHour(this.detailData.ActivityTime, 3600000)) { uni.showModal({ confirmText: "知道了", showCancel: false, confirmColor: "#376cbb", content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理", }); return; } uni.showModal({ content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?", confirmColor: "#376cbb", cancelColor: "#606266", success: async (res) => { if (res.confirm) { const res = await activity.signupCancel({ ActivityId: this.detailData.ActivityId, SignupType: type, PageRouter: this.$store.state.pageRouterActivity }); 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; if (this.detailData.IsResearchPoints) { this.researchPointsHandler(this.detailData.ActivityId, type, this.detailData); } else { this.myIsApplyHandler(this.detailData.ActivityId, type, valName); } timer = setTimeout(() => { this.flag = false; }, 500); } }, // 预约/取消 async summaryIsHandel() { if (this.detailData.IsAppointment == 0) { const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity }); 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; res.Data.SignupStatus == "Success" && (this.detailData.IsAppointment = 1); this.synchronization(); } } else { uni.showModal({ content: "确定要取消预约本场调研的纪要吗?", confirmColor: "#376cbb", cancelColor: "#606266", success: async (res) => { if (res.confirm) { const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity }); if (res.Ret === 200) { this.getActivityDetail(); } } }, }); } }, // 取消会议提醒接口 meetingReminderCancel() { if (this.detailData.IsCancelMeetingReminder == 1) { activity .meetingReminderCancel({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity, }) .then((res) => { if (res.Ret == 200) { uni.showModal({ confirmText: "知道了", confirmColor: "#376cbb", content: res.Msg || res.Data.PopupMsg, showCancel: false, success: (res) => { if (res.confirm) { this.getActivityDetail(); } }, }); } }); } else { this.meetingReminderAdd(); } }, // 添加会议提醒 meetingReminderAdd() { activity .meetingReminderAdd({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; this.jurisdictionList.isActivityDetail = true; if (res.Data.SignupStatus !== "Success") { this.isShow = true; } else { if (res.Data.SignupStatus == "Success") this.isShow = true; } // uni.showModal({ // confirmText: "知道了", // confirmColor: "#376cbb", // content: res.Msg || res.Data.PopupMsg, // showCancel: false, // success: (res) => { // if (res.confirm) { // this.getActivityDetail(); // } // }, // }); } }); }, // 我要报名 wanttosignup() { if ( ( (!this.detailData.IsResearchPoints && this.detailData.ActivityTypeId == 3 && !this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1) || (this.detailData.IsYidongConduct && this.detailData.IsCanOutboundCall) || (!this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1 && [1, 2].includes(this.detailData.ActivityTypeId))) && this.detailData.IsZoom !=1 ) { this.selectShow = true; this.selectYdong = this.detailData.IsYidongConduct; } else { this.signupIsAddOfCancel(3); } }, // 提问 askingGo(type = "") { uni.navigateTo({ url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type, }); }, // 研选扣点的事件 async researchPointsHandler(id, type, item) { const res = await activity.activityCheck({ ActivityId: id, }); if (res.Ret === 200) { let { Data } = res; this.checkResearchList = Data; this.checkResearchList.childrenType = type; this.jurisdictionList = item; this.isResearchModalShow = true; } }, // 报名拆分出来 myIsApplyHandler(id, type, valName = "") { activity .signupAdd({ ActivityId: this.detailData.ActivityId, SignupType: type, PageRouter: this.$store.state.pageRouterActivity, }) .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.SignupStatus !== "Success") { this.isShow = true; } else { this.detailData.IsSignup = 1; this.detailData.SignupNum += 1; this.detailData.SignupType = type; this.synchronization(); if (res.Data.GoBindEmail) this.mailboxBinding = true; 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; } } }); }, /* 无权限申请开通权限 */ applyAuth() { /* 区分是否是潜在用户 */ this.jurisdictionList.HasPermission === 3 ? uni.navigateTo({ url: "/pageMy/applyTrial/applyTrial?tryType=Activity&detailId=" + (this.idAct || Number(this.id)), }) : this.jurisdictionList.HasPermission === 5 ? this.sellerApplyAuth() : uni.showModal({ title: "", content: "您已经提交过申请了,请耐心等待", showCancel: false, confirmColor: "#376cbb", success: function (res) {}, }); }, //销售的立即申请 sellerApplyAuth() { User.applyTry({ TryType: "Activity", DetailId: this.idAct || Number(this.id), }).then((res) => { if (res.Ret === 200) { uni.showModal({ title: "", content: "提交申请成功,请耐心等待", showCancel: false, confirmColor: "#376cbb", success: function (res) { this.backIndex(); }, }); } }); }, // 返回首頁 backIndex() { uni.navigateBack({ fail() { uni.switchTab({ url: "/pages/index/index", }); }, }); }, }, };