indexActivity.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 });
  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. })
  115. .then((res) => {
  116. if (res.Ret == 200) {
  117. this.hasPermission = res.Data.HasPermission;
  118. this.jurisdictionList = res.Data;
  119. if (this.hasPermission == 1) {
  120. const index = this.collectList.findIndex((key) => key.ActivityId == id);
  121. this.collectList[index].SignupType = type;
  122. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  123. this.countryCode = res.Data.CountryCode;
  124. this.mobileEdit = res.Data.Mobile;
  125. this.goOnNextStep = res.Data.GoFollow;
  126. this.idTypeCancel = {
  127. cutId: res.Data.ActivityId,
  128. state: 1,
  129. };
  130. if (res.Data.GoBindEmail) {
  131. this.mailboxBinding = true;
  132. return;
  133. }
  134. if (res.Data.SignupStatus !== "Success") {
  135. this.isShow = true;
  136. } else {
  137. if (res.Data.GoOutboundMobile) {
  138. this.editIsShow = true;
  139. } else if (res.Data.GoFollow) {
  140. this.goFollow = res.Data.GoFollow;
  141. } else if (res.Data.SignupStatus == "Success") {
  142. this.isShow = true;
  143. }
  144. this.collectList.forEach((valueAct) => {
  145. if (valueAct.ActivityId === id) {
  146. valueAct.IsSignup = 1;
  147. }
  148. });
  149. }
  150. } else if (this.hasPermission == 2) {
  151. this.isShowhasPermission = true;
  152. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  153. this.applyForIsShow = true;
  154. }
  155. }
  156. });
  157. timer = setTimeout(() => {
  158. this.flag = false;
  159. }, 500);
  160. }
  161. },
  162. // 弹框的初始化
  163. init() {
  164. this.signupType = "";
  165. this.goFollow = false;
  166. this.isShow = false;
  167. this.isCancelShow = false;
  168. },
  169. //添加消息提醒接口
  170. meetingReminderAdd(id, type) {
  171. if (type != 0) {
  172. this.meetingReminderCancel(id);
  173. return;
  174. }
  175. activity
  176. .meetingReminderAdd({
  177. ActivityId: id,
  178. })
  179. .then((res) => {
  180. if (res.Ret == 200) {
  181. this.hasPermission = res.Data.HasPermission;
  182. this.jurisdictionList = res.Data;
  183. if (this.hasPermission == 1) {
  184. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) {
  185. this.isShow = true;
  186. } else {
  187. this.goFollow = res.Data.GoFollow;
  188. }
  189. this.signupType = 999;
  190. this.idTypeCancel = {
  191. cutId: res.Data.ActivityId,
  192. state: 1,
  193. name: "conference",
  194. };
  195. this.collectList.forEach((item) => {
  196. if (id == item.ActivityId) {
  197. item.IsCancelMeetingReminder = 1;
  198. }
  199. });
  200. } else if (this.hasPermission == 2) {
  201. this.isShowhasPermission = true;
  202. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  203. this.applyForIsShow = true;
  204. }
  205. }
  206. });
  207. },
  208. //取消消息提醒接口
  209. meetingReminderCancel(id) {
  210. activity
  211. .meetingReminderCancel({
  212. ActivityId: id,
  213. })
  214. .then((res) => {
  215. if (res.Ret == 200) {
  216. uni.showModal({
  217. confirmText: "知道了",
  218. confirmColor: "#3385FF",
  219. content: res.Msg,
  220. showCancel: false,
  221. success: (res) => {
  222. if (this.isrefresh) return this.getActivityList();
  223. if (res.confirm) {
  224. this.collectList.forEach((item) => {
  225. if (id == item.ActivityId) {
  226. item.IsCancelMeetingReminder = 0;
  227. }
  228. });
  229. }
  230. },
  231. });
  232. }
  233. });
  234. },
  235. //帮我带问
  236. async askingGo(item, type = "") {
  237. const res = await activity.checkAskActivity({ ActivityId: item.ActivityId });
  238. if (res.Ret == 200) {
  239. this.hasPermission = res.Data.HasPermission;
  240. this.jurisdictionList = res.Data;
  241. if (this.hasPermission == 1) {
  242. uni.navigateTo({
  243. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  244. });
  245. } else if (this.hasPermission == 2) {
  246. this.isShowhasPermission = true;
  247. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  248. this.applyForIsShow = true;
  249. }
  250. }
  251. },
  252. // 弹框的初始化
  253. init() {
  254. this.signupType = "";
  255. this.goFollow = false;
  256. this.isShow = false;
  257. this.isCancelShow = false;
  258. },
  259. //预约纪要、取消预约纪要
  260. async summaryIsHandel(item, type = "") {
  261. if (item.IsAppointment == 0) {
  262. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId });
  263. if (res.Ret == 200) {
  264. this.hasPermission = res.Data.HasPermission;
  265. this.jurisdictionList = res.Data;
  266. if (this.hasPermission == 1) {
  267. this.signupType = "summaryIsHandel";
  268. this.goOnNextStep = res.Data.GoFollow;
  269. if (res.Data.SignupStatus !== "Success") {
  270. this.isShow = true;
  271. } else {
  272. if (res.Data.GoFollow) {
  273. this.goFollow = res.Data.GoFollow;
  274. } else if (res.Data.SignupStatus == "Success") {
  275. this.isShow = true;
  276. }
  277. item.IsAppointment = 1;
  278. }
  279. } else if (this.hasPermission == 2) {
  280. this.isShowhasPermission = true;
  281. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  282. this.applyForIsShow = true;
  283. }
  284. }
  285. } else {
  286. uni.showModal({
  287. content: "确定要取消预约本场调研的纪要吗?",
  288. confirmColor: "#3385FF",
  289. cancelColor: "#606266",
  290. success: async (res) => {
  291. if (res.confirm) {
  292. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId });
  293. if (res.Ret === 200) {
  294. item.IsAppointment = 0;
  295. this.init();
  296. if (type === "我的") {
  297. this.getActivityList();
  298. }
  299. }
  300. }
  301. },
  302. });
  303. }
  304. },
  305. //去往详情页面
  306. goDetail(item) {
  307. if (item.SourceType && item.SourceType == 2) {
  308. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  309. } else {
  310. this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId);
  311. }
  312. },
  313. },
  314. };