coupon.js
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Created by Administrator on 2016/4/13.
*/
var $ = require('jquery');
var $receive = $('.main-right-receive');
var $mask = $('.floor-mask');
var $message = $('.floor-message');
var $tooltip = $('.floor-tooltip');
$receive.on('touchend',function(){
var curDom=$(this);
$.ajax({
url:'/coupon/receiveCoupon',
dataType:'json',
success:function(data){
if (data['noLogin'] === true) {
var msg=data.msg;
var status=data.status;
if(!status){
curDom.hide();
curDom.next().show();
$tooltip.show();
setTimeout(function(){
$tooltip.hide();
},3000);
}else{
$message.find('.coupon-message-content').text(msg);
$mask.show();
$message.show();
}
}else{
location.href = data['url'];
}
},
error:function(){}
});
});
$('.coupon-floor a').on('click', function () {
if($(this).attr('href').length <= 0) {
return false;
}
})