test.phtml
1.37 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
{{> layout/header}}
{{# floor}}
{{#if isCoupon}}
{{# list}}
{{#if isGet}}
<div>{{status}}</div>
{{/if}}
{{#if isZero}}
<div>{{status}}</div>
{{/if}}
{{#if isGeted}}
<div>{{status}}</div>
{{/if}}
{{/list}}
{{/if}}
<!-- {{#if isCarouselBanner}}-->
<!-- {{# list}}-->
<!-- <div>isCarouselBanner</div>-->
<!-- {{/list}}-->
<!-- {{/if}}-->
{{/ floor}}
<input type="hidden" id="couponId"/>
<button onclick="receiveCoupon()">领券</button>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="application/javascript">
function receiveCoupon() {
// 获取当前 URL
var referrer = window.location.pathname;
$.ajax({
method: 'GET',
url: 'http://m.dev.yohobuy.com/coupon/receiveCoupon',
data: {
couponID: 2516
},
dataType: 'json',
success: function (returnData) {
if (returnData['noLogin'] === true) {
window.location.href = returnData['url'];
} else {
alert(returnData);
}
},
error: function (e) {
alert(e);
}
});
}
</script>
{{> layout/footer}}