indexActivity.js 12 KB

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