specialMixins.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { activity, User } from "@/config/api.js";
  2. export default {
  3. data() {
  4. return {
  5. specialIsHintShow: false, // 按钮的显示
  6. specialGoFollowShow: false, // 弹框的隐藏显示
  7. specialAccounts: `您已开启【专项调研】新活动通知<br/><br/>请关注【查研观向小助手】公众号,及时获取微信消息提醒`,
  8. specialIsFollow: false, // 是否关注
  9. specialPopupMsg: "", // 消息的文案
  10. show_cancel_button: false, // 取消按钮的隐藏显示
  11. show_confirm_button: false, // 确定按钮的隐藏显示
  12. };
  13. },
  14. computed: {},
  15. methods: {
  16. // 点击小icon
  17. reminderTextHandler(item) {
  18. this.specialPopupMsg = "";
  19. this.specialIsHintShow = true;
  20. this.specialGoFollowShow = true;
  21. this.specialAccounts = item.Explain;
  22. },
  23. // 报名或者取消报名
  24. async applyOfcancel(item, type = "") {
  25. this.show_confirm_button = true;
  26. if ((type != "back" && item.IsTrip == 1) || (type == "back" && item.IsSignup == 1)) {
  27. // 取消报名
  28. const str = item.ActivityTime.replace(/-/g, "/");
  29. const date = new Date(str);
  30. const times = date.getTime();
  31. const num = new Date().getTime();
  32. let twoDays = times - num <= 3600000 * 48;
  33. uni.showModal({
  34. content: twoDays ? "活动开始前48小时内,取消报名仍会维持扣点,确定要取消报名吗?" : "您要取消此次专项调研的预报名吗?",
  35. confirmColor: "#376cbb",
  36. cancelColor: "#606266",
  37. success: async (res) => {
  38. if (res.confirm) {
  39. const res = await activity.activityApecialCancel({
  40. ActivityId: item.ActivityId,
  41. PageRouter: this.$store.state.pageRouterActivity,
  42. });
  43. if (res.Ret === 200) {
  44. uni.showToast({
  45. title: "已取消",
  46. duration: 2000,
  47. });
  48. item.TripNum > 0 && (item.TripNum -= 1);
  49. type == "back" ? (item.IsSignup = 0) : (item.IsTrip = 0);
  50. }
  51. }
  52. },
  53. });
  54. } else {
  55. // 报名
  56. const res = await activity.activityApecialAdd({ ActivityId: item.ActivityId, PageRouter: this.$store.state.pageRouterActivity });
  57. if (res.Ret == 200) {
  58. this.modalShow(res);
  59. if (res.Data.SignupStatus == 1) {
  60. type == "back" ? (item.IsSignup = 1) : (item.IsTrip = 1);
  61. }
  62. }
  63. }
  64. },
  65. // 弹框的数据重置
  66. ininModalHandler() {
  67. this.show_cancel_button = false;
  68. this.show_confirm_button = false;
  69. this.specialIsHintShow = false;
  70. this.specialGoFollowShow = false;
  71. this.isCancelBtn = false;
  72. },
  73. // 显示弹框
  74. modalShow(res) {
  75. this.show_confirm_button = true;
  76. this.specialGoFollowShow = true;
  77. this.specialAccounts = res.Data.PopupMsg;
  78. this.specialPopupMsg = res.Data.PopupMsg2;
  79. },
  80. },
  81. };