indexActivity.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. ) {
  60. this.selectShow = true;
  61. this.selectYdong = item.IsYidongConduct;
  62. } else {
  63. this.activityIdAdd = "";
  64. this.signupIsAddOfCancel(item, 3);
  65. }
  66. },
  67. //报名/取消报名
  68. signupIsAddOfCancel(item, type, valName = "") {
  69. let id = this.activityIdAdd || item.ActivityId;
  70. this.itemData = item;
  71. if (item && item.IsSignup == 1) {
  72. if (item.IsResearchPoints) {
  73. if (isTimeGreaterThanCurrent(item.CancelDeadline)) {
  74. uni.showModal({
  75. confirmText: "知道了",
  76. showCancel: false,
  77. confirmColor: "#376cbb",
  78. content: "当前时间点已无法取消报名,若想取消,请联系对口销售",
  79. });
  80. return;
  81. }
  82. }
  83. if (isWithinOneHour(item.ActivityTime, 3600000)) {
  84. uni.showModal({
  85. confirmText: "知道了",
  86. showCancel: false,
  87. confirmColor: "#376cbb",
  88. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  89. });
  90. return;
  91. }
  92. uni.showModal({
  93. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  94. confirmColor: "#376cbb",
  95. cancelColor: "#606266",
  96. success: async (res) => {
  97. if (res.confirm) {
  98. const res = await activity.signupCancel({
  99. ActivityId: item.ActivityId,
  100. SignupType: type,
  101. PageRouter: this.$store.state.pageRouterActivity,
  102. });
  103. if (res.Ret === 200) {
  104. this.collectList.forEach((valueAct) => {
  105. if (valueAct.ActivityId === id) {
  106. valueAct.IsSignup = 0;
  107. }
  108. });
  109. this.init();
  110. type == 1
  111. ? uni.showToast({
  112. title: "预约外呼已取消",
  113. duration: 2000,
  114. })
  115. : uni.showToast({
  116. title: "已取消报名",
  117. duration: 2000,
  118. });
  119. if (valName === "我的") {
  120. this.getActivityList();
  121. }
  122. }
  123. }
  124. },
  125. });
  126. } else {
  127. let timer = null;
  128. if (this.flag) return;
  129. clearTimeout(timer);
  130. this.flag = true;
  131. this.selectShow = false;
  132. if (this.itemData.IsResearchPoints) {
  133. this.researchPointsHandler(id, type, item);
  134. } else {
  135. this.myIsApplyHandler(id, type);
  136. }
  137. timer = setTimeout(() => {
  138. this.flag = false;
  139. }, 500);
  140. }
  141. this.activityIdAdd = "";
  142. },
  143. // 弹框的初始化
  144. init() {
  145. this.signupType = "";
  146. this.goFollow = false;
  147. this.isShow = false;
  148. this.isCancelShow = false;
  149. },
  150. //添加消息提醒接口
  151. meetingReminderAdd(id, type) {
  152. if (type != 0) {
  153. this.meetingReminderCancel(id);
  154. return;
  155. }
  156. activity
  157. .meetingReminderAdd({
  158. ActivityId: id,
  159. PageRouter: this.$store.state.pageRouterActivity,
  160. })
  161. .then((res) => {
  162. if (res.Ret == 200) {
  163. this.hasPermission = res.Data.HasPermission;
  164. this.jurisdictionList = res.Data;
  165. if (this.hasPermission == 1) {
  166. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) this.isShow = true;
  167. else this.goFollow = res.Data.GoFollow;
  168. this.signupType = 999;
  169. this.idTypeCancel = {
  170. cutId: res.Data.ActivityId,
  171. state: 1,
  172. name: "conference",
  173. };
  174. this.collectList.forEach((item) => {
  175. if (id == item.ActivityId) {
  176. res.Data.SignupStatus == "Success" && (item.IsCancelMeetingReminder = 1);
  177. }
  178. });
  179. } else if (this.hasPermission == 2) {
  180. this.isShowhasPermission = true;
  181. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  182. this.applyForIsShow = true;
  183. }
  184. }
  185. });
  186. },
  187. //取消消息提醒接口
  188. meetingReminderCancel(id) {
  189. activity
  190. .meetingReminderCancel({
  191. ActivityId: id,
  192. PageRouter: this.$store.state.pageRouterActivity,
  193. })
  194. .then((res) => {
  195. if (res.Ret == 200) {
  196. uni.showModal({
  197. confirmText: "知道了",
  198. confirmColor: "#376cbb",
  199. content: res.Msg,
  200. showCancel: false,
  201. success: (res) => {
  202. if (this.isrefresh) return this.getActivityList();
  203. if (res.confirm) {
  204. this.collectList.forEach((item) => {
  205. if (id == item.ActivityId) {
  206. item.IsCancelMeetingReminder = 0;
  207. }
  208. });
  209. }
  210. },
  211. });
  212. }
  213. });
  214. },
  215. //帮我带问
  216. async askingGo(item, type = "") {
  217. const res = await activity.checkAskActivity({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  218. if (res.Ret == 200) {
  219. this.hasPermission = res.Data.HasPermission;
  220. this.jurisdictionList = res.Data;
  221. if (this.hasPermission == 1) {
  222. if (res.Data.SignupStatus === "Success") {
  223. uni.navigateTo({
  224. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  225. });
  226. } else {
  227. uni.showModal({
  228. confirmText: "知道了",
  229. confirmColor: "#376cbb",
  230. content: res.Msg || res.Data.PopupMsg,
  231. showCancel: false,
  232. success: (res) => {
  233. if (res.confirm) {
  234. this.getActivityDetail();
  235. }
  236. },
  237. });
  238. }
  239. } else if (this.hasPermission == 2) {
  240. this.isShowhasPermission = true;
  241. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  242. this.applyForIsShow = true;
  243. }
  244. }
  245. },
  246. // 弹框的初始化
  247. init() {
  248. this.signupType = "";
  249. this.goFollow = false;
  250. this.isShow = false;
  251. this.isCancelShow = false;
  252. },
  253. //预约纪要、取消预约纪要
  254. async summaryIsHandel(item, type = "") {
  255. if (item.IsAppointment == 0) {
  256. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  257. if (res.Ret == 200) {
  258. this.hasPermission = res.Data.HasPermission;
  259. this.jurisdictionList = res.Data;
  260. if (this.hasPermission == 1) {
  261. this.signupType = "summaryIsHandel";
  262. this.goOnNextStep = res.Data.GoFollow;
  263. if (res.Data.SignupStatus !== "Success") {
  264. this.isShow = true;
  265. } else {
  266. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  267. else if (res.Data.SignupStatus == "Success") {
  268. this.isShow = true;
  269. }
  270. item.IsAppointment = 1;
  271. }
  272. } else if (this.hasPermission == 2) {
  273. this.isShowhasPermission = true;
  274. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  275. this.applyForIsShow = true;
  276. }
  277. }
  278. } else {
  279. uni.showModal({
  280. content: "确定要取消预约本场调研的纪要吗?",
  281. confirmColor: "#376cbb",
  282. cancelColor: "#606266",
  283. success: async (res) => {
  284. if (res.confirm) {
  285. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  286. if (res.Ret === 200) {
  287. item.IsAppointment = 0;
  288. this.init();
  289. if (type === "我的") {
  290. this.getActivityList();
  291. }
  292. }
  293. }
  294. },
  295. });
  296. }
  297. },
  298. //去往详情页面
  299. goDetail(item) {
  300. if (item.SourceType && item.SourceType == 2) {
  301. uni.navigateTo({ url: "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId });
  302. } else {
  303. uni.navigateTo({ url: "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId });
  304. }
  305. },
  306. // 我要报名的请求拆分出来了
  307. async myIsApplyHandler(id, type, valName = "") {
  308. const res = await activity.signupAdd({
  309. ActivityId: id,
  310. SignupType: type,
  311. PageRouter: this.$store.state.pageRouterActivity,
  312. });
  313. if (res.Ret == 200) {
  314. this.hasPermission = res.Data.HasPermission;
  315. this.jurisdictionList = res.Data;
  316. if (this.hasPermission == 1) {
  317. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  318. this.countryCode = res.Data.CountryCode;
  319. this.mobileEdit = res.Data.Mobile;
  320. this.goOnNextStep = res.Data.GoFollow;
  321. this.idTypeCancel = {
  322. cutId: res.Data.ActivityId,
  323. state: 1,
  324. };
  325. if (res.Data.GoBindEmail) {
  326. this.mailboxBinding = true;
  327. return;
  328. }
  329. if (res.Data.SignupStatus !== "Success") {
  330. this.isShow = true;
  331. } else {
  332. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  333. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  334. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  335. this.collectList.forEach((valueAct) => {
  336. if (valueAct.ActivityId === id) {
  337. valueAct.IsSignup = 1;
  338. valueAct.SignupType = type;
  339. }
  340. });
  341. }
  342. } else if (this.hasPermission == 2) {
  343. this.isShowhasPermission = true;
  344. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  345. this.applyForIsShow = true;
  346. }
  347. }
  348. },
  349. // 研选扣点的事件
  350. async researchPointsHandler(id, type, item) {
  351. const res = await activity.activityCheck({
  352. ActivityId: id,
  353. });
  354. if (res.Ret === 200) {
  355. let { Data } = res;
  356. this.checkResearchList = Data;
  357. this.checkResearchList.childrenType = type;
  358. this.jurisdictionList = item;
  359. this.isResearchModalShow = true;
  360. }
  361. },
  362. async signupCheck(item, type, valName = "") {
  363. await this.$store.dispatch("showLoginModal");
  364. this.signupIsAddOfCancel(item, type, valName);
  365. },
  366. async summaryHandelCheck(item) {
  367. await this.$store.dispatch("showLoginModal");
  368. this.summaryIsHandel(item);
  369. },
  370. async meetingReminderCheck(id, type) {
  371. await this.$store.dispatch("showLoginModal");
  372. this.meetingReminderAdd(id, type);
  373. },
  374. async askingCheck(item, type = "") {
  375. await this.$store.dispatch("showLoginModal");
  376. this.askingGo(item, type);
  377. },
  378. async wanttosignupCheck(item) {
  379. await this.$store.dispatch("showLoginModal");
  380. this.wanttosignup(item);
  381. },
  382. async goDetailCheck(item) {
  383. this.goDetail(item);
  384. },
  385. },
  386. };