index.html
1.8 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<include file="public@header" />
</head>
<body>
<form class="form-horizontal" role="form" style="width:800px;margin-top:100px;">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">核销码:</label>
<div class="col-sm-10">
<input type="text" name="ma" class="form-control" id="firstname"
placeholder="请输入核销码">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-default" onclick="hexiao()">核销</button>
<button type="button" class="btn btn-default" onclick="shenfen()">身份证号</button>
</div>
</div>
</form>
<script>
//点击核销时
function hexiao(){
ma = $("input[name='ma']").val();
if(ma == ''){
alert('请输入核销码');
}else{
$.post("{:url('Hexiao/hxCancel')}", {code:ma}, function(data) {
if(data == 2){
alert('核销码不存在');
}else if (data == 3) {
alert('优惠券已过期');
}else if (data ==4) {
alert('核销失败');
}else if (data == 5) {
alert('请在生日当天使用');
}else if (data == 1) {
alert('核销成功');
}
});
}
}
/**
*点击身份证号
*/
function shenfen(){
ma = $("input[name='ma']").val();
if(ma == ''){
alert('请输入核销码');
}else{
$.post("{:url('Hexiao/hexiao_idnum')}",{code:ma},function(data){
if(data){
$('#sfsf').remove();
$('#firstname').after("<input type='text' class='form-control' value='"+data+"' id='sfsf' style='margin-top: 10px;'>");
}else{
$('#sfsf').remove();
alert('请补全身份信息');
}
});
}
}
</script>
</body>
</html>