manageMixin.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. if (this.detailData.IsResearchPoints) {
  51. this.researchPointsHandler(this.detailData.ActivityId, type, this.detailData);
  52. } else {
  53. this.myIsApplyHandler(this.detailData.ActivityId, type, this.detailData);
  54. }
  55. timer = setTimeout(() => {
  56. this.flag = false;
  57. }, 500);
  58. }
  59. },
  60. // 预约/取消
  61. async summaryIsHandel() {
  62. if (this.detailData.IsAppointment == 0) {
  63. const res = await activity.postAppointmentAdd({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  64. if (res.Ret == 200) {
  65. this.hasPermission = res.Data.HasPermission;
  66. this.jurisdictionList = res.Data;
  67. this.signupType = "summaryIsHandel";
  68. this.goOnNextStep = res.Data.GoFollow;
  69. if (res.Data.SignupStatus !== "Success") {
  70. this.isShow = true;
  71. } else {
  72. if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  73. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  74. }
  75. this.selectShow = false;
  76. this.detailData.IsAppointment = 1;
  77. this.synchronization();
  78. }
  79. } else {
  80. uni.showModal({
  81. content: "确定要取消预约本场调研的纪要吗?",
  82. confirmColor: "#3385FF",
  83. cancelColor: "#606266",
  84. success: async (res) => {
  85. if (res.confirm) {
  86. const res = await activity.postAppointmentCancel({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
  87. if (res.Ret === 200) {
  88. this.getActivityDetail();
  89. }
  90. }
  91. },
  92. });
  93. }
  94. },
  95. // 取消会议提醒接口
  96. meetingReminderCancel() {
  97. if (this.detailData.IsCancelMeetingReminder == 1) {
  98. activity
  99. .meetingReminderCancel({
  100. ActivityId: Number(this.id),
  101. PageRouter: this.$store.state.pageRouterActivity,
  102. })
  103. .then((res) => {
  104. if (res.Ret == 200) {
  105. uni.showModal({
  106. confirmText: "知道了",
  107. confirmColor: "#3385FF",
  108. content: res.Msg,
  109. showCancel: false,
  110. success: (res) => {
  111. if (res.confirm) {
  112. this.getActivityDetail();
  113. }
  114. },
  115. });
  116. }
  117. });
  118. } else {
  119. this.meetingReminderAdd();
  120. }
  121. },
  122. // 添加会议提醒
  123. meetingReminderAdd() {
  124. activity
  125. .meetingReminderAdd({
  126. ActivityId: Number(this.id),
  127. PageRouter: this.$store.state.pageRouterActivity,
  128. })
  129. .then((res) => {
  130. if (res.Ret == 200) {
  131. uni.showModal({
  132. confirmText: "知道了",
  133. confirmColor: "#3385FF",
  134. content: res.Msg,
  135. showCancel: false,
  136. success: (res) => {
  137. if (res.confirm) {
  138. this.getActivityDetail();
  139. }
  140. },
  141. });
  142. }
  143. });
  144. },
  145. // 我要报名
  146. wanttosignup() {
  147. if (
  148. (!this.detailData.IsYidongConduct && this.detailData.IsLimitPeople && [1, 2, 3].includes(this.detailData.ActivityTypeId)) ||
  149. (this.detailData.IsYidongConduct && this.detailData.IsCanOutboundCall)
  150. ) {
  151. this.selectShow = true;
  152. this.selectYdong = this.detailData.IsYidongConduct;
  153. } else {
  154. this.signupIsAddOfCancel(3);
  155. }
  156. },
  157. // 提问
  158. askingGo(type = "") {
  159. uni.navigateTo({
  160. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
  161. });
  162. },
  163. // 研选扣点的事件
  164. async researchPointsHandler(id, type, item) {
  165. const res = await activity.activityCheck({
  166. ActivityId: id,
  167. });
  168. if (res.Ret === 200) {
  169. let { Data } = res;
  170. this.checkResearchList = Data;
  171. this.checkResearchList.childrenType = type;
  172. this.jurisdictionList = item;
  173. this.isResearchModalShow = true;
  174. }
  175. },
  176. // 报名拆分出来
  177. myIsApplyHandler(id, type) {
  178. activity
  179. .signupAdd({
  180. ActivityId: this.detailData.ActivityId,
  181. SignupType: type,
  182. PageRouter: this.$store.state.pageRouterActivity,
  183. })
  184. .then((res) => {
  185. if (res.Ret == 200) {
  186. this.hasPermission = res.Data.HasPermission;
  187. this.jurisdictionList = res.Data;
  188. this.signupType = valName == "CClass" ? "CClass" : res.Data.SignupType;
  189. this.countryCode = res.Data.CountryCode;
  190. this.mobileEdit = res.Data.Mobile;
  191. this.goOnNextStep = res.Data.GoFollow;
  192. this.idTypeCancel = {
  193. cutId: res.Data.ActivityId,
  194. state: 1,
  195. };
  196. if (res.Data.SignupStatus !== "Success") {
  197. this.isShow = true;
  198. } else {
  199. this.detailData.IsSignup = 1;
  200. this.detailData.SignupNum += 1;
  201. this.detailData.SignupType = type;
  202. this.synchronization();
  203. if (res.Data.GoBindEmail) this.mailboxBinding = true;
  204. if (res.Data.GoOutboundMobile) this.editIsShow = true;
  205. else if (res.Data.GoFollow) this.goFollow = res.Data.GoFollow;
  206. else if (res.Data.SignupStatus == "Success") this.isShow = true;
  207. }
  208. }
  209. });
  210. },
  211. },
  212. };