indexActivity.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. import { activity, User } from "@/config/api.js";
  2. let app = getApp();
  3. export default {
  4. data() {
  5. return {
  6. page_no: 1,
  7. pageSize: 10,
  8. collectList: [],
  9. status: "loadmore",
  10. refresh: false, //正在下拉
  11. loadText: {
  12. loadmore: "上拉加载更多",
  13. loading: "加载中",
  14. nomore: "已经到底了",
  15. },
  16. /**/
  17. tabsActive: 0,
  18. /**/
  19. /* 共用的弹框 */
  20. isShow: false, //弹框
  21. signupType: "", //关注类型
  22. goFollow: false, //是否关注公众号
  23. hasPermission: "", //是否有权限
  24. jurisdictionList: {},
  25. editIsShow: false, //外呼莫泰框
  26. isCancelShow: false,
  27. idTypeCancel: {
  28. id: "",
  29. type: 1,
  30. cutId: "",
  31. state: "",
  32. isNum: false,
  33. },
  34. countryCode: "", //外呼区号
  35. mobileEdit: "", //外呼手机号
  36. goOnNextStep: "", //设置外呼号后弹出哪个
  37. isShowhasPermission: false, //拨打销售电话
  38. applyForIsShow: false, //潜在用户
  39. mailboxBinding: false, //是否绑定邮箱
  40. selectShow: false, // 是否显示选择弹框
  41. selectYdong: false,
  42. isResearchModalShow: false,
  43. checkResearchList: {},
  44. };
  45. },
  46. methods: {
  47. // 我要报名
  48. wanttosignup(item) {
  49. this.activityIdAdd = item.ActivityId;
  50. if (item.YidongActivityId) {
  51. this.goDetail(item);
  52. return;
  53. } else if ((item.IsYidongConduct && item.IsCanOutboundCall) || (!item.IsYidongConduct && item.IsLimitPeople == 1 && [1, 2, 3].includes(item.ActivityTypeId))) {
  54. this.selectShow = true;
  55. this.selectYdong = item.IsYidongConduct;
  56. } else {
  57. this.activityIdAdd = "";
  58. this.signupIsAddOfCancel(item, 3);
  59. }
  60. },
  61. //报名/取消报名
  62. signupIsAddOfCancel(item, type, valName = "") {
  63. let id = this.activityIdAdd || item.ActivityId;
  64. let itemData = item;
  65. if (item && item.IsSignup == 1) {
  66. const str = item.ActivityTime.replace(/-/g, "/");
  67. const date = new Date(str);
  68. const times = date.getTime();
  69. const num = new Date().getTime();
  70. if (times - num <= 3600000) {
  71. uni.showModal({
  72. confirmText: "知道了",
  73. showCancel: false,
  74. confirmColor: "#3385FF",
  75. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  76. });
  77. return;
  78. }
  79. uni.showModal({
  80. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  81. confirmColor: "#3385FF",
  82. cancelColor: "#606266",
  83. success: async (res) => {
  84. if (res.confirm) {
  85. const res = await activity.signupCancel({
  86. ActivityId: item.ActivityId,
  87. SignupType: type,
  88. PageRouter: this.$store.state.pageRouterActivity,
  89. });
  90. if (res.Ret === 200) {
  91. this.collectList.forEach((valueAct) => {
  92. if (valueAct.ActivityId === id) {
  93. valueAct.IsSignup = 0;
  94. }
  95. });
  96. this.init();
  97. type == 1
  98. ? uni.showToast({
  99. title: "预约外呼已取消",
  100. duration: 2000,
  101. })
  102. : uni.showToast({
  103. title: "已取消报名",
  104. duration: 2000,
  105. });
  106. if (valName === "我的") {
  107. this.getActivityList();
  108. }
  109. }
  110. }
  111. },
  112. });
  113. } else {
  114. let timer = null;
  115. if (this.flag) return;
  116. clearTimeout(timer);
  117. this.flag = true;
  118. this.selectShow = false;
  119. if (itemData.IsResearchPoints) {
  120. this.researchPointsHandler(id, type, item);
  121. } else {
  122. this.myIsApplyHandler(id, type);
  123. }
  124. timer = setTimeout(() => {
  125. this.flag = false;
  126. }, 500);
  127. }
  128. this.activityIdAdd = "";
  129. },
  130. // 弹框的初始化
  131. init() {
  132. this.signupType = "";
  133. this.goFollow = false;
  134. this.isShow = false;
  135. this.isCancelShow = false;
  136. },
  137. //添加消息提醒接口
  138. meetingReminderAdd(id, type) {
  139. if (type != 0) {
  140. this.meetingReminderCancel(id);
  141. return;
  142. }
  143. activity
  144. .meetingReminderAdd({
  145. ActivityId: id,
  146. PageRouter: this.$store.state.pageRouterActivity,
  147. })
  148. .then((res) => {
  149. if (res.Ret == 200) {
  150. this.hasPermission = res.Data.HasPermission;
  151. this.jurisdictionList = res.Data;
  152. if (this.hasPermission == 1) {
  153. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) this.isShow = true;
  154. else this.goFollow = res.Data.GoFollow;
  155. this.signupType = 999;
  156. this.idTypeCancel = {
  157. cutId: res.Data.ActivityId,
  158. state: 1,
  159. name: "conference",
  160. };
  161. this.collectList.forEach((item) => {
  162. if (id == item.ActivityId) {
  163. item.IsCancelMeetingReminder = 1;
  164. }
  165. });
  166. } else if (this.hasPermission == 2) {
  167. this.isShowhasPermission = true;
  168. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  169. this.applyForIsShow = true;
  170. }
  171. }
  172. });
  173. },
  174. //取消消息提醒接口
  175. meetingReminderCancel(id) {
  176. activity
  177. .meetingReminderCancel({
  178. ActivityId: id,
  179. PageRouter: this.$store.state.pageRouterActivity,
  180. })
  181. .then((res) => {
  182. if (res.Ret == 200) {
  183. uni.showModal({
  184. confirmText: "知道了",
  185. confirmColor: "#3385FF",
  186. content: res.Msg,
  187. showCancel: false,
  188. success: (res) => {
  189. if (this.isrefresh) return this.getActivityList();
  190. if (res.confirm) {
  191. this.collectList.forEach((item) => {
  192. if (id == item.ActivityId) {
  193. item.IsCancelMeetingReminder = 0;
  194. }
  195. });
  196. }
  197. },
  198. });
  199. }
  200. });
  201. },
  202. //帮我带问
  203. async askingGo(item, type = "") {
  204. const res = await activity.checkAskActivity({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  205. if (res.Ret == 200) {
  206. this.hasPermission = res.Data.HasPermission;
  207. this.jurisdictionList = res.Data;
  208. if (this.hasPermission == 1) {
  209. uni.navigateTo({
  210. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  211. });
  212. } else if (this.hasPermission == 2) {
  213. this.isShowhasPermission = true;
  214. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  215. this.applyForIsShow = true;
  216. }
  217. }
  218. },
  219. // 弹框的初始化
  220. init() {
  221. this.signupType = "";
  222. this.goFollow = false;
  223. this.isShow = false;
  224. this.isCancelShow = false;
  225. },
  226. //预约纪要、取消预约纪要
  227. async summaryIsHandel(item, type = "") {
  228. if (item.IsAppointment == 0) {
  229. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  230. if (res.Ret == 200) {
  231. this.hasPermission = res.Data.HasPermission;
  232. this.jurisdictionList = res.Data;
  233. if (this.hasPermission == 1) {
  234. this.signupType = "summaryIsHandel";
  235. this.goOnNextStep = res.Data.GoFollow;
  236. if (res.Data.SignupStatus !== "Success") {
  237. this.isShow = true;
  238. } else {
  239. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  240. else if (res.Data.SignupStatus == "Success") {
  241. this.isShow = true;
  242. item.IsAppointment = 1;
  243. }
  244. item.IsAppointment = 1;
  245. }
  246. } else if (this.hasPermission == 2) {
  247. this.isShowhasPermission = true;
  248. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  249. this.applyForIsShow = true;
  250. }
  251. }
  252. } else {
  253. uni.showModal({
  254. content: "确定要取消预约本场调研的纪要吗?",
  255. confirmColor: "#3385FF",
  256. cancelColor: "#606266",
  257. success: async (res) => {
  258. if (res.confirm) {
  259. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  260. if (res.Ret === 200) {
  261. item.IsAppointment = 0;
  262. this.init();
  263. if (type === "我的") {
  264. this.getActivityList();
  265. }
  266. }
  267. }
  268. },
  269. });
  270. }
  271. },
  272. //去往详情页面
  273. goDetail(item) {
  274. if (item.SourceType && item.SourceType == 2) {
  275. uni.navigateTo({ url: "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId });
  276. } else {
  277. uni.navigateTo({ url: "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId });
  278. }
  279. },
  280. // 我要报名的请求拆分出来了
  281. async myIsApplyHandler(id, type) {
  282. const res = await activity.signupAdd({
  283. ActivityId: id,
  284. SignupType: type,
  285. PageRouter: this.$store.state.pageRouterActivity,
  286. });
  287. if (res.Ret == 200) {
  288. this.hasPermission = res.Data.HasPermission;
  289. this.jurisdictionList = res.Data;
  290. if (this.hasPermission == 1) {
  291. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  292. this.countryCode = res.Data.CountryCode;
  293. this.mobileEdit = res.Data.Mobile;
  294. this.goOnNextStep = res.Data.GoFollow;
  295. this.idTypeCancel = {
  296. cutId: res.Data.ActivityId,
  297. state: 1,
  298. };
  299. if (res.Data.GoBindEmail) {
  300. this.mailboxBinding = true;
  301. return;
  302. }
  303. if (res.Data.SignupStatus !== "Success") {
  304. this.isShow = true;
  305. } else {
  306. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  307. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  308. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  309. this.parentDataEmit(itemData, "IsSignup", 1);
  310. this.parentDataEmit(itemData, "SignupType", type);
  311. }
  312. } else if (this.hasPermission == 2) {
  313. this.isShowhasPermission = true;
  314. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  315. this.applyForIsShow = true;
  316. }
  317. }
  318. },
  319. // 研选扣点的事件
  320. async researchPointsHandler(id, type, item) {
  321. const res = await activity.activityCheck({
  322. ActivityId: id,
  323. });
  324. if (res.Ret === 200) {
  325. let { Data } = res;
  326. this.checkResearchList = Data;
  327. this.checkResearchList.childrenType = type;
  328. this.jurisdictionList = item;
  329. this.isResearchModalShow = true;
  330. }
  331. },
  332. },
  333. };