indexActivity.js 11 KB

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