Browse Source

【Mod】优化下单抽奖

liuxiangxin 1 tháng trước cách đây
mục cha
commit
8cdacd25f5
1 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 11 2
      pages/orders/lottery.vue

+ 11 - 2
pages/orders/lottery.vue

@@ -110,6 +110,7 @@ export default {
         id: 0,
       },
       checkedAddr: {},
+	  isReqing:false,
     };
   },
   onLoad(param) {
@@ -196,6 +197,8 @@ export default {
       });
     },
     onClick() {
+	  // 没有数据的话,或者请求中,不允许刷新
+	  if (this.isReqing) return;
       // 活动是否开始
       if (!this.lotteryInfo.id) {
         uni.showToast({
@@ -228,8 +231,8 @@ export default {
         });
         return;
       }
-      // 次数操作
-      this.lotteryInfo.join_num = this.lotteryInfo.join_num - 1;
+	  // 设置请求中
+	  this.isReqing = true;
       // 请求列表
       this.$http.request('/api/lottery_order/get_reward', { lottery_id: this.lotteryInfo.id }).then((re) => {
         // 设置非请求中
@@ -238,6 +241,8 @@ export default {
         if (re.code == 'success') {
           // 奖品列表更新
           this.prizeList = re.data.reward_list;
+		  // 次数操作
+		  this.lotteryInfo.join_num = this.lotteryInfo.join_num - 1;
           // 奖品的索引
           return this.$refs.dialer.run(re.data.reward_index);
         } else {
@@ -256,8 +261,12 @@ export default {
       this.$refs.lotteryRule.close();
     },
     showRecord() {
+      // 没有数据的话,或者请求中,不允许刷新
+	  if (this.isReqing) return;
       // 活动是否开始
       if (this.lotteryInfo.id) {
+	    // 设置请求中
+		this.isReqing = false;
         // 请求列表
         this.$http.request('/api/lottery_order_record/get_list', { lottery_id: this.lotteryInfo.id }).then((re) => {
           // 设置非请求中