manageMixin.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.SignupStatus !== "Success") {
  67. this.isShow = true;
  68. } else {
  69. this.detailData.IsSignup = 1;
  70. this.detailData.SignupNum += 1;
  71. if (res.Data.GoBindEmail) this.mailboxBinding = true;
  72. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  73. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  74. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  75. }
  76. }
  77. });
  78. timer = setTimeout(() => {
  79. this.flag = false;
  80. }, 500);
  81. }
  82. },
  83. // 预约/取消
  84. async summaryIsHandel() {
  85. if (this.detailData.IsAppointment == 0) {
  86. const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id) });
  87. if (res.Ret == 200) {
  88. this.hasPermission = res.Data.HasPermission;
  89. this.jurisdictionList = res.Data;
  90. this.signupType = "summaryIsHandel";
  91. this.goOnNextStep = res.Data.GoFollow;
  92. if (res.Data.SignupStatus !== "Success") {
  93. this.isShow = true;
  94. } else {
  95. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  96. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  97. }
  98. this.selectShow = false;
  99. }
  100. } else {
  101. uni.showModal({
  102. content: "确定要取消预约本场调研的纪要吗?",
  103. confirmColor: "#3385FF",
  104. cancelColor: "#606266",
  105. success: async (res) => {
  106. if (res.confirm) {
  107. const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id) });
  108. if (res.Ret === 200) {
  109. this.getActivityDetail();
  110. }
  111. }
  112. },
  113. });
  114. }
  115. },
  116. // 取消会议提醒接口
  117. meetingReminderCancel() {
  118. if (this.detailData.IsCancelMeetingReminder == 1) {
  119. activity
  120. .meetingReminderCancel({
  121. ActivityId: Number(this.id),
  122. })
  123. .then((res) => {
  124. if (res.Ret == 200) {
  125. uni.showModal({
  126. confirmText: "知道了",
  127. confirmColor: "#3385FF",
  128. content: res.Msg,
  129. showCancel: false,
  130. success: (res) => {
  131. if (res.confirm) {
  132. this.getActivityDetail();
  133. }
  134. },
  135. });
  136. }
  137. });
  138. } else {
  139. this.meetingReminderAdd();
  140. }
  141. },
  142. // 添加会议提醒
  143. meetingReminderAdd() {
  144. activity
  145. .meetingReminderAdd({
  146. ActivityId: Number(this.id),
  147. })
  148. .then((res) => {
  149. if (res.Ret == 200) {
  150. uni.showModal({
  151. confirmText: "知道了",
  152. confirmColor: "#3385FF",
  153. content: res.Msg,
  154. showCancel: false,
  155. success: (res) => {
  156. if (res.confirm) {
  157. this.getActivityDetail();
  158. }
  159. },
  160. });
  161. }
  162. });
  163. },
  164. // 我要报名
  165. wanttosignup() {
  166. if (this.detailData.IsLimitPeople == 1 && this.detailData.ActivityTypeName == "公司调研电话会") {
  167. this.selectShow = true;
  168. } else {
  169. this.signupIsAddOfCancel(3);
  170. }
  171. },
  172. // 提问
  173. askingGo(type = "") {
  174. uni.navigateTo({
  175. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
  176. });
  177. },
  178. },
  179. };