...
|
...
|
@@ -202,59 +202,63 @@ orderHammer.on('tap', function(e) { |
|
|
$reaMask.data('orderId', id);
|
|
|
|
|
|
if ($cur.closest('.raffle-btn').length > 0) {
|
|
|
userId = $cur.closest('.raffle-btn').attr('data-uid');
|
|
|
orderCode = $cur.closest('.raffle-btn').attr('data-code');
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/activity/raffle/lucky',
|
|
|
data: {
|
|
|
lotteryId: 20,
|
|
|
userId: userId,
|
|
|
orderCode: orderCode
|
|
|
},
|
|
|
success: function(data) {
|
|
|
var luck = data.data.orderLotteryCode;
|
|
|
var $diaMain = $('.dia-main');
|
|
|
switch(luck){
|
|
|
case 0:
|
|
|
break;
|
|
|
case 1:
|
|
|
lucky(data);
|
|
|
break;
|
|
|
case 2:
|
|
|
unlucky();
|
|
|
break;
|
|
|
case 3:
|
|
|
tip.show('用户抽奖不能多个客户端一起抽奖');
|
|
|
break;
|
|
|
case 4:
|
|
|
unlucky();
|
|
|
break;
|
|
|
}
|
|
|
// 中奖
|
|
|
function lucky(data) {
|
|
|
var message = data.data.orderLotteryMessage;
|
|
|
var bgPic = data.data.prize.image;
|
|
|
$('.lucky').show();
|
|
|
$('.dia-c').show();
|
|
|
$diaMain.find('p').show();
|
|
|
var dia_h = $diaMain.height() / 2;
|
|
|
$diaMain.css('margin-top', '-' + dia_h + 'px');
|
|
|
$diaMain.find('.message').text(message);
|
|
|
$diaMain.find('.lucky').css("background-image","url(" + bgPic + ")");
|
|
|
}
|
|
|
// 未中奖
|
|
|
function unlucky() {
|
|
|
$('.unlucky').show();
|
|
|
$('.dia-c').show();
|
|
|
var dia_h = $diaMain.height() / 2;
|
|
|
$diaMain.css('margin-top', '-' + dia_h + 'px');
|
|
|
if (isWeiXin()) {
|
|
|
userId = $cur.closest('.raffle-btn').attr('data-uid');
|
|
|
orderCode = $cur.closest('.raffle-btn').attr('data-code');
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/activity/raffle/lucky',
|
|
|
data: {
|
|
|
lotteryId: 20,
|
|
|
orderCode: orderCode
|
|
|
},
|
|
|
success: function(data) {
|
|
|
var luck = data.data.orderLotteryCode;
|
|
|
var $diaMain = $('.dia-main');
|
|
|
switch(luck){
|
|
|
case 0:
|
|
|
break;
|
|
|
case 1:
|
|
|
lucky(data);
|
|
|
break;
|
|
|
case 2:
|
|
|
unlucky();
|
|
|
break;
|
|
|
case 3:
|
|
|
tip.show('用户抽奖不能多个客户端一起抽奖');
|
|
|
break;
|
|
|
case 4:
|
|
|
unlucky();
|
|
|
break;
|
|
|
}
|
|
|
// 中奖
|
|
|
function lucky(data) {
|
|
|
var message = data.data.orderLotteryMessage;
|
|
|
var bgPic = data.data.prize.image;
|
|
|
$('.lucky').show();
|
|
|
$('.dia-c').show();
|
|
|
$diaMain.find('p').show();
|
|
|
var dia_h = $diaMain.height() / 2;
|
|
|
$diaMain.css('margin-top', '-' + dia_h + 'px');
|
|
|
$diaMain.find('.message').text(message);
|
|
|
$diaMain.find('.lucky').css("background-image","url(" + bgPic + ")");
|
|
|
}
|
|
|
// 未中奖
|
|
|
function unlucky() {
|
|
|
$('.unlucky').show();
|
|
|
$('.dia-c').show();
|
|
|
var dia_h = $diaMain.height() / 2;
|
|
|
$diaMain.css('margin-top', '-' + dia_h + 'px');
|
|
|
}
|
|
|
},
|
|
|
error: function(data) {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
},
|
|
|
error: function(data) {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
tip.show('请在微信端打开,才能参加抽奖');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if ($cur.closest('.del').length > 0) {
|
...
|
...
|
@@ -447,4 +451,14 @@ $('.dia-c .close').on('click', function() { |
|
|
|
|
|
$('.dia-main a').on('click', function () {
|
|
|
window.location.href = '//m.yohobuy.com/activity/raffle/orders'
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
});
|
|
|
|
|
|
// 判断是否是微信
|
|
|
function isWeiXin(){
|
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
|
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|