fixes bug refs YBW-2713 modify cuxiao coupon js check is app and logged
Showing
1 changed file
with
6 additions
and
3 deletions
@@ -2,13 +2,14 @@ var $tip, tipItime; | @@ -2,13 +2,14 @@ var $tip, tipItime; | ||
2 | 2 | ||
3 | /* 领指定券 */ | 3 | /* 领指定券 */ |
4 | var activityId = $('#coupon-container').attr('param'); | 4 | var activityId = $('#coupon-container').attr('param'); |
5 | +var userIsLogged = $('#coupon-container').attr('isLogged') === 'Y'; | ||
5 | var isApp; | 6 | var isApp; |
6 | 7 | ||
7 | $('.get-coupon').click(function() { | 8 | $('.get-coupon').click(function() { |
8 | var couponId = $(this).attr('param'); | 9 | var couponId = $(this).attr('param'); |
9 | isApp = $(this).attr('href') !== 'javascript:;'; | 10 | isApp = $(this).attr('href') !== 'javascript:;'; |
10 | if (!isNaN(activityId) && !isNaN(couponId)) { | 11 | if (!isNaN(activityId) && !isNaN(couponId)) { |
11 | - getNamedCoupon(activityId, couponId, isApp); | 12 | + getNamedCoupon(activityId, couponId, isApp, userIsLogged); |
12 | } | 13 | } |
13 | }); | 14 | }); |
14 | /* 领所有券 */ | 15 | /* 领所有券 */ |
@@ -18,7 +19,6 @@ $('#get-all-coupon').click(function() { | @@ -18,7 +19,6 @@ $('#get-all-coupon').click(function() { | ||
18 | }); | 19 | }); |
19 | 20 | ||
20 | /* 检查是否有在领取中的券,有则直接领取 */ | 21 | /* 检查是否有在领取中的券,有则直接领取 */ |
21 | -var userIsLogged = $('#coupon-container').attr('isLogged'); | ||
22 | if (userIsLogged === 'Y') { | 22 | if (userIsLogged === 'Y') { |
23 | var cookieCouponId = cookie('_Coupon' + activityId); | 23 | var cookieCouponId = cookie('_Coupon' + activityId); |
24 | if (cookieCouponId && !isNaN(cookieCouponId)) { | 24 | if (cookieCouponId && !isNaN(cookieCouponId)) { |
@@ -197,7 +197,7 @@ function showTip(con, dur) { | @@ -197,7 +197,7 @@ function showTip(con, dur) { | ||
197 | /** | 197 | /** |
198 | * 获取活动的指定优惠券 | 198 | * 获取活动的指定优惠券 |
199 | */ | 199 | */ |
200 | -function getNamedCoupon(activityId, couponId, isApp) | 200 | +function getNamedCoupon(activityId, couponId, isApp, userIsLogged) |
201 | { | 201 | { |
202 | $.ajax({ | 202 | $.ajax({ |
203 | type: 'POST', | 203 | type: 'POST', |
@@ -208,6 +208,9 @@ function getNamedCoupon(activityId, couponId, isApp) | @@ -208,6 +208,9 @@ function getNamedCoupon(activityId, couponId, isApp) | ||
208 | expires: -2, | 208 | expires: -2, |
209 | domain: '.m.yohobuy.com' | 209 | domain: '.m.yohobuy.com' |
210 | }); | 210 | }); |
211 | + if (isApp && !userIsLogged) { | ||
212 | + return; | ||
213 | + } | ||
211 | if (data.code == 200) { | 214 | if (data.code == 200) { |
212 | showTip('恭喜你成功领取品牌优惠券'); | 215 | showTip('恭喜你成功领取品牌优惠券'); |
213 | } | 216 | } |
-
Please register or login to post a comment