|
@@ -136,6 +136,55 @@ let _getCoupon = function(data){ |
|
@@ -136,6 +136,55 @@ let _getCoupon = function(data){ |
136
|
});
|
136
|
});
|
137
|
};
|
137
|
};
|
138
|
|
138
|
|
|
|
139
|
+let isSendRedEnevlope = false;
|
|
|
140
|
+let _getRedEnevlope = function(data){
|
|
|
141
|
+ data.app = utils.queryString();
|
|
|
142
|
+
|
|
|
143
|
+ data.app.uid = data.app.uid || cookies.cookie('app_uid');
|
|
|
144
|
+ data.app.app_version = data.app.app_version || cookies.cookie('app_version');
|
|
|
145
|
+ data.app.client_type = data.app.client_type || cookies.cookie('app_client_type');
|
|
|
146
|
+ data.app.session_key = data.app.session_key || cookies.cookie('app_session_key');
|
|
|
147
|
+
|
|
|
148
|
+ if (isSendRedEnevlope) {
|
|
|
149
|
+ return;
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+ isSendRedEnevlope = true;
|
|
|
153
|
+ jsonp({
|
|
|
154
|
+ url: '//m.yohobuy.com/activity/feature/redenvelope?callback=?',
|
|
|
155
|
+ timeout: 5000, // 5s
|
|
|
156
|
+ data: data
|
|
|
157
|
+ }).then(function(res) {
|
|
|
158
|
+ isSendRedEnevlope = false;
|
|
|
159
|
+ if (res.code === 200) {
|
|
|
160
|
+ utils.showTip({
|
|
|
161
|
+ title: '领取成功',
|
|
|
162
|
+ content: '恭喜您,领取成功',
|
|
|
163
|
+ close: true
|
|
|
164
|
+ });
|
|
|
165
|
+ } else if (res.code === 401) {
|
|
|
166
|
+ utils.showTip({
|
|
|
167
|
+ title: '已经领取',
|
|
|
168
|
+ content: '快去分享给更多<br>喜爱<span class="highlight">潮流</span>的小伙伴吧!',
|
|
|
169
|
+ close: true
|
|
|
170
|
+ });
|
|
|
171
|
+ } else if (res.message) {
|
|
|
172
|
+ utils.showTip({
|
|
|
173
|
+ title: '领取失败<br>请刷新重新领取',
|
|
|
174
|
+ content: res.message + '<br>如多次领取失败,请联系客服人员<br>带来不便敬请谅解',
|
|
|
175
|
+ close: false
|
|
|
176
|
+ });
|
|
|
177
|
+ }
|
|
|
178
|
+ }, function(){
|
|
|
179
|
+ isSendRedEnevlope = false;
|
|
|
180
|
+ utils.showTip({
|
|
|
181
|
+ title: '领取失败<br>请刷新重新领取',
|
|
|
182
|
+ content: '如多次领取失败,请联系客服人员<br>带来不便敬请谅解',
|
|
|
183
|
+ close: false
|
|
|
184
|
+ });
|
|
|
185
|
+ });
|
|
|
186
|
+}
|
|
|
187
|
+
|
139
|
let _initCoin = function(uid){
|
188
|
let _initCoin = function(uid){
|
140
|
if (uid) {
|
189
|
if (uid) {
|
141
|
let cointoken = cookies.cookie('yoho-coin-token');
|
190
|
let cointoken = cookies.cookie('yoho-coin-token');
|
|
@@ -215,7 +264,42 @@ let _initCoupon = function(uid) { |
|
@@ -215,7 +264,42 @@ let _initCoupon = function(uid) { |
215
|
};
|
264
|
};
|
216
|
|
265
|
|
217
|
let _initRedEnvelope = function(uid) {
|
266
|
let _initRedEnvelope = function(uid) {
|
|
|
267
|
+ if (uid) {
|
|
|
268
|
+ let redevenlopetoken = cookies.cookie('yoho-redenvelope-token');
|
|
|
269
|
+ if (redevenlopetoken) {
|
|
|
270
|
+ _getRedEnevlope({
|
|
|
271
|
+ token: redevenlopetoken,
|
|
|
272
|
+ uid: uid
|
|
|
273
|
+ });
|
|
|
274
|
+
|
|
|
275
|
+ cookies.setCookie('yoho-redenvelope-token', '');
|
|
|
276
|
+ }
|
|
|
277
|
+ }
|
|
|
278
|
+
|
|
|
279
|
+ $('body').on('click', '.yoho-redenvelope', function() {
|
|
|
280
|
+ let token = $(this).data('token');
|
|
|
281
|
+ if (user.uid) {
|
|
|
282
|
+ _getRedEnevlope({
|
|
|
283
|
+ token: token,
|
|
|
284
|
+ uid: user.uid
|
|
|
285
|
+ });
|
|
|
286
|
+ } else {
|
|
|
287
|
+ cookies.setCookie('yoho-redenvelope-token', token);
|
218
|
|
288
|
|
|
|
289
|
+ if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
290
|
+ wx.miniProgram.navigateTo({
|
|
|
291
|
+ url: `../bindPhoneNumber/bindPhoneNumber?h5back=${location.href}`
|
|
|
292
|
+ });
|
|
|
293
|
+ return;
|
|
|
294
|
+ }
|
|
|
295
|
+
|
|
|
296
|
+ if ($('#intimacy-link').length <= 0) {
|
|
|
297
|
+ $('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
298
|
+ }
|
|
|
299
|
+ $('.intimacy-link').click();
|
|
|
300
|
+ return;
|
|
|
301
|
+ }
|
|
|
302
|
+ });
|
219
|
}
|
303
|
}
|
220
|
|
304
|
|
221
|
export default {
|
305
|
export default {
|