|
@@ -3,9 +3,12 @@ |
|
@@ -3,9 +3,12 @@ |
3
|
*/
|
3
|
*/
|
4
|
require('activity/coupon-floor.page.css');
|
4
|
require('activity/coupon-floor.page.css');
|
5
|
|
5
|
|
6
|
-let $ = require('yoho-jquery'),
|
6
|
+const $ = require('yoho-jquery'),
|
7
|
Swiper = require('yoho-swiper2'),
|
7
|
Swiper = require('yoho-swiper2'),
|
8
|
tip = require('plugin/tip');
|
8
|
tip = require('plugin/tip');
|
|
|
9
|
+const yoho = require('../yoho-app');
|
|
|
10
|
+const cookie = require('yoho-cookie');
|
|
|
11
|
+const qs = require('yoho-qs');
|
9
|
let $receive = $('.main-right-receive'),
|
12
|
let $receive = $('.main-right-receive'),
|
10
|
$mask = $('.floor-mask'),
|
13
|
$mask = $('.floor-mask'),
|
11
|
$message = $('.floor-message'),
|
14
|
$message = $('.floor-message'),
|
|
@@ -71,30 +74,36 @@ setTimeout(function() { |
|
@@ -71,30 +74,36 @@ setTimeout(function() { |
71
|
|
74
|
|
72
|
$receive.on('click', function() {
|
75
|
$receive.on('click', function() {
|
73
|
let $curDom = $(this);
|
76
|
let $curDom = $(this);
|
|
|
77
|
+ let requestParams = {
|
|
|
78
|
+ code: qs.code,
|
|
|
79
|
+ couponID: $curDom.parents('.coupon-floor').attr('coupon-id')
|
|
|
80
|
+ };
|
74
|
|
81
|
|
|
|
82
|
+ if (qs.app_version) {
|
|
|
83
|
+ requestParams.app_version = qs.app_version;
|
|
|
84
|
+ }
|
75
|
|
85
|
|
76
|
- let req = '',
|
|
|
77
|
- version = getUrlParam('app_version'),
|
|
|
78
|
- uid = getUrlParam('uid');
|
|
|
79
|
-
|
|
|
80
|
- if (version) {
|
|
|
81
|
- req += '&app_version=' + version;
|
86
|
+ if (qs.uid) {
|
|
|
87
|
+ requestParams.uid = qs.uid;
|
82
|
}
|
88
|
}
|
83
|
|
89
|
|
84
|
- if (uid) {
|
|
|
85
|
- req += '&uid=' + uid;
|
90
|
+ if (yoho.isApp) {
|
|
|
91
|
+ requestParams.app = {
|
|
|
92
|
+ uid: cookie.get('app_uid') || qs.uid,
|
|
|
93
|
+ app_version: cookie.get('app_version') || qs.app_version,
|
|
|
94
|
+ client_type: cookie.get('app_client_type') || qs.client_type,
|
|
|
95
|
+ session_key: cookie.get('app_session_key') || qs.session_key
|
|
|
96
|
+ };
|
86
|
}
|
97
|
}
|
87
|
|
98
|
|
88
|
$.ajax({
|
99
|
$.ajax({
|
89
|
- url: '//m.yohobuy.com/activity/coupon/receiveCoupon?code=' + getUrlParam('code') + req,
|
|
|
90
|
- data: {
|
|
|
91
|
- couponID: $curDom.parents('.coupon-floor').attr('coupon-id')
|
|
|
92
|
- },
|
100
|
+ url: '//m.yohobuy.com/activity/coupon/receiveCoupon',
|
|
|
101
|
+ data: requestParams,
|
93
|
dataType: 'json',
|
102
|
dataType: 'json',
|
94
|
success: function(data) {
|
103
|
success: function(data) {
|
95
|
if (data.code === 400) {
|
104
|
if (data.code === 400) {
|
96
|
// 未登录情况下,跳转登陆页
|
105
|
// 未登录情况下,跳转登陆页
|
97
|
- if (version) {
|
106
|
+ if (qs.app_version) {
|
98
|
if ($('#intimacy-link').length <= 0) {
|
107
|
if ($('#intimacy-link').length <= 0) {
|
99
|
$('body').append('<a href=\'' + $('#appurl').val() +
|
108
|
$('body').append('<a href=\'' + $('#appurl').val() +
|
100
|
'\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
109
|
'\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|