e80df919
atao
init
|
1
2
3
|
<!DOCTYPE html>
<html lang="en">
<head>
|
1b8be02a
atao
修改购买卡时的费用
|
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<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">
<link rel="stylesheet" href="${staticHost}/css/monthpay.min.css">
|
e80df919
atao
init
|
20
21
22
|
</head>
<body ontouchstart>
<div class="weui-cells weui-cells_form">
|
1b8be02a
atao
修改购买卡时的费用
|
23
24
25
26
|
<input type="hidden" id="parkLotCardId" value="${parkLotCardId!''}"/>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">车牌号</label></div>
<div class="weui-cell__bd">
|
96d2824b
atao
提交代码
|
27
|
<input class="weui-input" type="text" value="" maxlength="7" placeholder="请输入车牌号,必填" id="license_number">
|
1b8be02a
atao
修改购买卡时的费用
|
28
|
</div>
|
e80df919
atao
init
|
29
|
</div>
|
1b8be02a
atao
修改购买卡时的费用
|
30
31
32
33
34
|
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">卡类别</label></div>
<div class="weui-cell__bd" id="cardTypeRemark">
<!-- 蓝牌小车包月卡-->
</div>
|
e80df919
atao
init
|
35
|
</div>
|
e80df919
atao
init
|
36
37
38
|
</div>
<div class="weui-cells weui-cells_form">
|
1b8be02a
atao
修改购买卡时的费用
|
39
40
41
42
|
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">停车场</label></div>
<input type="hidden" id="parkLotCode"/>
<div class="weui-cell__bd" id="parkLotName"></div>
|
e80df919
atao
init
|
43
|
</div>
|
96d2824b
atao
提交代码
|
44
|
|
1b8be02a
atao
修改购买卡时的费用
|
45
46
47
48
49
50
51
|
<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>
|
e80df919
atao
init
|
52
|
</div>
|
1b8be02a
atao
修改购买卡时的费用
|
53
54
55
56
57
|
<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 placeholder="请先选择开始时间">
</div>
|
e80df919
atao
init
|
58
|
</div>
|
1b8be02a
atao
修改购买卡时的费用
|
59
|
<div class="weui-cell">
|
d24e0b2b
王富生
提交修改
|
60
61
62
63
64
65
66
67
|
<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">
|
1b8be02a
atao
修改购买卡时的费用
|
68
69
70
71
72
|
<div class="weui-cell__hd"><label class="weui-label">合计</label></div>
<input type="hidden" id="cardAmount"/>
<div class="weui-cell__bd pay-total">
¥<span id="totle_money">90</span>
</div>
|
e80df919
atao
init
|
73
|
</div>
|
e80df919
atao
init
|
74
75
|
</div>
<div class="pay-content-padded">
|
1b8be02a
atao
修改购买卡时的费用
|
76
|
<a href="javascript:;" class="weui-btn weui-btn_primary" id="pay_btn">提交订单</a>
|
e80df919
atao
init
|
77
78
79
80
81
82
|
</div>
<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
<script src="${staticHost}/js/jsutil.js"></script>
<script src="${staticHost}/js/url.js"></script>
<script type="text/javascript">
|
1b8be02a
atao
修改购买卡时的费用
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
var func = {
//1.初始化页面信息.<br/>
initMonthCardInfo: function () {
var parkLotCardId = $('#parkLotCardId').val();
if (parkLotCardId == null || parkLotCardId == "") {
$.alert("系统繁忙,请重新操作!");
return false;
}
var jsonInfo = {};
jsonInfo.parkLotCardId = parkLotCardId;
jsutil.defaultReq(
mUrl.queryParkLotCardForChoose,
jsonInfo,
function (data) {
if ("8888" == data.code) {
var parkLot = data.data;
$('#parkLotName').empty();
$('#cardTypeRemark').empty();
$('#totle_money').empty();
$('#parkLotName').text(parkLot.parkName);
$('#parkLotCode').val(parkLot.parkNo);
$('#cardTypeRemark').text(parkLot.parkCardCouponsList[0].goods_type_remark);
|
96d2824b
atao
提交代码
|
105
|
$('#totle_money').text(parkLot.parkCardCouponsList[0].goods_amount / 100);
|
1b8be02a
atao
修改购买卡时的费用
|
106
|
$('#parkLotCardId').val(parkLot.parkCardCouponsList[0].id);
|
0c5184f3
atao
提交金额修改
|
107
|
//将分转为元
|
96d2824b
atao
提交代码
|
108
|
$('#cardAmount').val(parkLot.parkCardCouponsList[0].goods_amount / 100);
|
1b8be02a
atao
修改购买卡时的费用
|
109
110
111
112
113
|
} else {
$.alert("系统繁忙,请重新操作!");
}
});
}
|
e80df919
atao
init
|
114
|
};
|
96d2824b
atao
提交代码
|
115
|
|
1b8be02a
atao
修改购买卡时的费用
|
116
117
|
$(function () {
func.initMonthCardInfo();
|
1b8be02a
atao
修改购买卡时的费用
|
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
//当pick的值发生变化的时候
function pickerOnClose() {
var inputDateStr = formatDateStr($('#date').val());
var inputDate = new Date(inputDateStr);
var inputYear = inputDate.getFullYear();
var inputMonth = inputDate.getMonth();
var date = new Date();
var thisYear = date.getFullYear();
var thisMonth = date.getMonth();
//当前时间大于选择的时间
if (thisYear >= inputYear && thisMonth >= inputMonth) {
$.toptip('开始时间不能小于下月 1号 ', 'warning');
setPickerDefaultValue();
}
var num = $("#numder").val();
var startDateStr = $("#date").val();
|
96d2824b
atao
提交代码
|
136
|
var dateStr = formatDateStr(startDateStr);
|
1b8be02a
atao
修改购买卡时的费用
|
137
138
139
140
|
handelEndDateAndPrice(num, new Date(dateStr));
}
|
1b8be02a
atao
修改购买卡时的费用
|
141
|
|
96d2824b
atao
提交代码
|
142
143
144
145
|
//初始化时间calendar组件的参数
function initCalendarParam() {
var currentDate = new Date()
var currentDateStr = currentDate.format('yyyy-MM-dd');
|
1b8be02a
atao
修改购买卡时的费用
|
146
|
var param = {};
|
96d2824b
atao
提交代码
|
147
148
149
150
151
152
153
154
|
$("#date").val(currentDateStr);
currentDate.setDate(currentDate.getDate() - 1);
//最小日期
param.minDate = currentDate.format('yyyy-MM-dd');
param.onClose = calendarOnclose;
var startDate = new Date()
//设置结束时间,总价
handelEndDateAndPrice(1, startDate);
|
1b8be02a
atao
修改购买卡时的费用
|
155
156
157
|
return param;
}
|
96d2824b
atao
提交代码
|
158
159
160
161
162
163
164
|
//当开始时间变化时
function calendarOnclose() {
var startDate = new Date($("#date").val());
var num = $("#numder").val();
handelEndDateAndPrice(num, startDate);
}
|
1b8be02a
atao
修改购买卡时的费用
|
165
|
//选择日期
|
96d2824b
atao
提交代码
|
166
167
|
$("#date").calendar(
initCalendarParam()
|
1b8be02a
atao
修改购买卡时的费用
|
168
169
170
171
172
|
);
//根据数量,开始时间计算 结束时间,总价
function handelEndDateAndPrice(num, startDate) {
|
96d2824b
atao
提交代码
|
173
174
|
if (typeof num == 'string') {
|
1b8be02a
atao
修改购买卡时的费用
|
175
176
|
num = parseInt(num);
}
|
96d2824b
atao
提交代码
|
177
178
179
180
181
|
if (typeof startDate == 'string') {
startDate = new Date(startDate);
}
var endDate = new Date(startDate.format('yyyy-MM-dd'));
|
1b8be02a
atao
修改购买卡时的费用
|
182
183
|
//设置数量
$("#numder").val(num);
|
1b8be02a
atao
修改购买卡时的费用
|
184
|
|
96d2824b
atao
提交代码
|
185
186
187
188
189
190
191
|
var days = 0;
var temp = startDate.getMonth();
for (var i = 1; i <= num; i++) {
startDate.setMonth(temp + i);
startDate.setDate(0);
days += startDate.getDate();
|
1b8be02a
atao
修改购买卡时的费用
|
192
|
}
|
96d2824b
atao
提交代码
|
193
194
|
days--;
endDate.setDate(endDate.getDate() + days);
|
1b8be02a
atao
修改购买卡时的费用
|
195
|
//设置失效日期
|
96d2824b
atao
提交代码
|
196
|
$('#date1').val(endDate.format('yyyy-MM-dd'));
|
1b8be02a
atao
修改购买卡时的费用
|
197
198
199
200
|
//设置总价
var price = $("#cardAmount").val();
$("#totle_money").html(num * price);
}
|
e80df919
atao
init
|
201
|
|
1b8be02a
atao
修改购买卡时的费用
|
202
|
|
1b8be02a
atao
修改购买卡时的费用
|
203
204
205
206
207
208
209
210
211
212
|
//添加数量
$("#add_btn").click(function () {
var startDateStr = $("#date").val();
if (null == startDateStr || startDateStr.length < 1) {
$.toptip('请先选择开始时间', 2000, 'warning');
return;
}
var num = $("#numder").val();
num++;
|
d24e0b2b
王富生
提交修改
|
213
|
if (num > 1 && num < 12) {
|
96d2824b
atao
提交代码
|
214
|
var startDate = new Date(startDateStr);
|
1b8be02a
atao
修改购买卡时的费用
|
215
216
|
handelEndDateAndPrice(num, startDate);
} else {
|
d24e0b2b
王富生
提交修改
|
217
|
$.toptip('最多购买11个月', 2000, 'warning');
|
1b8be02a
atao
修改购买卡时的费用
|
218
219
220
221
222
|
}
});
//减去数量
$("#reduce_btn").click(function () {
|
1b8be02a
atao
修改购买卡时的费用
|
223
224
225
226
227
228
229
230
231
|
var startDateStr = $("#date").val();
if (null == startDateStr || startDateStr.length < 1) {
$.toptip('请先选择开始时间', 2000, 'warning');
return;
}
var num = $("#numder").val();
num--;
if (num > 0) {
|
96d2824b
atao
提交代码
|
232
|
var startDate = new Date($("#date").val());
|
1b8be02a
atao
修改购买卡时的费用
|
233
|
handelEndDateAndPrice(num, startDate);
|
e80df919
atao
init
|
234
|
} else {
|
1b8be02a
atao
修改购买卡时的费用
|
235
236
237
238
239
240
241
242
243
244
245
|
$.toptip('最少购买一个月', 2000, 'warning');
}
});
//立即支付
$('#pay_btn').on('click', function () {
var carNum = $('#license_number').val();
var parkLotCardId = $('#parkLotCardId').val();
var buyNum = $('#numder').val();
|
96d2824b
atao
提交代码
|
246
247
|
var startDate = $('#date').val();
var endDate = $('#date1').val();
|
1b8be02a
atao
修改购买卡时的费用
|
248
249
250
|
var totleMoney = $('#totle_money').text();
if (carNum == '' || carNum == null || carNum == undefined) {
$.toptip('亲!请输入车牌号', 3000, 'warning'); //设置显示时间
|
e80df919
atao
init
|
251
|
return false
|
1b8be02a
atao
修改购买卡时的费用
|
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
}
//车牌校验
var checkResult = jsutil.isVehicleNumber(jsutil.trim(carNum));
if (!checkResult) {
$.alert("亲!输入车牌号不正确,<br/> 正确格式如:陕K88888");
return false;
}
/**
*校验车牌号是否已经在对应的停车场已经订购? 是:跳转续费页面,否:继续订购
* parkLotCardId
*/
jsutil.defaultReq(
mUrl.checkIsbuyCard,
{"carNum": carNum, "parkCardId": parkLotCardId},
function (data) {
|
e80df919
atao
init
|
268
|
if ("8888" != data.code) {
|
1b8be02a
atao
修改购买卡时的费用
|
269
270
|
//$.alert("");
return false;
|
e80df919
atao
init
|
271
|
} else {
|
1b8be02a
atao
修改购买卡时的费用
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
if (data.data != null && data.data != '') {
$.confirm("亲!您已经办理该停车场卡,是否继续续费?", function () {
//点击确认后的回调函数
window.location.href = mUrl.renewView + "&custCardId=" + data.data;
}, function () {
window.location.href = mUrl.toParkInfoListView;
});
} else {
if (startDate == '' || startDate == null || startDate == undefined) {
$.toptip('亲!请选择开始时间', 3000, 'warning'); //设置显示时间
return false
} else {
var jsonInfo = {};
jsonInfo.carNum = carNum;
jsonInfo.parkLotCardId = parkLotCardId;
jsonInfo.buyNum = buyNum;
jsonInfo.startDate = startDate;
jsonInfo.endDate = endDate;
jsonInfo.totleMoney = totleMoney;
jsonInfo.orderType = 3;//
jsutil.defaultReq(
mUrl.createOrderInfo,
jsonInfo,
function (data) {
if ("8888" != data.code) {
$.alert("亲!创建订单失败,请重新尝试!");
return false;
} else {
window.location.href = mUrl.orderPayView + "&parkOrderId=" + data.data;
}
});
}
}//else
|
e80df919
atao
init
|
306
|
}
|
1b8be02a
atao
修改购买卡时的费用
|
307
|
});
|
e80df919
atao
init
|
308
309
|
|
1b8be02a
atao
修改购买卡时的费用
|
310
|
});
|
e80df919
atao
init
|
311
312
|
|
1b8be02a
atao
修改购买卡时的费用
|
313
|
})
|
e80df919
atao
init
|
314
315
316
|
</script>
</body>
</html>
|