manageMixin.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import { activity, User } from "@/config/api.js";
  2. import { isTimeGreaterThanCurrent, isWithinOneHour } from "@/config/util.js";
  3. export default {
  4. methods: {
  5. //报名/取消报名
  6. signupIsAddOfCancel(type, valName = "") {
  7. type = type ? type : valName;
  8. if (this.detailData.IsSignup == 1) {
  9. if (this.detailData.IsResearchPoints) {
  10. if (isTimeGreaterThanCurrent(this.detailData.CancelDeadline)) {
  11. uni.showModal({
  12. confirmText: "知道了",
  13. showCancel: false,
  14. confirmColor: "#376cbb",
  15. content: "当前时间点已无法取消报名,若想取消,请联系对口销售",
  16. });
  17. return;
  18. }
  19. }
  20. if (isWithinOneHour(this.detailData.ActivityTime, 3600000)) {
  21. uni.showModal({
  22. confirmText: "知道了",
  23. showCancel: false,
  24. confirmColor: "#376cbb",
  25. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  26. });
  27. return;
  28. }
  29. uni.showModal({
  30. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  31. confirmColor: "#376cbb",
  32. cancelColor: "#606266",
  33. success: async (res) => {
  34. if (res.confirm) {
  35. const res = await activity.signupCancel({ ActivityId: this.detailData.ActivityId, SignupType: type, PageRouter: this.$store.state.pageRouterActivity });
  36. if (res.Ret === 200) {
  37. type == 1
  38. ? uni.showToast({
  39. title: "预约外呼已取消",
  40. duration: 2000,
  41. })
  42. : uni.showToast({
  43. title: "已取消报名",
  44. duration: 2000,
  45. });
  46. this.getActivityDetail();
  47. }
  48. }
  49. },
  50. });
  51. } else {
  52. let timer = null;
  53. if (this.flag) return;
  54. clearTimeout(timer);
  55. this.flag = true;
  56. this.selectShow = false;
  57. if (this.detailData.IsResearchPoints) {
  58. this.researchPointsHandler(this.detailData.ActivityId, type, this.detailData);
  59. } else {
  60. this.myIsApplyHandler(this.detailData.ActivityId, type, valName);
  61. }
  62. timer = setTimeout(() => {
  63. this.flag = false;
  64. }, 500);
  65. }
  66. },
  67. // 预约/取消
  68. async summaryIsHandel() {
  69. if (this.detailData.IsAppointment == 0) {
  70. const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  71. if (res.Ret == 200) {
  72. this.hasPermission = res.Data.HasPermission;
  73. this.jurisdictionList = res.Data;
  74. this.signupType = "summaryIsHandel";
  75. this.goOnNextStep = res.Data.GoFollow;
  76. if (res.Data.SignupStatus !== "Success") {
  77. this.isShow = true;
  78. } else {
  79. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  80. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  81. }
  82. this.selectShow = false;
  83. res.Data.SignupStatus == "Success" && (this.detailData.IsAppointment = 1);
  84. this.synchronization();
  85. }
  86. } else {
  87. uni.showModal({
  88. content: "确定要取消预约本场调研的纪要吗?",
  89. confirmColor: "#376cbb",
  90. cancelColor: "#606266",
  91. success: async (res) => {
  92. if (res.confirm) {
  93. const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  94. if (res.Ret === 200) {
  95. this.getActivityDetail();
  96. }
  97. }
  98. },
  99. });
  100. }
  101. },
  102. // 取消会议提醒接口
  103. meetingReminderCancel() {
  104. if (this.detailData.IsCancelMeetingReminder == 1) {
  105. activity
  106. .meetingReminderCancel({
  107. ActivityId: Number(this.id),
  108. PageRouter: this.$store.state.pageRouterActivity,
  109. })
  110. .then((res) => {
  111. if (res.Ret == 200) {
  112. uni.showModal({
  113. confirmText: "知道了",
  114. confirmColor: "#376cbb",
  115. content: res.Msg || res.Data.PopupMsg,
  116. showCancel: false,
  117. success: (res) => {
  118. if (res.confirm) {
  119. this.getActivityDetail();
  120. }
  121. },
  122. });
  123. }
  124. });
  125. } else {
  126. this.meetingReminderAdd();
  127. }
  128. },
  129. // 添加会议提醒
  130. meetingReminderAdd() {
  131. activity
  132. .meetingReminderAdd({
  133. ActivityId: Number(this.id),
  134. PageRouter: this.$store.state.pageRouterActivity,
  135. })
  136. .then((res) => {
  137. if (res.Ret == 200) {
  138. this.hasPermission = res.Data.HasPermission;
  139. this.jurisdictionList = res.Data;
  140. this.jurisdictionList.isActivityDetail = true;
  141. if (res.Data.SignupStatus !== "Success") {
  142. this.isShow = true;
  143. } else {
  144. if (res.Data.SignupStatus == "Success") this.isShow = true;
  145. }
  146. // uni.showModal({
  147. // confirmText: "知道了",
  148. // confirmColor: "#376cbb",
  149. // content: res.Msg || res.Data.PopupMsg,
  150. // showCancel: false,
  151. // success: (res) => {
  152. // if (res.confirm) {
  153. // this.getActivityDetail();
  154. // }
  155. // },
  156. // });
  157. }
  158. });
  159. },
  160. // 我要报名
  161. wanttosignup() {
  162. if (
  163. ( (!this.detailData.IsResearchPoints && this.detailData.ActivityTypeId == 3 && !this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1) ||
  164. (this.detailData.IsYidongConduct && this.detailData.IsCanOutboundCall) ||
  165. (!this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1 && [1, 2].includes(this.detailData.ActivityTypeId))) && this.detailData.IsZoom !=1
  166. ) {
  167. this.selectShow = true;
  168. this.selectYdong = this.detailData.IsYidongConduct;
  169. } else {
  170. this.signupIsAddOfCancel(3);
  171. }
  172. },
  173. // 提问
  174. askingGo(type = "") {
  175. uni.navigateTo({
  176. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
  177. });
  178. },
  179. // 研选扣点的事件
  180. async researchPointsHandler(id, type, item) {
  181. const res = await activity.activityCheck({
  182. ActivityId: id,
  183. });
  184. if (res.Ret === 200) {
  185. let { Data } = res;
  186. this.checkResearchList = Data;
  187. this.checkResearchList.childrenType = type;
  188. this.jurisdictionList = item;
  189. this.isResearchModalShow = true;
  190. }
  191. },
  192. // 报名拆分出来
  193. myIsApplyHandler(id, type, valName = "") {
  194. activity
  195. .signupAdd({
  196. ActivityId: this.detailData.ActivityId,
  197. SignupType: type,
  198. PageRouter: this.$store.state.pageRouterActivity,
  199. })
  200. .then((res) => {
  201. if (res.Ret == 200) {
  202. this.hasPermission = res.Data.HasPermission;
  203. this.jurisdictionList = res.Data;
  204. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  205. this.countryCode = res.Data.CountryCode;
  206. this.mobileEdit = res.Data.Mobile;
  207. this.goOnNextStep = res.Data.GoFollow;
  208. this.idTypeCancel = {
  209. cutId: res.Data.ActivityId,
  210. state: 1,
  211. };
  212. if (res.Data.SignupStatus !== "Success") {
  213. this.isShow = true;
  214. } else {
  215. this.detailData.IsSignup = 1;
  216. this.detailData.SignupNum += 1;
  217. this.detailData.SignupType = type;
  218. this.synchronization();
  219. if (res.Data.GoBindEmail) this.mailboxBinding = true;
  220. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  221. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  222. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  223. }
  224. }
  225. });
  226. },
  227. /* 无权限申请开通权限 */
  228. applyAuth() {
  229. /* 区分是否是潜在用户 */
  230. this.jurisdictionList.HasPermission === 3
  231. ? uni.navigateTo({
  232. url: "/pageMy/applyTrial/applyTrial?tryType=Activity&detailId=" + (this.idAct || Number(this.id)),
  233. })
  234. : this.jurisdictionList.HasPermission === 5
  235. ? this.sellerApplyAuth()
  236. : uni.showModal({
  237. title: "",
  238. content: "您已经提交过申请了,请耐心等待",
  239. showCancel: false,
  240. confirmColor: "#376cbb",
  241. success: function (res) {},
  242. });
  243. },
  244. //销售的立即申请
  245. sellerApplyAuth() {
  246. User.applyTry({
  247. TryType: "Activity",
  248. DetailId: this.idAct || Number(this.id),
  249. }).then((res) => {
  250. if (res.Ret === 200) {
  251. uni.showModal({
  252. title: "",
  253. content: "提交申请成功,请耐心等待",
  254. showCancel: false,
  255. confirmColor: "#376cbb",
  256. success: function (res) {
  257. this.backIndex();
  258. },
  259. });
  260. }
  261. });
  262. },
  263. // 返回首頁
  264. backIndex() {
  265. uni.navigateBack({
  266. fail() {
  267. uni.switchTab({
  268. url: "/pages/index/index",
  269. });
  270. },
  271. });
  272. },
  273. },
  274. };