暫無描述

pkgorder.jsp 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  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. <head>
  6. <meta charset="UTF-8" />
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
  9. <meta name="renderer" content="webkit">
  10. <meta http-equiv="Cache-Control" content="no-siteapp" />
  11. <meta name="applicable-device" content="mobile">
  12. <meta name="format-detection" content="telephone=no" />
  13. <meta http-equiv="title" content="" />
  14. <title>购买套餐</title>
  15. <meta name="description" content="" />
  16. <meta name="keywords" content="" />
  17. <link rel="stylesheet" href="/static/css/animate.min.css" type="text/css" media="all" />
  18. <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="all" />
  19. <link rel="stylesheet" href="/static/css/swiper-bundle.min.css" type="text/css" media="all" />
  20. <script language="javascript" type="text/javascript" src="/static/js/jquery-3.6.0.min.js"></script>
  21. <script language="javascript" type="text/javascript" src="/static/js/animate.min.js"></script>
  22. <script language="javascript" type="text/javascript" src="/static/js/main.js"></script>
  23. <script language="javascript" type="text/javascript" src="/static/js/swiper-bundle.min.js"></script>
  24. <script type="text/javascript" src="/static/js/ap.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. .cert-con{
  126. padding-bottom: 45px;
  127. margin-top: -5px;
  128. }
  129. .cert-title{
  130. width: 100%;
  131. text-align: center;
  132. font-size: 16px;
  133. color: #6160d7;
  134. font-weight: bold;
  135. padding-bottom: 20px;
  136. }
  137. .cert-desc{
  138. font-size: 12px;
  139. line-height: 2;
  140. padding-bottom: 10px;
  141. }
  142. .cert-desc em{
  143. color: #519fea;
  144. }
  145. .cert-desc span{
  146. color: #ffc801;
  147. }
  148. .cert-desc strong{
  149. font-size: 14px;
  150. color: #db0a05;
  151. }
  152. .cert-btn{
  153. position: absolute;
  154. left: 0;
  155. bottom: 0;
  156. display: flex;
  157. width: 100%;
  158. justify-content: space-between;
  159. }
  160. .cert-btn a{
  161. width: 50%;
  162. height: 45px;
  163. font-size: 14px;
  164. line-height: 45px;
  165. text-align: center;
  166. border-right: 1px solid #e5e5e5;
  167. border-top: 1px solid #e5e5e5;
  168. }
  169. .cert-btn a:last-child{
  170. border-right: none;
  171. color: #1987e8;
  172. }
  173. </style>
  174. </head>
  175. <body>
  176. <div class="box">
  177. <div class="recharge-top">
  178. <div class="pic">
  179. <img src="/static/img/img-recharge.png" alt="">
  180. </div>
  181. <div class="text">
  182. <div class="title">${pkgInfo.pkgName}</div>
  183. <div class="desc"></div>
  184. <div class="price">¥<strong id="price">${pkgInfo.price}</strong></div>
  185. </div>
  186. </div>
  187. </div>
  188. <c:if test="${showmemspkg==1}">
  189. <div class="box benefit-box">
  190. <div class="benefit-list swiper">
  191. <div class="swiper-wrapper">
  192. <c:forEach var="item" items="${spkgs}" varStatus="loop">
  193. <div class="item swiper-slide ${loop.index==0?' cur':''}" data-price="${item.price}" data-speedpackid="${item.id}">
  194. <div class="wrap">
  195. <i class="icon"><img src="/static/img/icon-diamond${item.id%2+1}.png"></i>
  196. <div class="title">${item.name}</div>
  197. <div class="desc">${item.desc}</div>
  198. <div class="price">¥<strong>${item.price}</strong></div>
  199. <div class="valid">有效期:
  200. <c:choose>
  201. <c:when test="${item.expiryDay == 0 }">1天</c:when>
  202. <c:when test="${item.expiryDay == 1 }">30天</c:when>
  203. <c:when test="${item.expiryDay == 2 }">90天</c:when>
  204. <c:when test="${item.expiryDay == 3 }">半年</c:when>
  205. <c:when test="${item.expiryDay == 4 }">1年</c:when>
  206. <c:when test="${item.expiryDay == 5 }">两年</c:when>
  207. <c:when test="${item.expiryDay == 6 }">7天</c:when>
  208. <c:when test="${item.expiryDay == 7 }">3年</c:when>
  209. <c:when test="${item.expiryDay == 8 }">3天</c:when>
  210. <c:when test="${item.expiryDay == 9 }">两天</c:when>
  211. <c:when test="${item.expiryDay == 11 }">7个月</c:when>
  212. <c:when test="${item.expiryDay == 12 }">14个月</c:when>
  213. <c:when test="${item.expiryDay == 18 }">15个月</c:when>
  214. <c:when test="${item.expiryDay == 19 }">18个月</c:when>
  215. <c:when test="${item.expiryDay == 13 }">两年半</c:when>
  216. <c:when test="${item.expiryDay == 14 }">3年8个月</c:when>
  217. <c:when test="${item.expiryDay == 15 }">4年 </c:when>
  218. <c:when test="${item.expiryDay == 16 }">5年</c:when>
  219. <c:when test="${item.expiryDay == 17 }">6年</c:when>
  220. </c:choose>
  221. </div>
  222. <div class="select"><i></i></div>
  223. </div>
  224. </div>
  225. </c:forEach>
  226. </div>
  227. </div>
  228. </div>
  229. </c:if>
  230. <div class="box">
  231. <div class="form-item">
  232. <label>充值设备号</label>
  233. <div class="form-text">${devid}</div>
  234. </div>
  235. <div class="form-item">
  236. <label>套餐有效期</label>
  237. <div class="form-text">
  238. <c:choose>
  239. <c:when test="${pkgInfo.expiryDay == 0 }">1天</c:when>
  240. <c:when test="${pkgInfo.expiryDay == 1 }">30天</c:when>
  241. <c:when test="${pkgInfo.expiryDay == 2 }">90天</c:when>
  242. <c:when test="${pkgInfo.expiryDay == 3 }">半年</c:when>
  243. <c:when test="${pkgInfo.expiryDay == 4 }">1年</c:when>
  244. <c:when test="${pkgInfo.expiryDay == 5 }">两年</c:when>
  245. <c:when test="${pkgInfo.expiryDay == 6 }">7天</c:when>
  246. <c:when test="${pkgInfo.expiryDay == 7 }">3年</c:when>
  247. <c:when test="${pkgInfo.expiryDay == 8 }">3天</c:when>
  248. <c:when test="${pkgInfo.expiryDay == 9 }">两天</c:when>
  249. <c:when test="${pkgInfo.expiryDay == 11 }">7个月</c:when>
  250. <c:when test="${pkgInfo.expiryDay == 12 }">14个月</c:when>
  251. <c:when test="${pkgInfo.expiryDay == 18 }">15个月</c:when>
  252. <c:when test="${pkgInfo.expiryDay == 19 }">18个月</c:when>
  253. <c:when test="${pkgInfo.expiryDay == 13 }">两年半</c:when>
  254. <c:when test="${pkgInfo.expiryDay == 14 }">3年8个月</c:when>
  255. <c:when test="${pkgInfo.expiryDay == 15 }">4年 </c:when>
  256. <c:when test="${pkgInfo.expiryDay == 16 }">5年</c:when>
  257. <c:when test="${pkgInfo.expiryDay == 17 }">6年</c:when>
  258. </c:choose>
  259. </div>
  260. </div>
  261. <div class="form-item">
  262. <label>全国通用</label>
  263. <div class="form-text">移动、联通、电信三网合一自由切换</div>
  264. </div>
  265. <div class="form-item">
  266. <label>套餐价格</label>
  267. <div class="form-text">¥${pkgInfo.price}</div>
  268. </div>
  269. <div class="form-item" onclick="ShowBox('PopCoupons')">
  270. <label>优惠券</label>
  271. <div class="form-text" id="coupons">选择优惠券</div>
  272. </div>
  273. </div>
  274. <div class="box mb70">
  275. <c:if test="${pkgInfo.paytype == 1}">
  276. <c:if test="${showmemspkg==1}">
  277. <div class="form-item">
  278. <div class="form-text">
  279. <img src="/static/img/icon-wallet.png" class="icon">
  280. <span>钱包特惠支付(余额:¥${balance})</span>
  281. </div>
  282. <div class="select">
  283. <input type="radio" name="pay" value="balance" class="redcheck" checked="checked">
  284. </div>
  285. </div>
  286. <div class="wallet-money show">
  287. <div class="swiper-container wallet-container">
  288. <div class="swiper-wrapper">
  289. <c:forEach var="item" items="${cons}">
  290. <div class="swiper-slide" data-id="${item.id}" data-jine="${item.jine}">
  291. <div class="sum">
  292. <i class="bar">赠送${item.zsong}元</i>
  293. <span>${item.jine}</span>
  294. </div>
  295. </div>
  296. </c:forEach>
  297. </div>
  298. </div>
  299. <div class="swiper-button-next"></div>
  300. <div class="swiper-button-prev"></div>
  301. <div style=" color: red;font-family: bold;display: none;" id="tips">当前余额不足支付购买,推荐勾选当前储值金额购买!</div>
  302. </div>
  303. </c:if>
  304. <div class="form-item">
  305. <div class="form-text">
  306. <img src="/static/img/icon-pay-alipay.png" class="icon">
  307. <span>支付宝支付</span>
  308. </div>
  309. <div class="select">
  310. <input type="radio" name="pay" value="alipay" class="redcheck">
  311. </div>
  312. </div>
  313. <c:if test="${noSupportWechatPay == 1}">
  314. <div class="form-item">
  315. <div class="form-text">
  316. <img src="/static/img/icon-pay-weixin.png" class="icon">
  317. <span>微信支付,请联系客服充值(08:00-23:00)</span>
  318. </div>
  319. <div class="select">
  320. <%-- <input type="radio" name="pay" value="wx" class="redcheck">--%>
  321. </div>
  322. </div>
  323. </c:if>
  324. <c:if test="${empty noSupportWechatPay or noSupportWechatPay != 1}">
  325. <div class="form-item">
  326. <div class="form-text">
  327. <img src="/static/img/icon-pay-weixin.png" class="icon">
  328. <span>微信支付</span>
  329. </div>
  330. <div class="select">
  331. <input type="radio" name="pay" value="wx" class="redcheck">
  332. </div>
  333. </div>
  334. </c:if>
  335. </c:if>
  336. <c:if test="${pkgInfo.paytype == 2}">
  337. <div class="form-item">
  338. <div class="form-text">
  339. <img src="/static/img/icon-pay-alipay.png" class="icon">
  340. <span>支付宝支付</span>
  341. </div>
  342. <div class="select">
  343. <input type="radio" name="pay" value="alipay" class="redcheck" checked>
  344. </div>
  345. </div>
  346. <c:if test="${noSupportWechatPay == 1}">
  347. <div class="form-item">
  348. <div class="form-text">
  349. <img src="/static/img/icon-pay-weixin.png" class="icon">
  350. <span>微信支付,请联系客服充值(08:00-23:00)</span>
  351. </div>
  352. <div class="select">
  353. <%-- <input type="radio" name="pay" value="wx" class="redcheck">--%>
  354. </div>
  355. </div>
  356. </c:if>
  357. <c:if test="${empty noSupportWechatPay or noSupportWechatPay != 1}">
  358. <div class="form-item">
  359. <div class="form-text">
  360. <img src="/static/img/icon-pay-weixin.png" class="icon">
  361. <span>微信支付</span>
  362. </div>
  363. <div class="select">
  364. <input type="radio" name="pay" value="wx" class="redcheck">
  365. </div>
  366. </div>
  367. </c:if>
  368. </c:if>
  369. <c:if test="${pkgInfo.paytype == 3}">
  370. <c:if test="${showmemspkg==1}">
  371. <div class="form-item">
  372. <div class="form-text">
  373. <img src="/static/img/icon-wallet.png" class="icon">
  374. <span>钱包特惠支付(余额:¥${balance})</span>
  375. </div>
  376. <div class="select">
  377. <input type="radio" name="pay" value="balance" class="redcheck" checked="checked">
  378. </div>
  379. </div>
  380. <div class="wallet-money show">
  381. <div class="swiper-container wallet-container">
  382. <div class="swiper-wrapper">
  383. <c:forEach var="item" items="${cons}">
  384. <div class="swiper-slide" data-id="${item.id}" data-jine="${item.jine}">
  385. <div class="sum">
  386. <i class="bar">赠送${item.zsong}元</i>
  387. <span>${item.jine}</span>
  388. </div>
  389. </div>
  390. </c:forEach>
  391. </div>
  392. </div>
  393. <div class="swiper-button-next"></div>
  394. <div class="swiper-button-prev"></div>
  395. </div>
  396. </c:if>
  397. </c:if>
  398. </div>
  399. <input type="hidden" id="usertotalbalance" value="${balance}"/>
  400. <form class="form_wrap" method="post" accept-charset="utf-8" action="/mifi/tosybpay.do">
  401. <div class="bottom-paybox">
  402. <div class="price">¥<strong id="total-price">${pkgInfo.price}</strong></div>
  403. <input type="hidden" name="pkgid" id="pkgid" value="${pkgInfo.pkgid}"/>
  404. <input type="hidden" name="amount" id="trxamt" value="${pkgInfo.price}"/>
  405. <input type="hidden" name="devid" id="devid" value="${devid}"/>
  406. <input type="hidden" name="type" id="type" value="1"/>
  407. <input type="hidden" name="paytype" id="paytype" value="0" />
  408. <c:if test="${showmemspkg==1}">
  409. <input type="hidden" name="speedpackid" id="speedpackid" value="${!empty spkgs?spkgs[0].id:''}"/>
  410. </c:if>
  411. <input type="hidden" id="pkgprice" name="pkgprice" value=""/>
  412. <input type="hidden" id="memberid" name="memberid" value=""/>
  413. <input type="hidden" id="opt" name="opt" value="${opt }"/>
  414. <input type="hidden" id="notify" name="notify" value=""/>
  415. <input type="hidden" id="outTradeNo" name="outTradeNo" value=""/>
  416. <input type="hidden" id="openid" name="openid" value="${openid}"/>
  417. <div class="pay-btn">
  418. <input type="button" class="btn" value="支付" />
  419. </div>
  420. </div>
  421. </form>
  422. <!--弹层-优惠券-->
  423. <div class='menu-mask' id="PopCoupons">
  424. <div class="popbox animated fadeInUp">
  425. <h2 class="tcenter">选择优惠券</h2>
  426. <div class="popbox-con">
  427. <div class="lite-card-select btn-coupons">
  428. <div class="list">
  429. <c:forEach var="item" items="${cons}">
  430. <div class="item">
  431. <div class="name" data="满${item.coupon}减${item.discount}" data-getprice="${item.coupon}" data-price="${item.discount}">满${item.coupon}减${item.discount}</div>
  432. <div class="allow"></div>
  433. </div>
  434. </c:forEach>
  435. </div>
  436. </div>
  437. </div>
  438. <div class="icon-close" onclick="CloseBox('PopCoupons')"></div>
  439. </div>
  440. </div>
  441. <div class="mask"></div>
  442. <!--当前卡未实名认证 弹层-->
  443. <div class='menu-mask' id="PopCertification" style="display: none;">
  444. <div class="popbox animated fadeInUp">
  445. <div class="popbox-con cert-con">
  446. <div class="cert-title">当前卡未实名认证</div>
  447. <div class="cert-desc">
  448. 根据工信部《入网用户真实身份信息登记规定》,您当前使用的流量卡或设备<em>需实名认证才可正常使用。</em><br>
  449. <span>实名认证开放时间:每日7:30-22:00<br>温馨提醒:实名认证需年满18周岁。请寻求监护人帮助或成年后再来哦!如已实名,可能会存在同步延时,请稍后再查看。</span><br>
  450. <strong>点击继续购买进入套餐充值页面,返回首页点击更多套餐,即可查看已购套餐。</strong>
  451. </div>
  452. <div class="cert-btn">
  453. <a href="javascript:" onclick="CloseBox('PopCertification');pay()">继续购买</a>
  454. <a href="/user/checksm.do">立即认证</a>
  455. </div>
  456. </div>
  457. </div>
  458. </div>
  459. <script>
  460. var mprice=888;
  461. var pkgprice=888;
  462. var ubalance;
  463. var thumbSwiper = new Swiper(".benefit-list", {
  464. spaceBetween: 10,
  465. slidesPerView: "auto",
  466. freeMode: true,
  467. watchSlidesProgress: true,
  468. });
  469. //钱包滑动
  470. var swiper = new Swiper(".wallet-container", {
  471. slidesPerGroup: 1,
  472. slidesPerView: 3,
  473. spaceBetween: 12,
  474. navigation: {
  475. nextEl: ".swiper-button-next",
  476. prevEl: ".swiper-button-prev",
  477. },
  478. });
  479. //选中
  480. $(".wallet-container .swiper-slide").click(function() {
  481. var obj = $(this);
  482. var isClicked = obj.hasClass("cur") ? true : false;
  483. $('.wallet-container .swiper-slide').removeClass('cur');
  484. isClicked ? null : obj.addClass("cur");
  485. if(obj.hasClass("cur")) {
  486. var mid = $(this).data("id");
  487. var mjine = $(this).data("jine");
  488. $("#memberid").val(mid);
  489. mprice=parseFloat(mjine).toFixed(2)||0;
  490. $("#total-price").html(mprice);
  491. } else {
  492. $("#memberid").val('');
  493. mprice=0;
  494. $("#total-price").html(pkgprice);
  495. }
  496. });
  497. $(".benefit-list .item").click(function() {
  498. var obj = $(this);
  499. var isClicked = obj.hasClass("cur") ? true : false;
  500. $(".benefit-list .item").removeClass("cur");
  501. isClicked ? null : obj.addClass("cur");
  502. calculateTotal(); // 统一调用计算总价函数
  503. $("#speedpackid").val(obj.hasClass("cur")?obj.data("speedpackid"):'');
  504. });
  505. $(".btn-coupons .item").click(function() {
  506. var obj = $(this);
  507. var isClicked = obj.hasClass("active") ? true : false;
  508. $(".btn-coupons .item").removeClass("active");
  509. isClicked ? null : obj.addClass("active");
  510. if (isClicked) {
  511. $("#coupons").text('选择优惠券');
  512. } else {
  513. $("#coupons").text($(this).find(".name").attr("data"));
  514. }
  515. var popCouponsElement = document.getElementById('PopCoupons');
  516. setTimeout(function() {
  517. if (popCouponsElement) {
  518. popCouponsElement.style.display = "none";
  519. }
  520. }, 500);
  521. calculateTotal(); // 统一调用计算总价函数
  522. });
  523. $(".redcheck").click(function() {
  524. var ptype = $(this).val();
  525. if(ptype == 'wx' || ptype == 'alipay'){
  526. $("#total-price").html(pkgprice);
  527. $(".wallet-money").hide();
  528. } else if(ptype == 'balance') {
  529. $("#total-price").html(mprice);
  530. $(".wallet-money").show();
  531. }
  532. });
  533. // 统一的总价计算函数
  534. function calculateTotal() {
  535. var productPrice = parseFloat($("#price").text()); // 商品价格
  536. var speedPackagePrice = 0; // 加速套餐价格
  537. var couponPrice = 0; // 优惠券金额
  538. var getPrice = 0; // 优惠券使用门槛
  539. // 获取选中的加速套餐价格
  540. if ($(".benefit-list .item.cur").length > 0) {
  541. speedPackagePrice = parseFloat($(".benefit-list .item.cur").attr("data-price"))||0;
  542. }
  543. // 获取选中的优惠券金额
  544. if ($("#PopCoupons .item.active").length > 0) {
  545. getPrice = parseFloat($("#PopCoupons .item.active .name").attr("data-getprice"))||0;
  546. couponPrice = parseFloat($("#PopCoupons .item.active .name").attr("data-price"))||0;
  547. // 检查是否满足优惠券使用条件
  548. var totalPriceBeforeCoupon = productPrice + speedPackagePrice;
  549. if (getPrice > totalPriceBeforeCoupon) {
  550. couponPrice = 0;
  551. }
  552. }
  553. // 计算总价:商品价格 + 加速套餐价格 - 优惠券金额
  554. var totalPrice = productPrice + speedPackagePrice - couponPrice;
  555. pkgprice=totalPrice;
  556. mprice=totalPrice;
  557. $("#total-price").html(totalPrice.toFixed(2));
  558. $("#trxamt").val(totalPrice.toFixed(2));
  559. if($(".redcheck:checked").val() == 'balance') {
  560. var usertotalbalance = parseFloat($("#usertotalbalance").val());
  561. ubalance=usertotalbalance;
  562. if(usertotalbalance >= pkgprice) {
  563. $(".wallet-money").hide();
  564. } else {
  565. $(".wallet-money").show();
  566. $(".wallet-container .swiper-slide").each(function(i) {
  567. var mjine = $(this).data("jine");
  568. var fmjine = parseFloat(mjine);
  569. if(fmjine>=pkgprice) {
  570. $(this).trigger("click");
  571. swiper.slideTo(i);
  572. $("#tips").show();
  573. }
  574. });
  575. }
  576. }
  577. }
  578. // 页面加载完成后初始化计算一次总价
  579. $(document).ready(function() {
  580. calculateTotal();
  581. // var isRequesting = false;
  582. $(".pay-btn").click(function(e){
  583. // if (isRequesting) return;
  584. // isRequesting = true;
  585. $(".mask").show();
  586. var param = {};
  587. param['devid'] = $('#devid').val();
  588. $.post('/device/getDevSMInfo.do',param,function(res){
  589. $('.mask').hide();
  590. if(typeof(res) === 'string'){
  591. res = JSON.parse(res);
  592. }
  593. var isrealname = false;
  594. for (var key in res) {
  595. if (res[key] === "已实名") {
  596. isrealname = true;
  597. }
  598. }
  599. if(!isrealname){
  600. ShowBox('PopCertification');
  601. } else {
  602. pay();
  603. }
  604. });
  605. });
  606. });
  607. function pay() {
  608. // if (isRequesting) return;
  609. // var isRequesting = true;
  610. $(".mask").show();
  611. var input = $('.form_wrap').find('input,select'), param = {};
  612. input.each(function(i,item){
  613. item = $(item);
  614. var vType = item.attr('vtype'), ind = 0;
  615. param[item.attr('name')] = item.val();
  616. //alert(item);
  617. });
  618. var paytype = $(".redcheck:checked").val();
  619. if(paytype == "alipay") {
  620. if (!navigator.userAgent.match(/MicroMessenger/i)) {
  621. alert("请使用微信访问!");
  622. $('.mask').hide();
  623. // isRequesting = false;
  624. return;
  625. }
  626. param['amount']=pkgprice;
  627. $.post('/mifi/toalipay.do',param,function(res){
  628. $('.mask').hide();
  629. if(typeof(res) === 'string'){
  630. res = JSON.parse(res);
  631. }
  632. if(res.status !== "200"){
  633. alert(res.msg);
  634. }else{
  635. // location.href = res.pay_info;
  636. _AP.pay(res.pay_info);
  637. return false;
  638. }
  639. // isRequesting = false;
  640. });
  641. } else if(paytype == "wx") {
  642. if (!navigator.userAgent.match(/MicroMessenger/i)) {
  643. alert("请使用微信访问!");
  644. $('.mask').hide();
  645. // isRequesting = false;
  646. return;
  647. }
  648. param['amount']=pkgprice;
  649. $("#trxamt").val(pkgprice);
  650. $("#type").val("1");
  651. // $('.form_wrap').submit();
  652. param['amount']=pkgprice;
  653. param['type']="1";
  654. $.post('/mifi/buyYLPdts.do',param,function(res){
  655. $('.mask').hide();
  656. if(typeof(res) === 'string'){
  657. res = JSON.parse(res);
  658. if(res.pay_info !== undefined) {
  659. var payInfo = JSON.parse(res.pay_info);
  660. }
  661. //alert(res.pay_info);
  662. }
  663. if(res.status !== "200"){
  664. alert(res.msg);
  665. }else{
  666. var payInfo = JSON.parse(res.pay_info);
  667. WeixinJSBridge.invoke(
  668. 'getBrandWCPayRequest',{
  669. "appId" : payInfo.appId, //公众号名称,由商户传入
  670. "timeStamp": payInfo.timeStamp, //戳,自1970 年以来的秒数
  671. "nonceStr" : payInfo.nonceStr, //随机串
  672. "package" : payInfo.package,
  673. "signType" : payInfo.signType, //微信签名方式:
  674. "paySign" : payInfo.paySign //微信签名,
  675. },function(res){
  676. if(res.err_msg == "get_brand_wcpay_request:ok" ) {
  677. // 此处可以使用此方式判断前端返回,微信团队郑重提示:res.err_msg 将在用户支付成功后返回ok,但并不保证它绝对可靠。
  678. location.href = "/result.html";
  679. }
  680. }
  681. );
  682. }
  683. // isRequesting = false;
  684. });
  685. } else if(paytype == "balance") {
  686. if(ubalance>=pkgprice) {
  687. param['amount']=pkgprice;
  688. $.post('/mifi/buyBalance.do',param,function(res){
  689. $('.mask').hide();
  690. if(res == 'OK'){
  691. alert("支付成功");
  692. location.href = "/device/getDevInfo.do?sn="+$("#devid").val();
  693. } else {
  694. alert(res);
  695. if(res == '用户余额不足!'){
  696. location.href = "/mifi/getMember.do";
  697. }
  698. }
  699. // isRequesting = false;
  700. },'json');
  701. } else {
  702. if (!navigator.userAgent.match(/MicroMessenger/i)) {
  703. alert("请使用微信访问!");
  704. $('.mask').hide();
  705. // isRequesting = false;
  706. return;
  707. }
  708. param['amount']=mprice;
  709. param['pkgprice']=pkgprice;
  710. if(isNaN(pkgprice)){
  711. location.reload();
  712. }
  713. param['type']=2;
  714. var memberid = $("#memberid").val();
  715. if(memberid==''||mprice==0){
  716. alert("请选择金额!");
  717. $('.mask').hide();
  718. // isRequesting = false;
  719. return;
  720. } else if(mprice<pkgprice){
  721. alert("金额不足,请重新选择金额!");
  722. $('.mask').hide();
  723. // isRequesting = false;
  724. return;
  725. } else {
  726. $.post('/mifi/toalipay.do',param,function(res){
  727. $('.mask').hide();
  728. if(typeof(res) === 'string'){
  729. res = JSON.parse(res);
  730. }
  731. if(res.status !== "200"){
  732. alert(res.msg);
  733. }else{
  734. // location.href = res.pay_info;
  735. _AP.pay(res.pay_info);
  736. return false;
  737. }
  738. // isRequesting = false;
  739. });
  740. }
  741. }
  742. } else {
  743. alert("请选择支付方式!");
  744. $('.mask').hide();
  745. // isRequesting = false;
  746. return;
  747. }
  748. }
  749. </script>
  750. </body>
  751. </html>