import { activity, User } from "@/config/api.js"; let app = getApp(); export default { data() { return { page_no: 1, pageSize: 10, collectList: [], status: "loadmore", refresh: false, //正在下拉 loadText: { loadmore: "上拉加载更多", loading: "加载中", nomore: "已经到底了", }, /**/ tabsActive: 0, /**/ /* 共用的弹框 */ isShow: false, //弹框 signupType: "", //关注类型 goFollow: false, //是否关注公众号 hasPermission: "", //是否有权限 jurisdictionList: {}, editIsShow: false, //外呼莫泰框 isCancelShow: false, idTypeCancel: { id: "", type: 1, cutId: "", state: "", isNum: false, }, countryCode: "", //外呼区号 mobileEdit: "", //外呼手机号 goOnNextStep: "", //设置外呼号后弹出哪个 isShowhasPermission: false, //拨打销售电话 applyForIsShow: false, //潜在用户 mailboxBinding: false, //是否绑定邮箱 }; }, methods: { // 我要报名 wanttosignup(item) { this.activityIdAdd = item.ActivityId; if (item.YidongActivityId) { this.goDetail(item); return; } else if (item.IsLimitPeople == 1 && item.ActivityTypeName == "公司调研电话会") { this.selectShow = true; } else { this.activityIdAdd = ""; this.signupIsAddOfCancel(item, 3); } }, //报名/取消报名 signupIsAddOfCancel(item, type, valName = "") { let id = this.activityIdAdd || item.ActivityId; let itemData = item; if (item && item.IsSignup == 1) { const str = item.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: item.ActivityId, SignupType: type }); if (res.Ret === 200) { this.collectList.forEach((valueAct) => { if (valueAct.ActivityId === id) { valueAct.IsSignup = 0; } }); this.init(); type == 1 ? uni.showToast({ title: "预约外呼已取消", duration: 2000, }) : uni.showToast({ title: "已取消报名", duration: 2000, }); if (valName === "我的") { this.getActivityList(); } } } }, }); } else { let timer = null; if (this.flag) return; clearTimeout(timer); this.flag = true; this.selectShow = false; activity .signupAdd({ ActivityId: id, SignupType: type, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; if (this.hasPermission == 1) { const index = this.collectList.findIndex((key) => key.ActivityId == id); this.collectList[index].SignupType = type; 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; } this.collectList.forEach((valueAct) => { if (valueAct.ActivityId === id) { valueAct.IsSignup = 1; } }); } } else if (this.hasPermission == 2) { this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) { this.applyForIsShow = true; } } }); timer = setTimeout(() => { this.flag = false; }, 500); } }, // 弹框的初始化 init() { this.signupType = ""; this.goFollow = false; this.isShow = false; this.isCancelShow = false; }, //添加消息提醒接口 meetingReminderAdd(id, type) { if (type != 0) { this.meetingReminderCancel(id); return; } activity .meetingReminderAdd({ ActivityId: id, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; if (this.hasPermission == 1) { if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) { this.isShow = true; } else { this.goFollow = res.Data.GoFollow; } this.signupType = 999; this.idTypeCancel = { cutId: res.Data.ActivityId, state: 1, name: "conference", }; this.collectList.forEach((item) => { if (id == item.ActivityId) { item.IsCancelMeetingReminder = 1; } }); } else if (this.hasPermission == 2) { this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) { this.applyForIsShow = true; } } }); }, //取消消息提醒接口 meetingReminderCancel(id) { activity .meetingReminderCancel({ ActivityId: id, }) .then((res) => { if (res.Ret == 200) { uni.showModal({ confirmText: "知道了", confirmColor: "#3385FF", content: res.Msg, showCancel: false, success: (res) => { if (this.isrefresh) return this.getActivityList(); if (res.confirm) { this.collectList.forEach((item) => { if (id == item.ActivityId) { item.IsCancelMeetingReminder = 0; } }); } }, }); } }); }, //帮我带问 async askingGo(item, type = "") { const res = await activity.checkAskActivity({ ActivityId: item.ActivityId }); if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; if (this.hasPermission == 1) { uni.navigateTo({ url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type, }); } else if (this.hasPermission == 2) { this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) { this.applyForIsShow = true; } } }, // 弹框的初始化 init() { this.signupType = ""; this.goFollow = false; this.isShow = false; this.isCancelShow = false; }, //预约纪要、取消预约纪要 async summaryIsHandel(item, type = "") { if (item.IsAppointment == 0) { const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId }); if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; this.jurisdictionList = res.Data; if (this.hasPermission == 1) { 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; item.IsAppointment = 1; } item.IsAppointment = 1; } } else if (this.hasPermission == 2) { this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) { this.applyForIsShow = true; } } } else { uni.showModal({ content: "确定要取消预约本场调研的纪要吗?", confirmColor: "#3385FF", cancelColor: "#606266", success: async (res) => { if (res.confirm) { const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId }); if (res.Ret === 200) { item.IsAppointment = 0; this.init(); if (type === "我的") { this.getActivityList(); } } } }, }); } }, //去往详情页面 goDetail(item) { if (item.SourceType && item.SourceType == 2) { this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId); } else { this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId); } }, }, };