Authored by hf

fixes bug refs YBW-2713 modify cuxiao coupon js check is app and logged

... ... @@ -2,13 +2,14 @@ var $tip, tipItime;
/* 领指定券 */
var activityId = $('#coupon-container').attr('param');
var userIsLogged = $('#coupon-container').attr('isLogged') === 'Y';
var isApp;
$('.get-coupon').click(function() {
var couponId = $(this).attr('param');
isApp = $(this).attr('href') !== 'javascript:;';
if (!isNaN(activityId) && !isNaN(couponId)) {
getNamedCoupon(activityId, couponId, isApp);
getNamedCoupon(activityId, couponId, isApp, userIsLogged);
}
});
/* 领所有券 */
... ... @@ -18,7 +19,6 @@ $('#get-all-coupon').click(function() {
});
/* 检查是否有在领取中的券,有则直接领取 */
var userIsLogged = $('#coupon-container').attr('isLogged');
if (userIsLogged === 'Y') {
var cookieCouponId = cookie('_Coupon' + activityId);
if (cookieCouponId && !isNaN(cookieCouponId)) {
... ... @@ -197,7 +197,7 @@ function showTip(con, dur) {
/**
* 获取活动的指定优惠券
*/
function getNamedCoupon(activityId, couponId, isApp)
function getNamedCoupon(activityId, couponId, isApp, userIsLogged)
{
$.ajax({
type: 'POST',
... ... @@ -208,6 +208,9 @@ function getNamedCoupon(activityId, couponId, isApp)
expires: -2,
domain: '.m.yohobuy.com'
});
if (isApp && !userIsLogged) {
return;
}
if (data.code == 200) {
showTip('恭喜你成功领取品牌优惠券');
}
... ...