message-detail.js
923 Bytes
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
var $ = require('jquery'),
dialog = require('./dialog');
var $page = $('.massage-page');
var pickBusy = false;
// 领取生日券
$page.on('touchstart', '.pick-coupon-btn', function() {
if (pickBusy) {
return;
}
pickBusy = true;
var $id = $(this).data('id');
$.ajax({
type: 'POST',
url: '/home/pickCoupon',
data: {
id: $id
},
success: function(data) {
if (data.code === 200) {
dialog.showDialog({
dialogText: '领取成功',
autoHide: 2000,
fast: true
});
$(this).removeClass('pick-coupon-btn');
}
pickBusy = false;
dialog.showDialog({
dialogText: data.message,
autoHide: 2000,
fast: true
});
}
});
});