message-content.js
1.02 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
44
45
46
47
48
49
50
51
/**
* 我的信息
* @author: yyqing<yanqing.yang@yoho.cn>
* @date: 2016/3/25
*/
var $ = require('yoho.jquery');
var Alert = require('../common/dialog').Alert;
var $pickBtn = $('.pick-coupon-btn');
var pickBusy = false;
$('.show-birth-coupon').click(function() {
var $this = $(this);
var msg = $this.data('msg');
if (msg) {
new Alert(msg).show();
return;
}
$this.siblings('.birth-coupon-wrap').show();
$this.hide().siblings('p').hide();
$(window).scrollTop(0);
});
$pickBtn.click(function() {
var data = $(this).data();
if (pickBusy) {
return;
}
pickBusy = true;
$.ajax({
type: 'GET',
url: '/home/message/pickCoupon',
data: data
}).then(function(jsonData) {
var msg = jsonData.message;
if (jsonData.code === 200) {
msg = '领取成功';
$(this).removeClass('pick-coupon-btn');
}
pickBusy = false;
alert(msg);
});
});