indexActivity.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. };
  41. },
  42. methods: {
  43. // 我要报名
  44. wanttosignup(item) {
  45. this.activityIdAdd = item.ActivityId;
  46. if (item.YidongActivityId) {
  47. this.goDetail(item);
  48. return;
  49. } else if (item.IsLimitPeople == 1 && item.ActivityTypeName == "公司调研电话会") {
  50. this.selectShow = true;
  51. } else {
  52. this.activityIdAdd = "";
  53. this.signupIsAddOfCancel(item, 3);
  54. }
  55. },
  56. //报名/取消报名
  57. signupIsAddOfCancel(item, type, valName = "") {
  58. let id = this.activityIdAdd || item.ActivityId;
  59. let itemData = item;
  60. if (item && item.IsSignup == 1) {
  61. const str = item.ActivityTime.replace(/-/g, "/");
  62. const date = new Date(str);
  63. const times = date.getTime();
  64. const num = new Date().getTime();
  65. if (times - num <= 3600000) {
  66. uni.showModal({
  67. confirmText: "知道了",
  68. showCancel: false,
  69. confirmColor: "#3385FF",
  70. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  71. });
  72. return;
  73. }
  74. uni.showModal({
  75. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  76. confirmColor: "#3385FF",
  77. cancelColor: "#606266",
  78. success: async (res) => {
  79. if (res.confirm) {
  80. const res = await activity.signupCancel({ ActivityId: item.ActivityId, SignupType: type, PageRouter: this.$store.state.pageRouterActivity });
  81. if (res.Ret === 200) {
  82. this.collectList.forEach((valueAct) => {
  83. if (valueAct.ActivityId === id) {
  84. valueAct.IsSignup = 0;
  85. }
  86. });
  87. this.init();
  88. type == 1
  89. ? uni.showToast({
  90. title: "预约外呼已取消",
  91. duration: 2000,
  92. })
  93. : uni.showToast({
  94. title: "已取消报名",
  95. duration: 2000,
  96. });
  97. if (valName === "我的") {
  98. this.getActivityList();
  99. }
  100. }
  101. }
  102. },
  103. });
  104. } else {
  105. let timer = null;
  106. if (this.flag) return;
  107. clearTimeout(timer);
  108. this.flag = true;
  109. this.selectShow = false;
  110. activity
  111. .signupAdd({
  112. ActivityId: id,
  113. SignupType: type,
  114. PageRouter: this.$store.state.pageRouterActivity,
  115. })
  116. .then((res) => {
  117. if (res.Ret == 200) {
  118. this.hasPermission = res.Data.HasPermission;
  119. this.jurisdictionList = res.Data;
  120. if (this.hasPermission == 1) {
  121. const index = this.collectList.findIndex((key) => key.ActivityId == id);
  122. this.collectList[index].SignupType = type;
  123. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  124. this.countryCode = res.Data.CountryCode;
  125. this.mobileEdit = res.Data.Mobile;
  126. this.goOnNextStep = res.Data.GoFollow;
  127. this.idTypeCancel = {
  128. cutId: res.Data.ActivityId,
  129. state: 1,
  130. };
  131. if (res.Data.GoBindEmail) {
  132. this.mailboxBinding = true;
  133. return;
  134. }
  135. if (res.Data.SignupStatus !== "Success") {
  136. this.isShow = true;
  137. } else {
  138. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  139. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  140. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  141. this.collectList.forEach((valueAct) => {
  142. if (valueAct.ActivityId === id) {
  143. valueAct.IsSignup = 1;
  144. }
  145. });
  146. }
  147. } else if (this.hasPermission == 2) {
  148. this.isShowhasPermission = true;
  149. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  150. this.applyForIsShow = true;
  151. }
  152. }
  153. });
  154. timer = setTimeout(() => {
  155. this.flag = false;
  156. }, 500);
  157. }
  158. },
  159. // 弹框的初始化
  160. init() {
  161. this.signupType = "";
  162. this.goFollow = false;
  163. this.isShow = false;
  164. this.isCancelShow = false;
  165. },
  166. //添加消息提醒接口
  167. meetingReminderAdd(id, type) {
  168. if (type != 0) {
  169. this.meetingReminderCancel(id);
  170. return;
  171. }
  172. activity
  173. .meetingReminderAdd({
  174. ActivityId: id,
  175. PageRouter: this.$store.state.pageRouterActivity,
  176. })
  177. .then((res) => {
  178. if (res.Ret == 200) {
  179. this.hasPermission = res.Data.HasPermission;
  180. this.jurisdictionList = res.Data;
  181. if (this.hasPermission == 1) {
  182. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) this.isShow = true;
  183. else this.goFollow = res.Data.GoFollow;
  184. this.signupType = 999;
  185. this.idTypeCancel = {
  186. cutId: res.Data.ActivityId,
  187. state: 1,
  188. name: "conference",
  189. };
  190. this.collectList.forEach((item) => {
  191. if (id == item.ActivityId) {
  192. item.IsCancelMeetingReminder = 1;
  193. }
  194. });
  195. } else if (this.hasPermission == 2) {
  196. this.isShowhasPermission = true;
  197. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  198. this.applyForIsShow = true;
  199. }
  200. }
  201. });
  202. },
  203. //取消消息提醒接口
  204. meetingReminderCancel(id) {
  205. activity
  206. .meetingReminderCancel({
  207. ActivityId: id,
  208. PageRouter: this.$store.state.pageRouterActivity,
  209. })
  210. .then((res) => {
  211. if (res.Ret == 200) {
  212. uni.showModal({
  213. confirmText: "知道了",
  214. confirmColor: "#3385FF",
  215. content: res.Msg,
  216. showCancel: false,
  217. success: (res) => {
  218. if (this.isrefresh) return this.getActivityList();
  219. if (res.confirm) {
  220. this.collectList.forEach((item) => {
  221. if (id == item.ActivityId) {
  222. item.IsCancelMeetingReminder = 0;
  223. }
  224. });
  225. }
  226. },
  227. });
  228. }
  229. });
  230. },
  231. //帮我带问
  232. async askingGo(item, type = "") {
  233. const res = await activity.checkAskActivity({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  234. if (res.Ret == 200) {
  235. this.hasPermission = res.Data.HasPermission;
  236. this.jurisdictionList = res.Data;
  237. if (this.hasPermission == 1) {
  238. uni.navigateTo({
  239. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  240. });
  241. } else if (this.hasPermission == 2) {
  242. this.isShowhasPermission = true;
  243. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  244. this.applyForIsShow = true;
  245. }
  246. }
  247. },
  248. // 弹框的初始化
  249. init() {
  250. this.signupType = "";
  251. this.goFollow = false;
  252. this.isShow = false;
  253. this.isCancelShow = false;
  254. },
  255. //预约纪要、取消预约纪要
  256. async summaryIsHandel(item, type = "") {
  257. if (item.IsAppointment == 0) {
  258. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  259. if (res.Ret == 200) {
  260. this.hasPermission = res.Data.HasPermission;
  261. this.jurisdictionList = res.Data;
  262. if (this.hasPermission == 1) {
  263. this.signupType = "summaryIsHandel";
  264. this.goOnNextStep = res.Data.GoFollow;
  265. if (res.Data.SignupStatus !== "Success") {
  266. this.isShow = true;
  267. } else {
  268. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  269. else if (res.Data.SignupStatus == "Success") {
  270. this.isShow = true;
  271. item.IsAppointment = 1;
  272. }
  273. item.IsAppointment = 1;
  274. }
  275. } else if (this.hasPermission == 2) {
  276. this.isShowhasPermission = true;
  277. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  278. this.applyForIsShow = true;
  279. }
  280. }
  281. } else {
  282. uni.showModal({
  283. content: "确定要取消预约本场调研的纪要吗?",
  284. confirmColor: "#3385FF",
  285. cancelColor: "#606266",
  286. success: async (res) => {
  287. if (res.confirm) {
  288. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId ,PageRouter: this.$store.state.pageRouterActivity});
  289. if (res.Ret === 200) {
  290. item.IsAppointment = 0;
  291. this.init();
  292. if (type === "我的") {
  293. this.getActivityList();
  294. }
  295. }
  296. }
  297. },
  298. });
  299. }
  300. },
  301. //去往详情页面
  302. goDetail(item) {
  303. if (item.SourceType && item.SourceType == 2) {
  304. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  305. } else {
  306. this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId);
  307. }
  308. },
  309. },
  310. };