specialMixins.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: "#3385FF",
  36. cancelColor: "#606266",
  37. success: async (res) => {
  38. if (res.confirm) {
  39. const res = await activity.activityApecialCancel({
  40. ActivityId: item.ActivityId,
  41. });
  42. if (res.Ret === 200) {
  43. uni.showToast({
  44. title: "已取消",
  45. duration: 2000,
  46. });
  47. item.TripNum > 0 && (item.TripNum -= 1);
  48. type == "back" ? (item.IsSignup = 0) : (item.IsTrip = 0);
  49. }
  50. }
  51. },
  52. });
  53. } else {
  54. // 报名
  55. const res = await activity.activityApecialAdd({ ActivityId: item.ActivityId });
  56. if (res.Ret == 200) {
  57. this.modalShow(res);
  58. if (res.Data.SignupStatus == 1) {
  59. type == "back" ? (item.IsSignup = 1) : (item.IsTrip = 1);
  60. }
  61. }
  62. }
  63. },
  64. // 弹框的数据重置
  65. ininModalHandler() {
  66. this.show_cancel_button = false;
  67. this.show_confirm_button = false;
  68. this.specialIsHintShow = false;
  69. this.specialGoFollowShow = false;
  70. this.isCancelBtn = false;
  71. },
  72. // 显示弹框
  73. modalShow(res) {
  74. this.show_confirm_button = true;
  75. this.specialGoFollowShow = true;
  76. this.specialAccounts = res.Data.PopupMsg;
  77. this.specialPopupMsg = res.Data.PopupMsg2;
  78. },
  79. },
  80. };