indexActivity.js 13 KB

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