manageMixin.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. import { activity, User } from "@/config/api.js";
  2. import { isTimeGreaterThanCurrent, isWithinOneHour } from "@/config/util.js";
  3. let app = getApp();
  4. export default {
  5. methods: {
  6. //报名/取消报名
  7. signupIsAddOfCancel(type, valName = "") {
  8. type = type ? type : valName;
  9. if (this.detailData.IsSignup == 1) {
  10. if (this.detailData.IsResearchPoints) {
  11. if (isTimeGreaterThanCurrent(this.detailData.SiginupDeadline)) {
  12. uni.showModal({
  13. confirmText: "知道了",
  14. showCancel: false,
  15. confirmColor: "#3385FF",
  16. content: "报名名单已提交举办方,若想取消,请联系对口销售",
  17. });
  18. return;
  19. }
  20. }
  21. if (isWithinOneHour(this.detailData.ActivityTime, 3600000)) {
  22. uni.showModal({
  23. confirmText: "知道了",
  24. showCancel: false,
  25. confirmColor: "#3385FF",
  26. content: type == 1 ? "活动开始前1小时内无法取消预约外呼,请联系对口销售处理" : "活动开始前1小时内无法取消报名,请联系对口销售处理",
  27. });
  28. return;
  29. }
  30. uni.showModal({
  31. content: type == 1 ? "您要取消此次活动预约外呼吗?" : "您要取消此次活动的报名吗?",
  32. confirmColor: "#3385FF",
  33. cancelColor: "#606266",
  34. success: async (res) => {
  35. if (res.confirm) {
  36. const res = await activity.signupCancel({ ActivityId: this.detailData.ActivityId, SignupType: type, PageRouter: this.$store.state.pageRouterActivity });
  37. if (res.Ret === 200) {
  38. type == 1
  39. ? uni.showToast({
  40. title: "预约外呼已取消",
  41. duration: 2000,
  42. })
  43. : uni.showToast({
  44. title: "已取消报名",
  45. duration: 2000,
  46. });
  47. this.getActivityDetail();
  48. }
  49. }
  50. },
  51. });
  52. } else {
  53. let timer = null;
  54. if (this.flag) return;
  55. clearTimeout(timer);
  56. this.flag = true;
  57. this.selectShow = false;
  58. if (this.detailData.IsResearchPoints) {
  59. this.researchPointsHandler(this.detailData.ActivityId, type, this.detailData);
  60. } else {
  61. this.myIsApplyHandler(this.detailData.ActivityId, type, valName);
  62. }
  63. timer = setTimeout(() => {
  64. this.flag = false;
  65. }, 500);
  66. }
  67. },
  68. // 预约/取消
  69. async summaryIsHandel() {
  70. if (this.detailData.IsAppointment == 0) {
  71. const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  72. if (res.Ret == 200) {
  73. this.hasPermission = res.Data.HasPermission;
  74. this.jurisdictionList = res.Data;
  75. this.signupType = "summaryIsHandel";
  76. this.goOnNextStep = res.Data.GoFollow;
  77. if (res.Data.SignupStatus !== "Success") {
  78. this.isShow = true;
  79. } else {
  80. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  81. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  82. }
  83. this.selectShow = false;
  84. this.detailData.IsAppointment = 1;
  85. this.synchronization();
  86. }
  87. } else {
  88. uni.showModal({
  89. content: "确定要取消预约本场调研的纪要吗?",
  90. confirmColor: "#3385FF",
  91. cancelColor: "#606266",
  92. success: async (res) => {
  93. if (res.confirm) {
  94. const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  95. if (res.Ret === 200) {
  96. this.getActivityDetail();
  97. }
  98. }
  99. },
  100. });
  101. }
  102. },
  103. // 取消会议提醒接口
  104. meetingReminderCancel() {
  105. if (this.detailData.IsCancelMeetingReminder == 1) {
  106. activity
  107. .meetingReminderCancel({
  108. ActivityId: Number(this.id),
  109. PageRouter: this.$store.state.pageRouterActivity,
  110. })
  111. .then((res) => {
  112. if (res.Ret == 200) {
  113. uni.showModal({
  114. confirmText: "知道了",
  115. confirmColor: "#3385FF",
  116. content: res.Msg,
  117. showCancel: false,
  118. success: (res) => {
  119. if (res.confirm) {
  120. this.getActivityDetail();
  121. }
  122. },
  123. });
  124. }
  125. });
  126. } else {
  127. this.meetingReminderAdd();
  128. }
  129. },
  130. // 添加会议提醒
  131. meetingReminderAdd() {
  132. activity
  133. .meetingReminderAdd({
  134. ActivityId: Number(this.id),
  135. PageRouter: this.$store.state.pageRouterActivity,
  136. })
  137. .then((res) => {
  138. if (res.Ret == 200) {
  139. uni.showModal({
  140. confirmText: "知道了",
  141. confirmColor: "#3385FF",
  142. content: res.Msg,
  143. showCancel: false,
  144. success: (res) => {
  145. if (res.confirm) {
  146. this.getActivityDetail();
  147. }
  148. },
  149. });
  150. }
  151. });
  152. },
  153. // 我要报名
  154. wanttosignup() {
  155. if (
  156. (!this.detailData.IsResearchPoints && this.detailData.ActivityTypeId == 3 && !this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1) ||
  157. (this.detailData.IsYidongConduct && this.detailData.IsCanOutboundCall) ||
  158. (!this.detailData.IsYidongConduct && this.detailData.IsLimitPeople == 1 && [1, 2].includes(this.detailData.ActivityTypeId))
  159. ) {
  160. this.selectShow = true;
  161. this.selectYdong = this.detailData.IsYidongConduct;
  162. } else {
  163. this.signupIsAddOfCancel(3);
  164. }
  165. },
  166. // 提问
  167. askingGo(type = "") {
  168. uni.navigateTo({
  169. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
  170. });
  171. },
  172. // 研选扣点的事件
  173. async researchPointsHandler(id, type, item) {
  174. const res = await activity.activityCheck({
  175. ActivityId: id,
  176. });
  177. if (res.Ret === 200) {
  178. let { Data } = res;
  179. this.checkResearchList = Data;
  180. this.checkResearchList.childrenType = type;
  181. this.jurisdictionList = item;
  182. this.isResearchModalShow = true;
  183. }
  184. },
  185. // 报名拆分出来
  186. myIsApplyHandler(id, type, valName = "") {
  187. activity
  188. .signupAdd({
  189. ActivityId: this.detailData.ActivityId,
  190. SignupType: type,
  191. PageRouter: this.$store.state.pageRouterActivity,
  192. })
  193. .then((res) => {
  194. if (res.Ret == 200) {
  195. this.hasPermission = res.Data.HasPermission;
  196. this.jurisdictionList = res.Data;
  197. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  198. this.countryCode = res.Data.CountryCode;
  199. this.mobileEdit = res.Data.Mobile;
  200. this.goOnNextStep = res.Data.GoFollow;
  201. this.idTypeCancel = {
  202. cutId: res.Data.ActivityId,
  203. state: 1,
  204. };
  205. if (res.Data.SignupStatus !== "Success") {
  206. this.isShow = true;
  207. } else {
  208. this.detailData.IsSignup = 1;
  209. this.detailData.SignupNum += 1;
  210. this.detailData.SignupType = type;
  211. this.synchronization();
  212. if (res.Data.GoBindEmail) this.mailboxBinding = true;
  213. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  214. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  215. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  216. }
  217. }
  218. });
  219. },
  220. },
  221. };