yearrenew.html
5.9 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>年续费</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="email=no"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-title" content="">
<meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 -->
<link rel="apple-touch-icon-precomposed" href="favicon.ico">
<link rel="shortcut icon" href="favicon.ico">
<link rel="Bookmark" href="favicon.ico">
<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
<link rel="stylesheet" href="${staticHost}/css/reset.css">
</head>
<body ontouchstart>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">车牌号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="text" maxlength="7" value="${carNo!''}" readonly>
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">卡类别</label></div>
<div class="weui-cell__bd">
${cardTypeStr!''}
</div>
</div>
</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">停车场</label></div>
<div class="weui-cell__bd">${parkName!''}</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">购买数量</label></div>
<div class="weui-cell__bd"><span id="reduce_btn" class="reduce_btn">-</span><input class="weui-input inpt-num"
id="numder" type="text"
readonly="" value="1"><span
id="add_btn" class="add_btn">+</span></div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">当前有效期</label></div>
<div class="weui-cell__bd" id="expiryDate">
${expDateStr!''}
</div>
</div>
<!--<div class="weui-cell">-->
<!--<div class="weui-cell__hd"><label for="date" class="weui-label">开始时间</label></div>-->
<!--<div class="weui-cell__bd">-->
<!--<input class="weui-input" id="date" type="text" placeholder="请选择开始时间">-->
<!--</div>-->
<!--<div class="weui-cell__ft">-->
<!--</div>-->
<!--</div>-->
<div class="weui-cell">
<div class="weui-cell__hd"><label for="date1" class="weui-label">有效期至</label></div>
<div class="weui-cell__bd">
<input class="weui-input" id="date1" type="text" readonly value="">
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">合计</label></div>
<div class="weui-cell__bd pay-total">
¥<span id="totle_money">${cardPrice!'null'}</span>
</div>
</div>
</div>
<div class="pay-content-padded">
<a href="javascript:;" class="weui-btn weui-btn_primary" id="pay_btn">提交订单</a>
</div>
<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="${staticHost}/js/lib/jquery-weui.min.js"></script>
<script src="${staticHost}/js/jsutil.js"></script>
<script src="${staticHost}/js/url.js"></script>
<script>
//单价
var price = ${cardPrice!null};
var startDateStr = '${expDateStr!""}';
var id = ${id};
//添加数量
$("#add_btn").click(function () {
var num = $("#numder").val();
num++;
if (num > 1 && num < 6) {
initEndDateStr(num);
} else {
$.toptip('最多续期5年', 2000, 'warning');
}
});
//减去数量
$("#reduce_btn").click(function () {
var num = $("#numder").val();
num--;
if (num > 0) {
initEndDateStr(num);
} else {
$.toptip('最少续期一年', 2000, 'warning');
}
});
//立即支付
$('#pay_btn').on('click', function () {
var num = $("#numder").val();
if (num > 5 || num < 1) {
$.toptip('订购数量不合法', 2000, 'error')
} else {
$.toptip('最多购买5年', 2000, 'warning');
}
var req = {
custCardId:${id},
num: num
}
$.ajax({
url: mUrl.renewSubmitOrder,
data: req,
type: 'Post',
success: function (res) {
if (res.code == '8888') {
var parkOrderId = res.data;
window.location.href = mUrl.orderPayView + '&parkOrderId=' + parkOrderId;
} else {
$.toptip('系统异常', 2000, 'error')
}
}
});
});
//计算结束时间
function initEndDateStr(num) {
num = parseInt(num);
if (null == startDateStr || startDateStr.length < 4) {
$.toptip('无法获取开始时间', 2000, 'warning');
}
var startDate = new Date(startDateStr);
var endDate = new Date(startDate.format('yyyy-MM-dd'));
//设置数量
$("#numder").val(num);
endDate.setYear(endDate.getFullYear() + num);
//设置失效日期
$('#date1').val(endDate.format('yyyy-MM-dd'));
//设置总价
var price = $("#cardAmount").val();
$("#totle_money").html(num * price);
}
//第一次初始化为数量1
initEndDateStr(1);
</script>
</body>
</html>