manageMixin.js 6.4 KB

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