Jelajahi Sumber

感兴趣弹框

bd0716 2 tahun lalu
induk
melakukan
f9ac1cdf70

+ 22 - 9
activityPages/components/specialMixins.js

@@ -18,15 +18,13 @@ export default {
       this.specialPopupMsg = "";
       this.specialIsHintShow = true;
       this.specialGoFollowShow = true;
-      this.show_cancel_button = false;
-      this.show_confirm_button = false;
       this.specialAccounts = item.Explain;
     },
     // 报名或者取消报名
     async applyOfcancel(item, type = "") {
-      this.show_cancel_button = false;
       this.show_confirm_button = true;
-      if ((type != "back" && item.IsTrip == 1) || (type == "back" && item.IsSignup == 1)) {  // 取消报名
+      if ((type != "back" && item.IsTrip == 1) || (type == "back" && item.IsSignup == 1)) {
+        // 取消报名
         const str = item.ActivityTime.replace(/-/g, "/");
         const date = new Date(str);
         const times = date.getTime();
@@ -52,18 +50,33 @@ export default {
             }
           },
         });
-      } else { // 报名
+      } else {
+        // 报名
         const res = await activity.activityApecialAdd({ ActivityId: item.ActivityId });
         if (res.Ret == 200) {
-          this.specialIsHintShow = false;
-          this.specialGoFollowShow = true;
-          this.specialAccounts = res.Data.PopupMsg;
-          this.specialPopupMsg = res.Data.PopupMsg2;
+          this.modalShow(res);
           if (res.Data.SignupStatus == 1) {
             type == "back" ? (item.IsSignup = 1) : (item.IsTrip = 1);
           }
         }
       }
     },
+
+    // 弹框的数据重置
+    ininModalHandler() {
+      this.show_cancel_button = false;
+      this.show_confirm_button = false;
+      this.specialIsHintShow = false;
+      this.specialGoFollowShow = false;
+      this.isCancelBtn = false;
+    },
+
+    // 显示弹框
+    modalShow(res) {
+      this.show_confirm_button = true;
+      this.specialGoFollowShow = true;
+      this.specialAccounts = res.Data.PopupMsg;
+      this.specialPopupMsg = res.Data.PopupMsg2;
+    },
   },
 };

+ 3 - 7
activityPages/specialDetail/specialDetail.vue

@@ -81,12 +81,13 @@
       :content-style="{ fontSize: '32rpx' }"
       :show-cancel-button="show_cancel_button"
       confirm-text="知道了"
-      @cancel="isCancelBtn = false"
       :show-confirm-button="show_confirm_button"
       :show-title="false"
       :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
       :confirm-style="{ fontWeight: '700' }"
       :mask-close-able="specialIsHintShow"
+      @confirm="ininModalHandler"
+      @cancel="ininModalHandler"
     >
       <view class="slot-content">
         <block v-if="specialPopupMsg">
@@ -144,12 +145,7 @@ export default {
       if (res.Ret === 200) {
         this.detailData.IsSignup = 1;
         this.currentPages();
-        uni.showModal({
-          content: "预报名成功,已通知您的销售",
-          confirmText: "知道了",
-          showCancel: false,
-          confirmColor: "#3385FF",
-        });
+        this.modalShow(res);
       }
     },
 

+ 3 - 7
activityPages/specialResearchPage/specialResearchPage.vue

@@ -63,12 +63,13 @@
       :content-style="{ fontSize: '32rpx' }"
       :show-cancel-button="show_cancel_button"
       confirm-text="知道了"
-      @cancel="isCancelBtn = false"
       :show-confirm-button="show_confirm_button"
       :show-title="false"
       :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
       :confirm-style="{ fontWeight: '700' }"
       :mask-close-able="specialIsHintShow"
+      @confirm="ininModalHandler"
+      @cancel="ininModalHandler"
     >
       <view class="slot-content">
         <block v-if="specialPopupMsg">
@@ -146,12 +147,7 @@ export default {
       });
       if (res.Ret === 200) {
         item.IsSignup = 1;
-        uni.showModal({
-          content: "预报名成功,已通知您的销售",
-          confirmText: "知道了",
-          showCancel: false,
-          confirmColor: "#3385FF",
-        });
+        this.modalShow(res);
       }
     },