indexActivity.js 9.8 KB

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