123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- import { activity, User } from "@/config/api.js";
- import { isTimeGreaterThanCurrent, isWithinOneHour } from "@/config/util.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, //是否绑定邮箱
- selectShow: false, // 是否显示选择弹框
- selectYdong: false,
- isResearchModalShow: false,
- checkResearchList: {},
- itemData: null,
- };
- },
- methods: {
- // 我要报名
- wanttosignup(item) {
- this.activityIdAdd = item.ActivityId;
- if (item.YidongActivityId) {
- this.goDetail(item);
- return;
- } else if (
- ((!item.IsResearchPoints && item.ActivityTypeId == 3 && !item.IsYidongConduct && item.IsLimitPeople == 1) ||
- (item.IsYidongConduct && item.IsCanOutboundCall) ||
- (!item.IsYidongConduct && item.IsLimitPeople == 1 && [1, 2].includes(item.ActivityTypeId))) &&
- item.IsZoom != 1
- ) {
- this.selectShow = true;
- this.selectYdong = item.IsYidongConduct;
- } else {
- this.activityIdAdd = "";
- this.signupIsAddOfCancel(item, 3);
- }
- },
- //报名/取消报名
- signupIsAddOfCancel(item, type, valName = "") {
- let id = this.activityIdAdd || item.ActivityId;
- this.itemData = item;
- if (item && item.IsSignup == 1) {
- if (item.IsResearchPoints) {
- if (isTimeGreaterThanCurrent(item.CancelDeadline)) {
- uni.showModal({
- confirmText: "知道了",
- showCancel: false,
- confirmColor: "#376cbb",
- content: "当前时间点已无法取消报名,若想取消,请联系对口销售",
- });
- return;
- }
- }
- if (isWithinOneHour(item.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: item.ActivityId,
- SignupType: type,
- PageRouter: this.$store.state.pageRouterActivity,
- });
- 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;
- if (this.itemData.IsResearchPoints) {
- this.researchPointsHandler(id, type, item);
- } else {
- this.myIsApplyHandler(id, type);
- }
- timer = setTimeout(() => {
- this.flag = false;
- }, 500);
- }
- this.activityIdAdd = "";
- },
- // 弹框的初始化
- 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,
- PageRouter: this.$store.state.pageRouterActivity,
- })
- .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) {
- res.Data.SignupStatus == "Success" && (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,
- PageRouter: this.$store.state.pageRouterActivity,
- })
- .then((res) => {
- if (res.Ret == 200) {
- uni.showModal({
- confirmText: "知道了",
- confirmColor: "#376cbb",
- 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, PageRouter: this.$store.state.pageRouterActivity });
- if (res.Ret == 200) {
- this.hasPermission = res.Data.HasPermission;
- this.jurisdictionList = res.Data;
- if (this.hasPermission == 1) {
- if (res.Data.SignupStatus === "Success") {
- uni.navigateTo({
- url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
- });
- } else {
- uni.showModal({
- confirmText: "知道了",
- confirmColor: "#376cbb",
- content: res.Msg || res.Data.PopupMsg,
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- this.getActivityDetail();
- }
- },
- });
- }
- } 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, PageRouter: this.$store.state.pageRouterActivity });
- 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;
- }
- } 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: "#376cbb",
- cancelColor: "#606266",
- success: async (res) => {
- if (res.confirm) {
- const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
- if (res.Ret === 200) {
- item.IsAppointment = 0;
- this.init();
- if (type === "我的") {
- this.getActivityList();
- }
- }
- }
- },
- });
- }
- },
- //去往详情页面
- goDetail(item) {
- if (item.SourceType && item.SourceType == 2) {
- uni.navigateTo({ url: "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId });
- } else {
- uni.navigateTo({ url: "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId });
- }
- },
- // 我要报名的请求拆分出来了
- async myIsApplyHandler(id, type, valName = "") {
- const res = await activity.signupAdd({
- ActivityId: id,
- SignupType: type,
- PageRouter: this.$store.state.pageRouterActivity,
- });
- if (res.Ret == 200) {
- this.hasPermission = res.Data.HasPermission;
- this.jurisdictionList = res.Data;
- if (this.hasPermission == 1) {
- 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;
- valueAct.SignupType = type;
- }
- });
- }
- } else if (this.hasPermission == 2) {
- this.isShowhasPermission = true;
- } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
- this.applyForIsShow = true;
- }
- }
- },
- // 研选扣点的事件
- 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;
- }
- },
- async signupCheck(item, type, valName = "") {
- await this.$store.dispatch("showLoginModal");
- this.signupIsAddOfCancel(item, type, valName);
- },
- async summaryHandelCheck(item) {
- await this.$store.dispatch("showLoginModal");
- this.summaryIsHandel(item);
- },
- async meetingReminderCheck(id, type) {
- await this.$store.dispatch("showLoginModal");
- this.meetingReminderAdd(id, type);
- },
- async askingCheck(item, type = "") {
- await this.$store.dispatch("showLoginModal");
- this.askingGo(item, type);
- },
- async wanttosignupCheck(item) {
- await this.$store.dispatch("showLoginModal");
- this.wanttosignup(item);
- },
- async goDetailCheck(item) {
- this.goDetail(item);
- },
- },
- };
|