manageMixin.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 });
  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. })
  54. .then((res) => {
  55. if (res.Ret == 200) {
  56. this.hasPermission = res.Data.HasPermission;
  57. this.jurisdictionList = res.Data;
  58. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  59. this.countryCode = res.Data.CountryCode;
  60. this.mobileEdit = res.Data.Mobile;
  61. this.goOnNextStep = res.Data.GoFollow;
  62. this.idTypeCancel = {
  63. cutId: res.Data.ActivityId,
  64. state: 1,
  65. };
  66. if (res.Data.GoBindEmail) {
  67. this.mailboxBinding = true;
  68. return;
  69. }
  70. if (res.Data.SignupStatus !== "Success") {
  71. this.isShow = true;
  72. } else {
  73. if (res.Data.GoOutboundMobile) {
  74. this.editIsShow = true;
  75. } else if (res.Data.GoFollow) {
  76. this.goFollow = res.Data.GoFollow;
  77. } else if (res.Data.SignupStatus == "Success") {
  78. this.isShow = true;
  79. }
  80. }
  81. }
  82. });
  83. timer = setTimeout(() => {
  84. this.flag = false;
  85. }, 500);
  86. }
  87. },
  88. // 预约/取消
  89. async summaryIsHandel() {
  90. if (this.detailData.IsAppointment == 0) {
  91. const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id) });
  92. if (res.Ret == 200) {
  93. this.hasPermission = res.Data.HasPermission;
  94. this.jurisdictionList = res.Data;
  95. this.signupType = "summaryIsHandel";
  96. this.goOnNextStep = res.Data.GoFollow;
  97. if (res.Data.SignupStatus !== "Success") {
  98. this.isShow = true;
  99. } else {
  100. if (res.Data.GoFollow) {
  101. this.goFollow = res.Data.GoFollow;
  102. } else if (res.Data.SignupStatus == "Success") {
  103. this.isShow = true;
  104. }
  105. }
  106. this.selectShow = false;
  107. }
  108. } else {
  109. uni.showModal({
  110. content: "确定要取消预约本场调研的纪要吗?",
  111. confirmColor: "#3385FF",
  112. cancelColor: "#606266",
  113. success: async (res) => {
  114. if (res.confirm) {
  115. const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id) });
  116. if (res.Ret === 200) {
  117. this.getActivityDetail();
  118. }
  119. }
  120. },
  121. });
  122. }
  123. },
  124. // 取消会议提醒接口
  125. meetingReminderCancel() {
  126. if (this.detailData.IsCancelMeetingReminder == 1) {
  127. activity
  128. .meetingReminderCancel({
  129. ActivityId: Number(this.id),
  130. })
  131. .then((res) => {
  132. if (res.Ret == 200) {
  133. uni.showModal({
  134. confirmText: "知道了",
  135. confirmColor: "#3385FF",
  136. content: res.Msg,
  137. showCancel: false,
  138. success: (res) => {
  139. if (res.confirm) {
  140. this.getActivityDetail();
  141. }
  142. },
  143. });
  144. }
  145. });
  146. } else {
  147. this.meetingReminderAdd();
  148. }
  149. },
  150. // 添加会议提醒
  151. meetingReminderAdd() {
  152. activity
  153. .meetingReminderAdd({
  154. ActivityId: Number(this.id),
  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 (this.detailData.IsLimitPeople == 1 && this.detailData.ActivityTypeName == "公司调研电话会") {
  175. this.selectShow = true;
  176. } else {
  177. this.signupIsAddOfCancel(3);
  178. }
  179. },
  180. // 提问
  181. askingGo(type = "") {
  182. uni.navigateTo({
  183. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
  184. });
  185. },
  186. },
  187. };