...
|
...
|
@@ -3,9 +3,12 @@ |
|
|
*/
|
|
|
require('activity/coupon-floor.page.css');
|
|
|
|
|
|
let $ = require('yoho-jquery'),
|
|
|
const $ = require('yoho-jquery'),
|
|
|
Swiper = require('yoho-swiper2'),
|
|
|
tip = require('plugin/tip');
|
|
|
const yoho = require('../yoho-app');
|
|
|
const cookie = require('yoho-cookie');
|
|
|
const qs = require('yoho-qs');
|
|
|
let $receive = $('.main-right-receive'),
|
|
|
$mask = $('.floor-mask'),
|
|
|
$message = $('.floor-message'),
|
...
|
...
|
@@ -71,30 +74,36 @@ setTimeout(function() { |
|
|
|
|
|
$receive.on('click', function() {
|
|
|
let $curDom = $(this);
|
|
|
let requestParams = {
|
|
|
code: qs.code,
|
|
|
couponID: $curDom.parents('.coupon-floor').attr('coupon-id')
|
|
|
};
|
|
|
|
|
|
if (qs.app_version) {
|
|
|
requestParams.app_version = qs.app_version;
|
|
|
}
|
|
|
|
|
|
let req = '',
|
|
|
version = getUrlParam('app_version'),
|
|
|
uid = getUrlParam('uid');
|
|
|
|
|
|
if (version) {
|
|
|
req += '&app_version=' + version;
|
|
|
if (qs.uid) {
|
|
|
requestParams.uid = qs.uid;
|
|
|
}
|
|
|
|
|
|
if (uid) {
|
|
|
req += '&uid=' + uid;
|
|
|
if (yoho.isApp) {
|
|
|
requestParams.app = {
|
|
|
uid: cookie.get('app_uid') || qs.uid,
|
|
|
app_version: cookie.get('app_version') || qs.app_version,
|
|
|
client_type: cookie.get('app_client_type') || qs.client_type,
|
|
|
session_key: cookie.get('app_session_key') || qs.session_key
|
|
|
};
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: '//m.yohobuy.com/activity/coupon/receiveCoupon?code=' + getUrlParam('code') + req,
|
|
|
data: {
|
|
|
couponID: $curDom.parents('.coupon-floor').attr('coupon-id')
|
|
|
},
|
|
|
url: '//m.yohobuy.com/activity/coupon/receiveCoupon',
|
|
|
data: requestParams,
|
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
if (data.code === 400) {
|
|
|
// 未登录情况下,跳转登陆页
|
|
|
if (version) {
|
|
|
if (qs.app_version) {
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + $('#appurl').val() +
|
|
|
'\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
...
|
...
|
|