indexActivity.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. SellerMobile: "",
  33. PopupMsg: "",
  34. OperationMode: "",
  35. },
  36. editIsShow: false, //外呼莫泰框
  37. isCancelShow: false,
  38. idTypeCancel: {
  39. id: "",
  40. type: 1,
  41. cutId: "",
  42. state: "",
  43. isNum: false,
  44. },
  45. countryCode: "", //外呼区号
  46. mobileEdit: "", //外呼手机号
  47. goOnNextStep: "", //设置外呼号后弹出哪个
  48. isShowhasPermission: false, //拨打销售电话
  49. applyForIsShow: false, //潜在用户
  50. mailboxBinding: false, //是否绑定邮箱
  51. };
  52. },
  53. methods: {
  54. // 我要报名
  55. wanttosignup(id) {
  56. this.activityIdAdd = id;
  57. this.selectShow = true;
  58. },
  59. //判断是否要绑定区号
  60. countryCcode() {
  61. User.countryCcode().then((res) => {
  62. if (res.Ret == 200) {
  63. this.isNeedAddCountryCode = res.Data.IsNeedAddCountryCode;
  64. }
  65. });
  66. },
  67. //报名
  68. signupAdd(id, type) {
  69. let timer = null;
  70. if (this.flag) return;
  71. clearTimeout(timer);
  72. this.flag = true;
  73. this.selectShow = false;
  74. if (id == "id") {
  75. id = this.activityIdAdd;
  76. }
  77. if (this.isNeedAddCountryCode) {
  78. this.isAreaCode = true;
  79. this.areaCode = {
  80. id,
  81. type,
  82. };
  83. } else {
  84. activity
  85. .signupAdd({
  86. ActivityId: id,
  87. SignupType: type,
  88. })
  89. .then((res) => {
  90. if (res.Ret == 200) {
  91. this.hasPermission = res.Data.HasPermission;
  92. if (this.hasPermission == 1) {
  93. const index = this.collectList.findIndex((item) => item.ActivityId == id);
  94. this.collectList[index].SignupType = type;
  95. this.signupType = res.Data.SignupType;
  96. this.signupStatus = res.Data.SignupStatus;
  97. this.countryCode = res.Data.CountryCode;
  98. this.mobileEdit = res.Data.Mobile;
  99. this.goOnNextStep = res.Data.GoFollow;
  100. this.idTypeCancel = {
  101. cutId: res.Data.ActivityId,
  102. state: 1,
  103. };
  104. if (res.Data.GoBindEmail) {
  105. this.mailboxBinding = true;
  106. return;
  107. }
  108. if (res.Data.SignupStatus !== "Success") {
  109. this.isShow = true;
  110. } else {
  111. if (res.Data.GoOutboundMobile) {
  112. this.editIsShow = true;
  113. } else if (res.Data.GoFollow) {
  114. this.goFollow = res.Data.GoFollow;
  115. } else if (res.Data.SignupStatus == "Success") {
  116. this.isShow = true;
  117. }
  118. }
  119. } else if (this.hasPermission == 2) {
  120. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  121. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  122. this.isShowhasPermission = true;
  123. } else if (this.hasPermission == 3 || this.hasPermission == 4) {
  124. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  125. this.applyForIsShow = true;
  126. }
  127. }
  128. });
  129. }
  130. timer = setTimeout(() => {
  131. this.flag = false;
  132. }, 500);
  133. },
  134. //取消报名
  135. signupCancel(id, type, time) {
  136. const str = time.replace(/-/g, "/");
  137. const date = new Date(str);
  138. const times = date.getTime();
  139. const num = new Date().getTime();
  140. if (times - num <= 3600000) {
  141. uni.showModal({
  142. confirmText: "知道了",
  143. showCancel: false,
  144. confirmColor: "#3385FF",
  145. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  146. });
  147. return;
  148. }
  149. this.isCancelShow = true;
  150. this.idTypeCancel = {
  151. id,
  152. type,
  153. cutId: "",
  154. state: 0,
  155. isNum: true,
  156. };
  157. },
  158. // 弹框的初始化
  159. init() {
  160. this.signupType = "";
  161. this.goFollow = false;
  162. this.signupStatus = "";
  163. this.isShow = false;
  164. this.isCancelShow = false;
  165. },
  166. //添加会议提醒接口
  167. meetingReminderAdd(id) {
  168. activity
  169. .meetingReminderAdd({
  170. ActivityId: id,
  171. })
  172. .then((res) => {
  173. if (res.Ret == 200) {
  174. this.hasPermission = res.Data.HasPermission;
  175. if (this.hasPermission == 1) {
  176. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) {
  177. this.isShow = true;
  178. } else {
  179. this.goFollow = res.Data.GoFollow;
  180. }
  181. this.signupType = 999;
  182. this.signupStatus = res.Data.SignupStatus;
  183. this.idTypeCancel = {
  184. cutId: res.Data.ActivityId,
  185. state: 1,
  186. name: "conference",
  187. };
  188. this.collectList.forEach((item) => {
  189. if (id == item.ActivityId) {
  190. item.IsCancelMeetingReminder = 1;
  191. }
  192. });
  193. } else if (this.hasPermission == 2) {
  194. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  195. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  196. this.isShowhasPermission = true;
  197. } else if (this.hasPermission == 3 || this.hasPermission == 4) {
  198. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  199. this.applyForIsShow = true;
  200. }
  201. }
  202. });
  203. },
  204. //取消会议提醒接口
  205. meetingReminderCancel(id) {
  206. activity
  207. .meetingReminderCancel({
  208. ActivityId: id,
  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. cancelEnsure(obj, type, unm) {
  233. this.init();
  234. if (obj.name == "conference") return;
  235. if (this.isrefresh) return this.getActivityList();
  236. if (obj.cutId == 0) return;
  237. if (this.tabsActive !== 0) return this.getActivityList();
  238. if (type == 1) {
  239. this.collectList.forEach((item) => {
  240. if (obj.cutId == item.ActivityId) {
  241. item.IsSignup = obj.state;
  242. if (unm) {
  243. item.SignupNum = item.SignupNum - 1;
  244. } else {
  245. item.SignupNum = item.SignupNum + 1;
  246. }
  247. }
  248. });
  249. } else {
  250. this.collectList.forEach((item) => {
  251. if (obj.cutId == item.ActivityId) {
  252. item.IsSignup = obj.state;
  253. if (unm) {
  254. item.SignupNum = item.SignupNum - 1;
  255. } else {
  256. item.SignupNum = item.SignupNum + 1;
  257. }
  258. }
  259. });
  260. }
  261. },
  262. //帮我代问
  263. async askingGo(item) {
  264. const str = item.ActivityTime.replace(/-/g, "/");
  265. const date = new Date(str);
  266. const times = date.getTime();
  267. const num = new Date().getTime();
  268. if (item.ChartPermissionName !== "研选") {
  269. if (times - num <= 900000) {
  270. uni.showModal({
  271. confirmText: "知道了",
  272. showCancel: false,
  273. confirmColor: "#3385FF",
  274. content: "活动开始前15分钟内无法提交问题",
  275. });
  276. return;
  277. }
  278. } else {
  279. if (times - num <= 3600000) {
  280. uni.showModal({
  281. confirmText: "知道了",
  282. showCancel: false,
  283. confirmColor: "#3385FF",
  284. content: "活动开始前1小时内无法提交问题",
  285. });
  286. return;
  287. }
  288. }
  289. const res = await activity.checkAskActivity({ActivityId:item.ActivityId })
  290. if (res.Ret == 200) {
  291. this.hasPermission = res.Data.HasPermission;
  292. if (this.hasPermission == 1) {
  293. uni.navigateTo({
  294. url: "/activityPages/generationAsk/generationAsk?id=" + item.ActivityId,
  295. });
  296. } else if (this.hasPermission == 2) {
  297. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  298. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  299. this.isShowhasPermission = true;
  300. } else if (this.hasPermission == 3 || this.hasPermission == 4) {
  301. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  302. this.applyForIsShow = true;
  303. }
  304. }
  305. },
  306. // 弹框的初始化
  307. init() {
  308. this.signupType = "";
  309. this.goFollow = false;
  310. this.signupStatus = "";
  311. this.isShow = false;
  312. this.isCancelShow = false;
  313. },
  314. //去往详情页面
  315. goDetail(item) {
  316. this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId);
  317. },
  318. },
  319. };