manageMixin.js 6.0 KB

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