Commit cf34ddf4ebf53fa219d8696c8eb1aeff154005fe
1 parent
40611253
领取券的优化
Showing
2 changed files
with
34 additions
and
2 deletions
packageB/pages/user/user_coupon/user_coupon.js
... | ... | @@ -130,8 +130,23 @@ Page({ |
130 | 130 | |
131 | 131 | //获取券 |
132 | 132 | get_quan:function (e) { |
133 | + | |
134 | + console.log("get_quan_ing:"+this.data.get_quan_ing); | |
135 | + | |
136 | + if(this.data.get_quan_ing) return false; | |
137 | + this.data.get_quan_ing=1; | |
138 | + | |
133 | 139 | var th=this,index=e.currentTarget.dataset.ind; |
134 | 140 | var item = this.data.quan_list[index]; |
141 | + | |
142 | + var txt_get="quan_list["+index+"].get_quan_ing"; | |
143 | + | |
144 | + | |
145 | + this.setData({ | |
146 | + [txt_get]:1 | |
147 | + }) | |
148 | + | |
149 | + | |
135 | 150 | var can_get = item.ObtainTimes; |
136 | 151 | var Obtain = item.Obtain; |
137 | 152 | var Id = item.Id; |
... | ... | @@ -153,8 +168,25 @@ Page({ |
153 | 168 | obj[text] = Obtain; |
154 | 169 | th.setData(obj); |
155 | 170 | getApp().my_warnning("您已成功领取该券",1,th); |
171 | + | |
172 | + setTimeout(()=>{ | |
173 | + th.data.get_quan_ing=0; | |
174 | + th.setData({ | |
175 | + [txt_get]:0 | |
176 | + }) | |
177 | + },1000) | |
178 | + | |
179 | + | |
180 | + | |
156 | 181 | }else{ |
157 | 182 | getApp().my_warnning(e.data.msg,0,th); |
183 | + | |
184 | + setTimeout(()=>{ | |
185 | + th.data.get_quan_ing=0; | |
186 | + th.setData({ | |
187 | + [txt_get]:0 | |
188 | + }) | |
189 | + }) | |
158 | 190 | } |
159 | 191 | } |
160 | 192 | }) | ... | ... |
packageB/pages/user/user_coupon/user_coupon.wxml
... | ... | @@ -82,8 +82,8 @@ |
82 | 82 | </view> |
83 | 83 | </view> |
84 | 84 | |
85 | - <view class="clik-get t-c white five-level-word abs {{filter.setcolor(item.UseObjectType)}} " | |
86 | - wx:if="{{item.ObtainTimes>0 || item.SecondNo==0 }}" bindtap="get_quan" data-ind="{{index}}" >立即领取</view> | |
85 | + <view class="clik-get t-c white five-level-word abs {{item.get_quan_ing?'g_gray':filter.setcolor(item.UseObjectType)}} " | |
86 | + wx:if="{{item.ObtainTimes>0 || item.SecondNo==0 }}" bindtap="get_quan" data-ind="{{index}}" > {{item.get_quan_ing?'领取中':'立即领取'}}</view> | |
87 | 87 | <view class="clik-get t-c white five-level-word abs g_gray" wx:else bindtap="get_out" data-ind="{{index}}" |
88 | 88 | >已领取</view> |
89 | 89 | ... | ... |