indexActivity.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. this.collectList.findIndex((key) => {
  168. if (key.ActivityId == id) {
  169. key.IsSignup = 1;
  170. }
  171. });
  172. this.isShow = true;
  173. }
  174. }
  175. } else if (this.hasPermission == 2) {
  176. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  177. this.jurisdictionList.SellerName = res.Data.SellerName;
  178. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  179. this.isShowhasPermission = true;
  180. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  181. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  182. this.applyForIsShow = true;
  183. }
  184. }
  185. });
  186. }
  187. timer = setTimeout(() => {
  188. this.flag = false;
  189. }, 500);
  190. }
  191. },
  192. // 弹框的初始化
  193. init() {
  194. this.signupType = "";
  195. this.goFollow = false;
  196. this.signupStatus = "";
  197. this.isShow = false;
  198. this.isCancelShow = false;
  199. },
  200. //添加消息提醒接口
  201. meetingReminderAdd(id, type) {
  202. if (type != 0) {
  203. this.meetingReminderCancel(id);
  204. return;
  205. }
  206. activity
  207. .meetingReminderAdd({
  208. ActivityId: id,
  209. })
  210. .then((res) => {
  211. if (res.Ret == 200) {
  212. this.hasPermission = res.Data.HasPermission;
  213. this.jurisdictionList.ActivityId = res.Data.ActivityId;
  214. if (this.hasPermission == 1) {
  215. if ((res.Data.GoFollow && res.Data.SignupStatus !== "Success") || !res.Data.GoFollow) {
  216. this.isShow = true;
  217. } else {
  218. this.goFollow = res.Data.GoFollow;
  219. }
  220. this.signupType = 999;
  221. this.signupStatus = res.Data.SignupStatus;
  222. this.idTypeCancel = {
  223. cutId: res.Data.ActivityId,
  224. state: 1,
  225. name: "conference",
  226. };
  227. this.collectList.forEach((item) => {
  228. if (id == item.ActivityId) {
  229. item.IsCancelMeetingReminder = 1;
  230. }
  231. });
  232. } else if (this.hasPermission == 2) {
  233. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  234. this.jurisdictionList.SellerName = res.Data.SellerName;
  235. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  236. this.isShowhasPermission = true;
  237. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  238. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  239. this.applyForIsShow = true;
  240. }
  241. }
  242. });
  243. },
  244. //取消消息提醒接口
  245. meetingReminderCancel(id) {
  246. activity
  247. .meetingReminderCancel({
  248. ActivityId: id,
  249. })
  250. .then((res) => {
  251. if (res.Ret == 200) {
  252. uni.showModal({
  253. confirmText: "知道了",
  254. confirmColor: "#3385FF",
  255. content: res.Msg,
  256. showCancel: false,
  257. success: (res) => {
  258. if (this.isrefresh) return this.getActivityList();
  259. if (res.confirm) {
  260. this.collectList.forEach((item) => {
  261. if (id == item.ActivityId) {
  262. item.IsCancelMeetingReminder = 0;
  263. }
  264. });
  265. }
  266. },
  267. });
  268. }
  269. });
  270. },
  271. //帮我带问
  272. async askingGo(item, type = "") {
  273. const res = await activity.checkAskActivity({ ActivityId: item.ActivityId });
  274. if (res.Ret == 200) {
  275. this.hasPermission = res.Data.HasPermission;
  276. this.jurisdictionList.ActivityId = res.Data.ActivityId;
  277. if (this.hasPermission == 1) {
  278. uni.navigateTo({
  279. url: "/pages-activity/generationAsk/generationAsk?id=" + item.ActivityId + "&type=" + type,
  280. });
  281. } else if (this.hasPermission == 2) {
  282. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  283. this.jurisdictionList.SellerName = res.Data.SellerName;
  284. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  285. this.isShowhasPermission = true;
  286. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  287. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  288. this.applyForIsShow = true;
  289. }
  290. }
  291. },
  292. // 弹框的初始化
  293. init() {
  294. this.signupType = "";
  295. this.goFollow = false;
  296. this.signupStatus = "";
  297. this.isShow = false;
  298. this.isCancelShow = false;
  299. },
  300. //预约纪要、取消预约纪要
  301. async summaryIsHandel(item, type = "") {
  302. if (item.IsAppointment == 0) {
  303. const res = await activity.postAppointmentAdd({ ActivityId: item.ActivityId });
  304. if (res.Ret == 200) {
  305. this.hasPermission = res.Data.HasPermission;
  306. this.jurisdictionList.ActivityId = res.Data.ActivityId;
  307. if (this.hasPermission == 1) {
  308. item.IsAppointment = 1;
  309. this.signupType = "summaryIsHandel";
  310. this.signupStatus = res.Data.SignupStatus;
  311. this.goOnNextStep = res.Data.GoFollow;
  312. if (res.Data.SignupStatus !== "Success") {
  313. this.isShow = true;
  314. } else {
  315. if (res.Data.GoFollow) {
  316. this.goFollow = res.Data.GoFollow;
  317. } else if (res.Data.SignupStatus == "Success") {
  318. this.isShow = true;
  319. }
  320. }
  321. } else if (this.hasPermission == 2) {
  322. this.jurisdictionList.SellerMobile = res.Data.SellerMobile;
  323. this.jurisdictionList.SellerName = res.Data.SellerName;
  324. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  325. this.isShowhasPermission = true;
  326. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  327. this.jurisdictionList.PopupMsg = res.Data.PopupMsg;
  328. this.applyForIsShow = true;
  329. }
  330. }
  331. } else {
  332. uni.showModal({
  333. content: "确定要取消预约本场调研的纪要吗?",
  334. confirmColor: "#3385FF",
  335. cancelColor: "#606266",
  336. success: async (res) => {
  337. if (res.confirm) {
  338. const res = await activity.postAppointmentCancel({ ActivityId: item.ActivityId });
  339. if (res.Ret === 200) {
  340. item.IsAppointment = 0;
  341. this.init();
  342. if (type === "我的") {
  343. this.getActivityList();
  344. }
  345. }
  346. }
  347. },
  348. });
  349. }
  350. },
  351. cancelEnsure() {},
  352. //去往详情页面
  353. goDetail(item) {
  354. this.$store.dispatch("checkHandle", "/pages-activity/activityDetail/activityDetail?id=" + item.ActivityId);
  355. },
  356. },
  357. };