manageMixin.js 6.7 KB

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