indexActivity.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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.SiginupDeadline)) {
  74. uni.showModal({
  75. confirmText: "知道了",
  76. showCancel: false,
  77. confirmColor: "#3385FF",
  78. content: "报名名单已提交举办方,若想取消,请联系对口销售",
  79. });
  80. return;
  81. }
  82. }
  83. if (isWithinOneHour(item.ActivityTime, 3600000)) {
  84. uni.showModal({
  85. confirmText: "知道了",
  86. showCancel: false,
  87. confirmColor: "#3385FF",
  88. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  89. });
  90. return;
  91. }
  92. uni.showModal({
  93. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  94. confirmColor: "#3385FF",
  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. 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: "#3385FF",
  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. uni.navigateTo({
  223. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  224. });
  225. } else if (this.hasPermission == 2) {
  226. this.isShowhasPermission = true;
  227. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  228. this.applyForIsShow = true;
  229. }
  230. }
  231. },
  232. // 弹框的初始化
  233. init() {
  234. this.signupType = "";
  235. this.goFollow = false;
  236. this.isShow = false;
  237. this.isCancelShow = false;
  238. },
  239. //预约纪要、取消预约纪要
  240. async summaryIsHandel(item, type = "") {
  241. if (item.IsAppointment == 0) {
  242. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  243. if (res.Ret == 200) {
  244. this.hasPermission = res.Data.HasPermission;
  245. this.jurisdictionList = res.Data;
  246. if (this.hasPermission == 1) {
  247. this.signupType = "summaryIsHandel";
  248. this.goOnNextStep = res.Data.GoFollow;
  249. if (res.Data.SignupStatus !== "Success") {
  250. this.isShow = true;
  251. } else {
  252. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  253. else if (res.Data.SignupStatus == "Success") {
  254. this.isShow = true;
  255. item.IsAppointment = 1;
  256. }
  257. item.IsAppointment = 1;
  258. }
  259. } else if (this.hasPermission == 2) {
  260. this.isShowhasPermission = true;
  261. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  262. this.applyForIsShow = true;
  263. }
  264. }
  265. } else {
  266. uni.showModal({
  267. content: "确定要取消预约本场调研的纪要吗?",
  268. confirmColor: "#3385FF",
  269. cancelColor: "#606266",
  270. success: async (res) => {
  271. if (res.confirm) {
  272. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  273. if (res.Ret === 200) {
  274. item.IsAppointment = 0;
  275. this.init();
  276. if (type === "我的") {
  277. this.getActivityList();
  278. }
  279. }
  280. }
  281. },
  282. });
  283. }
  284. },
  285. //去往详情页面
  286. goDetail(item) {
  287. if (item.SourceType && item.SourceType == 2) {
  288. uni.navigateTo({ url: "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId });
  289. } else {
  290. uni.navigateTo({ url: "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId });
  291. }
  292. },
  293. // 我要报名的请求拆分出来了
  294. async myIsApplyHandler(id, type, valName = "") {
  295. const res = await activity.signupAdd({
  296. ActivityId: id,
  297. SignupType: type,
  298. PageRouter: this.$store.state.pageRouterActivity,
  299. });
  300. if (res.Ret == 200) {
  301. this.hasPermission = res.Data.HasPermission;
  302. this.jurisdictionList = res.Data;
  303. if (this.hasPermission == 1) {
  304. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  305. this.countryCode = res.Data.CountryCode;
  306. this.mobileEdit = res.Data.Mobile;
  307. this.goOnNextStep = res.Data.GoFollow;
  308. this.idTypeCancel = {
  309. cutId: res.Data.ActivityId,
  310. state: 1,
  311. };
  312. if (res.Data.GoBindEmail) {
  313. this.mailboxBinding = true;
  314. return;
  315. }
  316. if (res.Data.SignupStatus !== "Success") {
  317. this.isShow = true;
  318. } else {
  319. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  320. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  321. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  322. this.collectList.forEach((valueAct) => {
  323. if (valueAct.ActivityId === id) {
  324. valueAct.IsSignup = 1;
  325. valueAct.SignupType = type;
  326. }
  327. });
  328. }
  329. } else if (this.hasPermission == 2) {
  330. this.isShowhasPermission = true;
  331. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  332. this.applyForIsShow = true;
  333. }
  334. }
  335. },
  336. // 研选扣点的事件
  337. async researchPointsHandler(id, type, item) {
  338. const res = await activity.activityCheck({
  339. ActivityId: id,
  340. });
  341. if (res.Ret === 200) {
  342. let { Data } = res;
  343. this.checkResearchList = Data;
  344. this.checkResearchList.childrenType = type;
  345. this.jurisdictionList = item;
  346. this.isResearchModalShow = true;
  347. }
  348. },
  349. },
  350. };