...
|
...
|
@@ -136,6 +136,55 @@ let _getCoupon = function(data){ |
|
|
});
|
|
|
};
|
|
|
|
|
|
let isSendRedEnevlope = false;
|
|
|
let _getRedEnevlope = function(data){
|
|
|
data.app = utils.queryString();
|
|
|
|
|
|
data.app.uid = data.app.uid || cookies.cookie('app_uid');
|
|
|
data.app.app_version = data.app.app_version || cookies.cookie('app_version');
|
|
|
data.app.client_type = data.app.client_type || cookies.cookie('app_client_type');
|
|
|
data.app.session_key = data.app.session_key || cookies.cookie('app_session_key');
|
|
|
|
|
|
if (isSendRedEnevlope) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
isSendRedEnevlope = true;
|
|
|
jsonp({
|
|
|
url: '//m.yohobuy.com/activity/feature/redenvelope?callback=?',
|
|
|
timeout: 5000, // 5s
|
|
|
data: data
|
|
|
}).then(function(res) {
|
|
|
isSendRedEnevlope = false;
|
|
|
if (res.code === 200) {
|
|
|
utils.showTip({
|
|
|
title: '领取成功',
|
|
|
content: '恭喜您,领取成功',
|
|
|
close: true
|
|
|
});
|
|
|
} else if (res.code === 401) {
|
|
|
utils.showTip({
|
|
|
title: '已经领取',
|
|
|
content: '快去分享给更多<br>喜爱<span class="highlight">潮流</span>的小伙伴吧!',
|
|
|
close: true
|
|
|
});
|
|
|
} else if (res.message) {
|
|
|
utils.showTip({
|
|
|
title: '领取失败<br>请刷新重新领取',
|
|
|
content: res.message + '<br>如多次领取失败,请联系客服人员<br>带来不便敬请谅解',
|
|
|
close: false
|
|
|
});
|
|
|
}
|
|
|
}, function(){
|
|
|
isSendRedEnevlope = false;
|
|
|
utils.showTip({
|
|
|
title: '领取失败<br>请刷新重新领取',
|
|
|
content: '如多次领取失败,请联系客服人员<br>带来不便敬请谅解',
|
|
|
close: false
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let _initCoin = function(uid){
|
|
|
if (uid) {
|
|
|
let cointoken = cookies.cookie('yoho-coin-token');
|
...
|
...
|
@@ -215,7 +264,42 @@ let _initCoupon = function(uid) { |
|
|
};
|
|
|
|
|
|
let _initRedEnvelope = function(uid) {
|
|
|
if (uid) {
|
|
|
let redevenlopetoken = cookies.cookie('yoho-redenvelope-token');
|
|
|
if (redevenlopetoken) {
|
|
|
_getRedEnevlope({
|
|
|
token: redevenlopetoken,
|
|
|
uid: uid
|
|
|
});
|
|
|
|
|
|
cookies.setCookie('yoho-redenvelope-token', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$('body').on('click', '.yoho-redenvelope', function() {
|
|
|
let token = $(this).data('token');
|
|
|
if (user.uid) {
|
|
|
_getRedEnevlope({
|
|
|
token: token,
|
|
|
uid: user.uid
|
|
|
});
|
|
|
} else {
|
|
|
cookies.setCookie('yoho-redenvelope-token', token);
|
|
|
|
|
|
if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: `../bindPhoneNumber/bindPhoneNumber?h5back=${location.href}`
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
}
|
|
|
$('.intimacy-link').click();
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
export default {
|
...
|
...
|
|