|
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+<%@ page language="java" pageEncoding="UTF-8"%>
|
|
|
2
|
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
|
3
|
+<!DOCTYPE html>
|
|
|
4
|
+<html>
|
|
|
5
|
+
|
|
|
6
|
+<head>
|
|
|
7
|
+ <meta charset="UTF-8" />
|
|
|
8
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
9
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
|
|
|
10
|
+ <meta name="renderer" content="webkit">
|
|
|
11
|
+ <meta http-equiv="Cache-Control" content="no-siteapp" />
|
|
|
12
|
+ <meta name="applicable-device" content="mobile">
|
|
|
13
|
+ <meta name="format-detection" content="telephone=no" />
|
|
|
14
|
+ <meta http-equiv="title" content="" />
|
|
|
15
|
+ <title>购买套餐</title>
|
|
|
16
|
+ <meta name="description" content="" />
|
|
|
17
|
+ <meta name="keywords" content="" />
|
|
|
18
|
+ <link rel="stylesheet" href="/static/css/animate.min.css" type="text/css" media="all" />
|
|
|
19
|
+ <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="all" />
|
|
|
20
|
+ <link rel="stylesheet" href="/static/css/swiper-bundle.min.css" type="text/css" media="all" />
|
|
|
21
|
+ <script language="javascript" type="text/javascript" src="/static/js/jquery-3.6.0.min.js"></script>
|
|
|
22
|
+ <script language="javascript" type="text/javascript" src="/static/js/animate.min.js"></script>
|
|
|
23
|
+ <script language="javascript" type="text/javascript" src="/static/js/main.js"></script>
|
|
|
24
|
+ <script language="javascript" type="text/javascript" src="/static/js/swiper-bundle.min.js"></script>
|
|
|
25
|
+ <style>
|
|
|
26
|
+ .form-wallet{
|
|
|
27
|
+ border-bottom: 1px solid #f0f0f0;
|
|
|
28
|
+ }
|
|
|
29
|
+ .form-wallet .form-item{
|
|
|
30
|
+ border-bottom: none;
|
|
|
31
|
+ }
|
|
|
32
|
+ .wallet-money{
|
|
|
33
|
+ display: none;
|
|
|
34
|
+ width: 100%;
|
|
|
35
|
+ padding: 2px 25px;
|
|
|
36
|
+ height:65px;
|
|
|
37
|
+ position: relative;
|
|
|
38
|
+ }
|
|
|
39
|
+ .wallet-money.show{
|
|
|
40
|
+ display: block;
|
|
|
41
|
+ }
|
|
|
42
|
+ .wallet-container{
|
|
|
43
|
+ display: block;
|
|
|
44
|
+ width: 100%;
|
|
|
45
|
+ min-height:45px;
|
|
|
46
|
+ position: relative;
|
|
|
47
|
+ list-style: none;
|
|
|
48
|
+ overflow: hidden;
|
|
|
49
|
+ z-index: 1;
|
|
|
50
|
+ }
|
|
|
51
|
+ .wallet-container .swiper-slide{
|
|
|
52
|
+ display: block;
|
|
|
53
|
+ width: 33.33%;
|
|
|
54
|
+ height: 45px;
|
|
|
55
|
+ position: relative;
|
|
|
56
|
+ border-radius: 8px;
|
|
|
57
|
+ overflow: hidden;
|
|
|
58
|
+ background-color: #FFFFFF;
|
|
|
59
|
+ border: 1px solid #e8e8e8;
|
|
|
60
|
+ }
|
|
|
61
|
+ .wallet-container .swiper-slide.cur{
|
|
|
62
|
+ border: 1px solid #cb5f1f;
|
|
|
63
|
+ }
|
|
|
64
|
+ .wallet-container .swiper-slide img{
|
|
|
65
|
+ display: block;
|
|
|
66
|
+ width: 100%;
|
|
|
67
|
+ max-height: auto;
|
|
|
68
|
+ }
|
|
|
69
|
+ .wallet-container .swiper-slide .sum{
|
|
|
70
|
+ position: relative;
|
|
|
71
|
+ display: block;
|
|
|
72
|
+ justify-content: center;
|
|
|
73
|
+ align-items: center;
|
|
|
74
|
+ width: 100%;
|
|
|
75
|
+ height: 100%;
|
|
|
76
|
+ font-size: 14px;
|
|
|
77
|
+ line-height: 2;
|
|
|
78
|
+ font-family: Arial;
|
|
|
79
|
+ font-weight: bold;
|
|
|
80
|
+ text-align: center;
|
|
|
81
|
+ padding-top: 0;
|
|
|
82
|
+ }
|
|
|
83
|
+ .wallet-container .swiper-slide .sum i{
|
|
|
84
|
+ display: block;
|
|
|
85
|
+ width: 100%;
|
|
|
86
|
+ font-size: 9px;
|
|
|
87
|
+ height: 15px;
|
|
|
88
|
+ line-height: 16px;
|
|
|
89
|
+ color: #FFF;
|
|
|
90
|
+ background-color: #dd170e;
|
|
|
91
|
+ }
|
|
|
92
|
+ .wallet-container .swiper-slide .sum::after{
|
|
|
93
|
+ content: '';
|
|
|
94
|
+ position: absolute;
|
|
|
95
|
+ top: 0;
|
|
|
96
|
+ left: 0;
|
|
|
97
|
+ display: none;
|
|
|
98
|
+ width: 100%;
|
|
|
99
|
+ height: 10px;
|
|
|
100
|
+ background-color: #dd170e;
|
|
|
101
|
+ }
|
|
|
102
|
+ .swiper-button-prev{
|
|
|
103
|
+ left: 0;
|
|
|
104
|
+ }
|
|
|
105
|
+ .swiper-button-next{
|
|
|
106
|
+ right: 0;
|
|
|
107
|
+ }
|
|
|
108
|
+ .swiper-button-prev,.swiper-button-next{
|
|
|
109
|
+ top: 17px;
|
|
|
110
|
+ margin-top: 0;
|
|
|
111
|
+ width: 15px;
|
|
|
112
|
+ height: 15px;
|
|
|
113
|
+ opacity: 0.6;
|
|
|
114
|
+ }
|
|
|
115
|
+ .swiper-button-disabled{
|
|
|
116
|
+ opacity: 0.2;
|
|
|
117
|
+ }
|
|
|
118
|
+ .swiper-button-next:after,.swiper-button-prev:after{
|
|
|
119
|
+ color: #929292;
|
|
|
120
|
+ font-size: 18px;
|
|
|
121
|
+ }
|
|
|
122
|
+ .swiper-button-next:hover:after,.swiper-button-prev:hover:after{
|
|
|
123
|
+ color: #FF6600;
|
|
|
124
|
+ }
|
|
|
125
|
+ </style>
|
|
|
126
|
+</head>
|
|
|
127
|
+
|
|
|
128
|
+<body>
|
|
|
129
|
+<div class="box">
|
|
|
130
|
+ <div class="recharge-top">
|
|
|
131
|
+ <div class="pic">
|
|
|
132
|
+ <img src="/static/img/img-recharge.png" alt="">
|
|
|
133
|
+ </div>
|
|
|
134
|
+ <div class="text">
|
|
|
135
|
+ <div class="title">${pkgInfo.pkgName}</div>
|
|
|
136
|
+ <div class="desc"></div>
|
|
|
137
|
+ <div class="price">¥<strong id="price">${pkgInfo.price}</strong></div>
|
|
|
138
|
+ </div>
|
|
|
139
|
+ </div>
|
|
|
140
|
+</div>
|
|
|
141
|
+<div class="box benefit-box">
|
|
|
142
|
+ <div class="benefit-list swiper">
|
|
|
143
|
+ <div class="swiper-wrapper">
|
|
|
144
|
+ <c:forEach var="item" items="${spkgs}" varStatus="loop">
|
|
|
145
|
+ <div class="item swiper-slide ${loop.index==0?' cur':''}" data-price="${item.price}" data-speedpackid="${item.id}">
|
|
|
146
|
+ <div class="wrap">
|
|
|
147
|
+ <i class="icon"><img src="/static/img/icon-diamond${item.id%2+1}.png"></i>
|
|
|
148
|
+ <div class="title">${item.name}</div>
|
|
|
149
|
+ <div class="desc">${item.desc}</div>
|
|
|
150
|
+ <div class="price">¥<strong>${item.price}</strong></div>
|
|
|
151
|
+ <div class="valid">有效期:
|
|
|
152
|
+ <c:choose>
|
|
|
153
|
+ <c:when test="${item.expiryDay == 0 }">1天</c:when>
|
|
|
154
|
+ <c:when test="${item.expiryDay == 1 }">30天</c:when>
|
|
|
155
|
+ <c:when test="${item.expiryDay == 2 }">90天</c:when>
|
|
|
156
|
+ <c:when test="${item.expiryDay == 3 }">半年</c:when>
|
|
|
157
|
+ <c:when test="${item.expiryDay == 4 }">1年</c:when>
|
|
|
158
|
+ <c:when test="${item.expiryDay == 5 }">两年</c:when>
|
|
|
159
|
+ <c:when test="${item.expiryDay == 6 }">7天</c:when>
|
|
|
160
|
+ <c:when test="${item.expiryDay == 7 }">3年</c:when>
|
|
|
161
|
+ <c:when test="${item.expiryDay == 8 }">3天</c:when>
|
|
|
162
|
+ <c:when test="${item.expiryDay == 9 }">两天</c:when>
|
|
|
163
|
+ <c:when test="${item.expiryDay == 11 }">7个月</c:when>
|
|
|
164
|
+ <c:when test="${item.expiryDay == 12 }">14个月</c:when>
|
|
|
165
|
+ <c:when test="${item.expiryDay == 18 }">15个月</c:when>
|
|
|
166
|
+ <c:when test="${item.expiryDay == 13 }">两年半</c:when>
|
|
|
167
|
+ <c:when test="${item.expiryDay == 14 }">3年8个月</c:when>
|
|
|
168
|
+ <c:when test="${item.expiryDay == 15 }">4年 </c:when>
|
|
|
169
|
+ <c:when test="${item.expiryDay == 16 }">5年</c:when>
|
|
|
170
|
+ <c:when test="${item.expiryDay == 17 }">6年</c:when>
|
|
|
171
|
+ </c:choose>
|
|
|
172
|
+ </div>
|
|
|
173
|
+ <div class="select"><i></i></div>
|
|
|
174
|
+ </div>
|
|
|
175
|
+ </div>
|
|
|
176
|
+ </c:forEach>
|
|
|
177
|
+ </div>
|
|
|
178
|
+ </div>
|
|
|
179
|
+</div>
|
|
|
180
|
+<div class="box">
|
|
|
181
|
+ <div class="form-item">
|
|
|
182
|
+ <label>充值设备号</label>
|
|
|
183
|
+ <div class="form-text">${devid}</div>
|
|
|
184
|
+ </div>
|
|
|
185
|
+ <div class="form-item">
|
|
|
186
|
+ <label>套餐有效期</label>
|
|
|
187
|
+ <div class="form-text">
|
|
|
188
|
+ <c:choose>
|
|
|
189
|
+ <c:when test="${pkgInfo.expiryDay == 0 }">1天</c:when>
|
|
|
190
|
+ <c:when test="${pkgInfo.expiryDay == 1 }">30天</c:when>
|
|
|
191
|
+ <c:when test="${pkgInfo.expiryDay == 2 }">90天</c:when>
|
|
|
192
|
+ <c:when test="${pkgInfo.expiryDay == 3 }">半年</c:when>
|
|
|
193
|
+ <c:when test="${pkgInfo.expiryDay == 4 }">1年</c:when>
|
|
|
194
|
+ <c:when test="${pkgInfo.expiryDay == 5 }">两年</c:when>
|
|
|
195
|
+ <c:when test="${pkgInfo.expiryDay == 6 }">7天</c:when>
|
|
|
196
|
+ <c:when test="${pkgInfo.expiryDay == 7 }">3年</c:when>
|
|
|
197
|
+ <c:when test="${pkgInfo.expiryDay == 8 }">3天</c:when>
|
|
|
198
|
+ <c:when test="${pkgInfo.expiryDay == 9 }">两天</c:when>
|
|
|
199
|
+ <c:when test="${pkgInfo.expiryDay == 11 }">7个月</c:when>
|
|
|
200
|
+ <c:when test="${pkgInfo.expiryDay == 12 }">14个月</c:when>
|
|
|
201
|
+ <c:when test="${pkgInfo.expiryDay == 18 }">15个月</c:when>
|
|
|
202
|
+ <c:when test="${pkgInfo.expiryDay == 13 }">两年半</c:when>
|
|
|
203
|
+ <c:when test="${pkgInfo.expiryDay == 14 }">3年8个月</c:when>
|
|
|
204
|
+ <c:when test="${pkgInfo.expiryDay == 15 }">4年 </c:when>
|
|
|
205
|
+ <c:when test="${pkgInfo.expiryDay == 16 }">5年</c:when>
|
|
|
206
|
+ <c:when test="${pkgInfo.expiryDay == 17 }">6年</c:when>
|
|
|
207
|
+ </c:choose>
|
|
|
208
|
+ </div>
|
|
|
209
|
+ </div>
|
|
|
210
|
+ <div class="form-item">
|
|
|
211
|
+ <label>全国通用</label>
|
|
|
212
|
+ <div class="form-text">移动、联通、电信三网合一自由切换</div>
|
|
|
213
|
+ </div>
|
|
|
214
|
+ <div class="form-item">
|
|
|
215
|
+ <label>套餐价格</label>
|
|
|
216
|
+ <div class="form-text">¥${pkgInfo.price}</div>
|
|
|
217
|
+ </div>
|
|
|
218
|
+ <div class="form-item" onclick="ShowBox('PopCoupons')">
|
|
|
219
|
+ <label>优惠券</label>
|
|
|
220
|
+ <div class="form-text" id="coupons">选择优惠券</div>
|
|
|
221
|
+ </div>
|
|
|
222
|
+</div>
|
|
|
223
|
+<div class="box mb70">
|
|
|
224
|
+ <c:if test="${pkgInfo.paytype == 1}">
|
|
|
225
|
+ <div class="form-item">
|
|
|
226
|
+ <div class="form-text">
|
|
|
227
|
+ <img src="/static/img/icon-wallet.png" class="icon">
|
|
|
228
|
+ <span>钱包特惠支付(余额:¥${balance})</span>
|
|
|
229
|
+ </div>
|
|
|
230
|
+ <div class="select">
|
|
|
231
|
+ <input type="radio" name="pay" value="balance" class="redcheck" id="pay">
|
|
|
232
|
+ </div>
|
|
|
233
|
+ </div>
|
|
|
234
|
+ <div class="wallet-money show">
|
|
|
235
|
+ <div class="swiper-container wallet-container">
|
|
|
236
|
+ <div class="swiper-wrapper">
|
|
|
237
|
+ <c:forEach var="item" items="${cons}">
|
|
|
238
|
+ <div class="swiper-slide" data-id="${item.id}" data-jine="${item.jine}">
|
|
|
239
|
+ <div class="sum">
|
|
|
240
|
+ <i class="bar">赠送${item.zsong}元</i>
|
|
|
241
|
+ <span>${item.jine}</span>
|
|
|
242
|
+ </div>
|
|
|
243
|
+ </div>
|
|
|
244
|
+ </c:forEach>
|
|
|
245
|
+ </div>
|
|
|
246
|
+ </div>
|
|
|
247
|
+ <div class="swiper-button-next"></div>
|
|
|
248
|
+ <div class="swiper-button-prev"></div>
|
|
|
249
|
+ </div>
|
|
|
250
|
+ <div class="form-item">
|
|
|
251
|
+ <div class="form-text">
|
|
|
252
|
+ <img src="/static/img/icon-pay-alipay.png" class="icon">
|
|
|
253
|
+ <span>支付宝支付</span>
|
|
|
254
|
+ </div>
|
|
|
255
|
+ <div class="select">
|
|
|
256
|
+ <input type="radio" name="pay" value="alipay" class="redcheck" id="pay">
|
|
|
257
|
+ </div>
|
|
|
258
|
+ </div>
|
|
|
259
|
+ <div class="form-item">
|
|
|
260
|
+ <div class="form-text">
|
|
|
261
|
+ <img src="/static/img/icon-pay-weixin.png" class="icon">
|
|
|
262
|
+ <span>微信支付,请联系在线客服充值</span>
|
|
|
263
|
+ </div>
|
|
|
264
|
+ <div class="select">
|
|
|
265
|
+
|
|
|
266
|
+ </div>
|
|
|
267
|
+ </div>
|
|
|
268
|
+ </c:if>
|
|
|
269
|
+ <c:if test="${pkgInfo.paytype == 2}">
|
|
|
270
|
+ <div class="form-item">
|
|
|
271
|
+ <div class="form-text">
|
|
|
272
|
+ <img src="/static/img/icon-pay-alipay.png" class="icon">
|
|
|
273
|
+ <span>支付宝支付</span>
|
|
|
274
|
+ </div>
|
|
|
275
|
+ <div class="select">
|
|
|
276
|
+ <input type="radio" name="pay" value="alipay" class="redcheck" id="pay">
|
|
|
277
|
+ </div>
|
|
|
278
|
+ </div>
|
|
|
279
|
+ <div class="form-item">
|
|
|
280
|
+ <div class="form-text">
|
|
|
281
|
+ <img src="/static/img/icon-pay-weixin.png" class="icon">
|
|
|
282
|
+ <span>微信支付,请联系在线客服充值</span>
|
|
|
283
|
+ </div>
|
|
|
284
|
+ <div class="select">
|
|
|
285
|
+
|
|
|
286
|
+ </div>
|
|
|
287
|
+ </div>
|
|
|
288
|
+ </c:if>
|
|
|
289
|
+ <c:if test="${pkgInfo.paytype == 3}">
|
|
|
290
|
+ <div class="form-item">
|
|
|
291
|
+ <div class="form-text">
|
|
|
292
|
+ <img src="/static/img/icon-wallet.png" class="icon">
|
|
|
293
|
+ <span>钱包特惠支付(余额:¥${balance})</span>
|
|
|
294
|
+ </div>
|
|
|
295
|
+ <div class="select">
|
|
|
296
|
+ <input type="radio" name="pay" value="balance" class="redcheck" id="pay">
|
|
|
297
|
+ </div>
|
|
|
298
|
+ </div>
|
|
|
299
|
+ <div class="wallet-money show">
|
|
|
300
|
+ <div class="swiper-container wallet-container">
|
|
|
301
|
+ <div class="swiper-wrapper">
|
|
|
302
|
+ <c:forEach var="item" items="${cons}">
|
|
|
303
|
+ <div class="swiper-slide" data-id="${item.id}" data-jine="${item.jine}">
|
|
|
304
|
+ <div class="sum">
|
|
|
305
|
+ <i class="bar">赠送${item.zsong}元</i>
|
|
|
306
|
+ <span>${item.jine}</span>
|
|
|
307
|
+ </div>
|
|
|
308
|
+ </div>
|
|
|
309
|
+ </c:forEach>
|
|
|
310
|
+ </div>
|
|
|
311
|
+ </div>
|
|
|
312
|
+ <div class="swiper-button-next"></div>
|
|
|
313
|
+ <div class="swiper-button-prev"></div>
|
|
|
314
|
+ </div>
|
|
|
315
|
+ </c:if>
|
|
|
316
|
+</div>
|
|
|
317
|
+
|
|
|
318
|
+<input type="hidden" id="usertotalbalance" value="${balance}"/>
|
|
|
319
|
+
|
|
|
320
|
+<form class="form_wrap" method="post" accept-charset="utf-8">
|
|
|
321
|
+<div class="bottom-paybox">
|
|
|
322
|
+ <div class="price">¥<strong id="total-price">${pkgInfo.price}</strong></div>
|
|
|
323
|
+ <input type="hidden" name="pkgid" id="pkgid" value="${pkgInfo.pkgid}"/>
|
|
|
324
|
+ <input type="hidden" name="amount" id="trxamt" value="${pkgInfo.price}"/>
|
|
|
325
|
+ <input type="hidden" name="devid" id="devid" value="${devid}"/>
|
|
|
326
|
+ <input type="hidden" name="type" id="type" value="1"/>
|
|
|
327
|
+ <input type="hidden" name="paytype" id="paytype" value="0" />
|
|
|
328
|
+ <input type="hidden" name="speedpackid" id="speedpackid" value="${!empty spkgs?spkgs[0].id:''}"/>
|
|
|
329
|
+
|
|
|
330
|
+ <input type="hidden" id="pkgprice" name="pkgprice" value=""/>
|
|
|
331
|
+ <input type="hidden" id="memberid" name="memberid" value=""/>
|
|
|
332
|
+ <input type="hidden" id="opt" name="opt" value="${opt }"/>
|
|
|
333
|
+ <div class="pay-btn">
|
|
|
334
|
+ <input type="button" class="btn" value="支付" />
|
|
|
335
|
+ </div>
|
|
|
336
|
+</div>
|
|
|
337
|
+</form>
|
|
|
338
|
+<!--弹层-优惠券-->
|
|
|
339
|
+<div class='menu-mask' id="PopCoupons">
|
|
|
340
|
+ <div class="popbox animated fadeInUp">
|
|
|
341
|
+ <h2 class="tcenter">选择优惠券</h2>
|
|
|
342
|
+ <div class="popbox-con">
|
|
|
343
|
+ <div class="lite-card-select btn-coupons">
|
|
|
344
|
+ <div class="list">
|
|
|
345
|
+ <c:forEach var="item" items="${cons}">
|
|
|
346
|
+ <div class="item">
|
|
|
347
|
+ <div class="name" data="满${item.coupon}减${item.discount}" data-getprice="${item.coupon}" data-price="${item.discount}">满${item.coupon}减${item.discount}</div>
|
|
|
348
|
+ <div class="allow"></div>
|
|
|
349
|
+ </div>
|
|
|
350
|
+ </c:forEach>
|
|
|
351
|
+ </div>
|
|
|
352
|
+ </div>
|
|
|
353
|
+ </div>
|
|
|
354
|
+ <div class="icon-close" onclick="CloseBox('PopCoupons')"></div>
|
|
|
355
|
+ </div>
|
|
|
356
|
+</div>
|
|
|
357
|
+<div class="mask"></div>
|
|
|
358
|
+<script>
|
|
|
359
|
+
|
|
|
360
|
+ var mprice=888;
|
|
|
361
|
+ var pkgprice=888;
|
|
|
362
|
+ var ubalance;
|
|
|
363
|
+
|
|
|
364
|
+ var thumbSwiper = new Swiper(".benefit-list", {
|
|
|
365
|
+ spaceBetween: 10,
|
|
|
366
|
+ slidesPerView: "auto",
|
|
|
367
|
+ freeMode: true,
|
|
|
368
|
+ watchSlidesProgress: true,
|
|
|
369
|
+ });
|
|
|
370
|
+ //钱包滑动
|
|
|
371
|
+ var swiper = new Swiper(".wallet-container", {
|
|
|
372
|
+ slidesPerGroup: 1,
|
|
|
373
|
+ slidesPerView: 3,
|
|
|
374
|
+ spaceBetween: 12,
|
|
|
375
|
+ navigation: {
|
|
|
376
|
+ nextEl: ".swiper-button-next",
|
|
|
377
|
+ prevEl: ".swiper-button-prev",
|
|
|
378
|
+ },
|
|
|
379
|
+ });
|
|
|
380
|
+ //选中
|
|
|
381
|
+ $(".wallet-container .swiper-slide").click(function() {
|
|
|
382
|
+ var obj = $(this);
|
|
|
383
|
+ var isClicked = obj.hasClass("cur") ? true : false;
|
|
|
384
|
+ $('.wallet-container .swiper-slide').removeClass('cur');
|
|
|
385
|
+ isClicked ? null : obj.addClass("cur");
|
|
|
386
|
+ if(obj.hasClass("cur")) {
|
|
|
387
|
+ var mid = $(this).data("id");
|
|
|
388
|
+ var mjine = $(this).data("jine");
|
|
|
389
|
+ $("#memberid").val(mid);
|
|
|
390
|
+ mprice=parseFloat(mjine).toFixed(2)||0;
|
|
|
391
|
+ $("#total-price").html(mprice);
|
|
|
392
|
+ } else {
|
|
|
393
|
+ $("#memberid").val('');
|
|
|
394
|
+ mprice=0;
|
|
|
395
|
+ $("#total-price").html(pkgprice);
|
|
|
396
|
+ }
|
|
|
397
|
+
|
|
|
398
|
+ });
|
|
|
399
|
+ $(".benefit-list .item").click(function() {
|
|
|
400
|
+ var obj = $(this);
|
|
|
401
|
+ var isClicked = obj.hasClass("cur") ? true : false;
|
|
|
402
|
+ $(".benefit-list .item").removeClass("cur");
|
|
|
403
|
+ isClicked ? null : obj.addClass("cur");
|
|
|
404
|
+ calculateTotal(); // 统一调用计算总价函数
|
|
|
405
|
+ $("#speedpackid").val(obj.hasClass("cur")?obj.data("speedpackid"):'');
|
|
|
406
|
+ });
|
|
|
407
|
+
|
|
|
408
|
+ $(".btn-coupons .item").click(function() {
|
|
|
409
|
+ var obj = $(this);
|
|
|
410
|
+ var isClicked = obj.hasClass("active") ? true : false;
|
|
|
411
|
+ $(".btn-coupons .item").removeClass("active");
|
|
|
412
|
+ isClicked ? null : obj.addClass("active");
|
|
|
413
|
+ if (isClicked) {
|
|
|
414
|
+ $("#coupons").text('选择优惠券');
|
|
|
415
|
+ } else {
|
|
|
416
|
+ $("#coupons").text($(this).find(".name").attr("data"));
|
|
|
417
|
+ }
|
|
|
418
|
+ var popCouponsElement = document.getElementById('PopCoupons');
|
|
|
419
|
+ setTimeout(function() {
|
|
|
420
|
+ if (popCouponsElement) {
|
|
|
421
|
+ popCouponsElement.style.display = "none";
|
|
|
422
|
+ }
|
|
|
423
|
+ }, 500);
|
|
|
424
|
+ calculateTotal(); // 统一调用计算总价函数
|
|
|
425
|
+ });
|
|
|
426
|
+
|
|
|
427
|
+ $(".redcheck").click(function() {
|
|
|
428
|
+ var ptype = $(this).val();
|
|
|
429
|
+ if(ptype == 'wx'){
|
|
|
430
|
+ $("#total-price").html(pkgprice);
|
|
|
431
|
+ $(".wallet-money").hide();
|
|
|
432
|
+ } else if(ptype == 'balance') {
|
|
|
433
|
+ $("#total-price").html(mprice);
|
|
|
434
|
+ $(".wallet-money").show();
|
|
|
435
|
+ }
|
|
|
436
|
+ });
|
|
|
437
|
+
|
|
|
438
|
+
|
|
|
439
|
+ // 统一的总价计算函数
|
|
|
440
|
+ function calculateTotal() {
|
|
|
441
|
+ var productPrice = parseFloat($("#price").text()); // 商品价格
|
|
|
442
|
+ var speedPackagePrice = 0; // 加速套餐价格
|
|
|
443
|
+ var couponPrice = 0; // 优惠券金额
|
|
|
444
|
+ var getPrice = 0; // 优惠券使用门槛
|
|
|
445
|
+
|
|
|
446
|
+ // 获取选中的加速套餐价格
|
|
|
447
|
+ if ($(".benefit-list .item.cur").length > 0) {
|
|
|
448
|
+ speedPackagePrice = parseFloat($(".benefit-list .item.cur").attr("data-price"))||0;
|
|
|
449
|
+ }
|
|
|
450
|
+
|
|
|
451
|
+ // 获取选中的优惠券金额
|
|
|
452
|
+ if ($("#PopCoupons .item.active").length > 0) {
|
|
|
453
|
+ getPrice = parseFloat($("#PopCoupons .item.active .name").attr("data-getprice"))||0;
|
|
|
454
|
+ couponPrice = parseFloat($("#PopCoupons .item.active .name").attr("data-price"))||0;
|
|
|
455
|
+
|
|
|
456
|
+ // 检查是否满足优惠券使用条件
|
|
|
457
|
+ var totalPriceBeforeCoupon = productPrice + speedPackagePrice;
|
|
|
458
|
+ if (getPrice > totalPriceBeforeCoupon) {
|
|
|
459
|
+ couponPrice = 0;
|
|
|
460
|
+ }
|
|
|
461
|
+ }
|
|
|
462
|
+
|
|
|
463
|
+ // 计算总价:商品价格 + 加速套餐价格 - 优惠券金额
|
|
|
464
|
+ var totalPrice = productPrice + speedPackagePrice - couponPrice;
|
|
|
465
|
+ pkgprice=totalPrice;
|
|
|
466
|
+ mprice=totalPrice;
|
|
|
467
|
+ $("#total-price").html(totalPrice.toFixed(2));
|
|
|
468
|
+ $("#trxamt").val(totalPrice.toFixed(2));
|
|
|
469
|
+
|
|
|
470
|
+ if($(".redcheck:checked").val() == 'balance') {
|
|
|
471
|
+ var usertotalbalance = parseFloat($("#usertotalbalance").val());
|
|
|
472
|
+ ubalance=usertotalbalance;
|
|
|
473
|
+ if(usertotalbalance >= pkgprice) {
|
|
|
474
|
+ $(".wallet-money").hide();
|
|
|
475
|
+ } else {
|
|
|
476
|
+ $(".wallet-money").show();
|
|
|
477
|
+ $(".wallet-container .swiper-slide").each(function(i) {
|
|
|
478
|
+ var mjine = $(this).data("jine");
|
|
|
479
|
+ var fmjine = parseFloat(mjine);
|
|
|
480
|
+ if(fmjine>=pkgprice) {
|
|
|
481
|
+ $(this).trigger("click");
|
|
|
482
|
+ swiper.slideTo(i);
|
|
|
483
|
+ }
|
|
|
484
|
+ });
|
|
|
485
|
+ }
|
|
|
486
|
+ }
|
|
|
487
|
+ }
|
|
|
488
|
+
|
|
|
489
|
+ // 页面加载完成后初始化计算一次总价
|
|
|
490
|
+ $(document).ready(function() {
|
|
|
491
|
+ calculateTotal();
|
|
|
492
|
+
|
|
|
493
|
+ var isRequesting = false;
|
|
|
494
|
+ $(".pay-btn").click(function(e){
|
|
|
495
|
+ if (isRequesting) return;
|
|
|
496
|
+ isRequesting = true;
|
|
|
497
|
+ $(".mask").show();
|
|
|
498
|
+
|
|
|
499
|
+ var input = $('.form_wrap').find('input,select'), param = {};
|
|
|
500
|
+ input.each(function(i,item){
|
|
|
501
|
+ item = $(item);
|
|
|
502
|
+ var vType = item.attr('vtype'), ind = 0;
|
|
|
503
|
+ param[item.attr('name')] = item.val();
|
|
|
504
|
+ //alert(item);
|
|
|
505
|
+ });
|
|
|
506
|
+ var paytype = $(".redcheck:checked").val();
|
|
|
507
|
+ if(paytype == "alipay") {
|
|
|
508
|
+ if (!navigator.userAgent.match(/MicroMessenger/i)) {
|
|
|
509
|
+ alert("请使用微信访问!");
|
|
|
510
|
+ $('.mask').hide();
|
|
|
511
|
+ isRequesting = false;
|
|
|
512
|
+ return;
|
|
|
513
|
+ }
|
|
|
514
|
+ param['amount']=pkgprice;
|
|
|
515
|
+ $.post('/mifi/toalipay.do',param,function(res){
|
|
|
516
|
+ $('.mask').hide();
|
|
|
517
|
+ if(typeof(res) === 'string'){
|
|
|
518
|
+ res = JSON.parse(res);
|
|
|
519
|
+ }
|
|
|
520
|
+
|
|
|
521
|
+ if(res.status !== "200"){
|
|
|
522
|
+ alert(res.msg);
|
|
|
523
|
+ }else{
|
|
|
524
|
+ location.href = res.pay_info;
|
|
|
525
|
+ }
|
|
|
526
|
+ isRequesting = false;
|
|
|
527
|
+ });
|
|
|
528
|
+ } else if(paytype == "balance") {
|
|
|
529
|
+ if(ubalance>=pkgprice) {
|
|
|
530
|
+ param['amount']=pkgprice;
|
|
|
531
|
+ $.post('/mifi/buyBalance.do',param,function(res){
|
|
|
532
|
+ $('.mask').hide();
|
|
|
533
|
+ if(res == 'OK'){
|
|
|
534
|
+ alert("支付成功");
|
|
|
535
|
+ location.href = "/device/getDevInfo.do?sn="+$("#devid").val();
|
|
|
536
|
+ } else {
|
|
|
537
|
+ alert(res);
|
|
|
538
|
+ if(res == '用户余额不足!'){
|
|
|
539
|
+ location.href = "/mifi/getMember.do";
|
|
|
540
|
+ }
|
|
|
541
|
+ }
|
|
|
542
|
+ isRequesting = false;
|
|
|
543
|
+ },'json');
|
|
|
544
|
+ } else {
|
|
|
545
|
+ if (!navigator.userAgent.match(/MicroMessenger/i)) {
|
|
|
546
|
+ alert("请使用微信访问!");
|
|
|
547
|
+ $('.mask').hide();
|
|
|
548
|
+ isRequesting = false;
|
|
|
549
|
+ return;
|
|
|
550
|
+ }
|
|
|
551
|
+ param['amount']=mprice;
|
|
|
552
|
+ param['pkgprice']=pkgprice;
|
|
|
553
|
+ if(isNaN(pkgprice)){
|
|
|
554
|
+ location.reload();
|
|
|
555
|
+ }
|
|
|
556
|
+ param['type']=2;
|
|
|
557
|
+ var memberid = $("#memberid").val();
|
|
|
558
|
+ if(memberid==''||mprice==0){
|
|
|
559
|
+ alert("请选择金额!");
|
|
|
560
|
+ $('.mask').hide();
|
|
|
561
|
+ isRequesting = false;
|
|
|
562
|
+ return;
|
|
|
563
|
+ } else if(mprice<pkgprice){
|
|
|
564
|
+ alert("金额不足,请重新选择金额!");
|
|
|
565
|
+ $('.mask').hide();
|
|
|
566
|
+ isRequesting = false;
|
|
|
567
|
+ return;
|
|
|
568
|
+ } else {
|
|
|
569
|
+ $.post('/mifi/toalipay.do',param,function(res){
|
|
|
570
|
+ $('.mask').hide();
|
|
|
571
|
+ if(typeof(res) === 'string'){
|
|
|
572
|
+ res = JSON.parse(res);
|
|
|
573
|
+ }
|
|
|
574
|
+
|
|
|
575
|
+ if(res.status !== "200"){
|
|
|
576
|
+ alert(res.msg);
|
|
|
577
|
+ }else{
|
|
|
578
|
+ location.href = res.pay_info;
|
|
|
579
|
+ }
|
|
|
580
|
+ isRequesting = false;
|
|
|
581
|
+ });
|
|
|
582
|
+ }
|
|
|
583
|
+ }
|
|
|
584
|
+ } else if(paytype == "wx"){
|
|
|
585
|
+ alert("请联系在线客服充值!");
|
|
|
586
|
+ $('.mask').hide();
|
|
|
587
|
+ isRequesting = false;
|
|
|
588
|
+ return;
|
|
|
589
|
+ } else {
|
|
|
590
|
+ alert("请选择支付方式!");
|
|
|
591
|
+ $('.mask').hide();
|
|
|
592
|
+ isRequesting = false;
|
|
|
593
|
+ return;
|
|
|
594
|
+ }
|
|
|
595
|
+
|
|
|
596
|
+
|
|
|
597
|
+ });
|
|
|
598
|
+ });
|
|
|
599
|
+</script>
|
|
|
600
|
+
|
|
|
601
|
+</body>
|
|
|
602
|
+</html>
|