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: "已经到底了", }, isNeedAddCountryCode: false, //判断是否需要区号 isAreaCode: false, areaCode: { id: "", type: "", }, /**/ tabsActive: 0, /**/ /* 共用的弹框 */ isShow: false, //弹框 signupType: "", //关注类型 goFollow: false, //是否关注公众号 signupStatus: "Success", //4个不同的类型提示文案 hasPermission: "", //是否有权限 jurisdictionList: { SellerMobile: "", PopupMsg: "", OperationMode: "", }, editIsShow: false, //外呼莫泰框 isCancelShow: false, idTypeCancel: { id: "", type: 1, cutId: "", state: "", isNum: false, }, countryCode: "", //外呼区号 mobileEdit: "", //外呼手机号 goOnNextStep: "", //设置外呼号后弹出哪个 isShowhasPermission: false, //拨打销售电话 applyForIsShow: false, //潜在用户 mailboxBinding: false, //是否绑定邮箱 }; }, methods: { // 我要报名 wanttosignup(id) { this.activityIdAdd = id; this.selectShow = true; }, //判断是否要绑定区号 countryCcode() { User.countryCcode().then((res) => { if (res.Ret == 200) { this.isNeedAddCountryCode = res.Data.IsNeedAddCountryCode; } }); }, //报名 signupAdd(id, type) { let timer = null; if (this.flag) return; clearTimeout(timer); this.flag = true; this.selectShow = false; if (id == "id") { id = this.activityIdAdd; } if (this.isNeedAddCountryCode) { this.isAreaCode = true; this.areaCode = { id, type, }; } else { activity .signupAdd({ ActivityId: id, SignupType: type, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; if (this.hasPermission == 1) { const index = this.collectList.findIndex((item) => item.ActivityId == id); this.collectList[index].SignupType = type; this.signupType = res.Data.SignupType; this.signupStatus = res.Data.SignupStatus; 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; } } } else if (this.hasPermission == 2) { this.jurisdictionList.SellerMobile = res.Data.SellerMobile; this.jurisdictionList.PopupMsg = res.Data.PopupMsg; this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4) { this.jurisdictionList.PopupMsg = res.Data.PopupMsg; this.applyForIsShow = true; } } }); } timer = setTimeout(() => { this.flag = false; }, 500); }, //取消报名 signupCancel(id, type, time) { const str = time.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; } this.isCancelShow = true; this.idTypeCancel = { id, type, cutId: "", state: 0, isNum: true, }; }, // 弹框的初始化 init() { this.signupType = ""; this.goFollow = false; this.signupStatus = ""; this.isShow = false; this.isCancelShow = false; }, //添加会议提醒接口 meetingReminderAdd(id) { activity .meetingReminderAdd({ ActivityId: id, }) .then((res) => { if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; 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.signupStatus = res.Data.SignupStatus; 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.jurisdictionList.SellerMobile = res.Data.SellerMobile; this.jurisdictionList.PopupMsg = res.Data.PopupMsg; this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4) { this.jurisdictionList.PopupMsg = res.Data.PopupMsg; 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; } }); } }, }); } }); }, //取消弹框的确认事件 cancelEnsure(obj, type, unm) { this.init(); if (obj.name == "conference") return; if (this.isrefresh) return this.getActivityList(); if (obj.cutId == 0) return; if (this.tabsActive !== 0) return this.getActivityList(); if (type == 1) { this.collectList.forEach((item) => { if (obj.cutId == item.ActivityId) { item.IsSignup = obj.state; if (unm) { item.SignupNum = item.SignupNum - 1; } else { item.SignupNum = item.SignupNum + 1; } } }); } else { this.collectList.forEach((item) => { if (obj.cutId == item.ActivityId) { item.IsSignup = obj.state; if (unm) { item.SignupNum = item.SignupNum - 1; } else { item.SignupNum = item.SignupNum + 1; } } }); } }, //帮我代问 async askingGo(item) { const str = item.ActivityTime.replace(/-/g, "/"); const date = new Date(str); const times = date.getTime(); const num = new Date().getTime(); if (item.ChartPermissionName !== "研选") { if (times - num <= 900000) { uni.showModal({ confirmText: "知道了", showCancel: false, confirmColor: "#3385FF", content: "活动开始前15分钟内无法提交问题", }); return; } } else { if (times - num <= 3600000) { uni.showModal({ confirmText: "知道了", showCancel: false, confirmColor: "#3385FF", content: "活动开始前1小时内无法提交问题", }); return; } } const res = await activity.checkAskActivity({ActivityId:item.ActivityId }) if (res.Ret == 200) { this.hasPermission = res.Data.HasPermission; if (this.hasPermission == 1) { uni.navigateTo({ url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId, }); } else if (this.hasPermission == 2) { this.jurisdictionList.SellerMobile = res.Data.SellerMobile; this.jurisdictionList.PopupMsg = res.Data.PopupMsg; this.isShowhasPermission = true; } else if (this.hasPermission == 3 || this.hasPermission == 4) { this.jurisdictionList.PopupMsg = res.Data.PopupMsg; this.applyForIsShow = true; } } }, // 弹框的初始化 init() { this.signupType = ""; this.goFollow = false; this.signupStatus = ""; this.isShow = false; this.isCancelShow = false; }, //去往详情页面 goDetail(item) { this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId); }, }, };