Merge branch 'feature/seckill-coupon'
Showing
2 changed files
with
25 additions
and
6 deletions
@@ -154,11 +154,30 @@ let _getCoupon = function(data){ | @@ -154,11 +154,30 @@ let _getCoupon = function(data){ | ||
154 | 154 | ||
155 | if (res.code === 200) { | 155 | if (res.code === 200) { |
156 | utils.toast('领取成功', options); | 156 | utils.toast('领取成功', options); |
157 | - } else if (res.code === 401 && res.auth) { | ||
158 | - utils.toast('登录信息失效,请重新登录', options); | ||
159 | - setTimeout(() => { | ||
160 | - gotoLogin(); | ||
161 | - }, 1000); | 157 | + let $img = $(`#${data.token}`); |
158 | + if($img) { | ||
159 | + let statusImgs = $img.data('status-imgs'); | ||
160 | + if(statusImgs && statusImgs.received) { | ||
161 | + $img.attr('src', statusImgs.received); | ||
162 | + } | ||
163 | + } | ||
164 | + } else if (res.code === 401) { | ||
165 | + if(res.auth) { | ||
166 | + utils.toast('登录信息失效,请重新登录', options); | ||
167 | + setTimeout(() => { | ||
168 | + gotoLogin(); | ||
169 | + }, 1000); | ||
170 | + } | ||
171 | + if(res.message === '优惠券已经领取') { | ||
172 | + utils.toast(res.message, options); | ||
173 | + let $img = $(`#${data.token}`); | ||
174 | + if($img) { | ||
175 | + let statusImgs = $img.data('status-imgs'); | ||
176 | + if(statusImgs && statusImgs.received) { | ||
177 | + $img.attr('src', statusImgs.received); | ||
178 | + } | ||
179 | + } | ||
180 | + } | ||
162 | } else if (res.message) { | 181 | } else if (res.message) { |
163 | utils.toast(res.message, options); | 182 | utils.toast(res.message, options); |
164 | } else { | 183 | } else { |
-
Please register or login to post a comment