indexActivity.js 13 KB

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