indexActivity.js 12 KB

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