Aucune description

testwx.jsp 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. <style>
  25. .form-wallet{
  26. border-bottom: 1px solid #f0f0f0;
  27. }
  28. .form-wallet .form-item{
  29. border-bottom: none;
  30. }
  31. .wallet-money{
  32. display: none;
  33. width: 100%;
  34. padding: 2px 25px;
  35. height:65px;
  36. position: relative;
  37. }
  38. .wallet-money.show{
  39. display: block;
  40. }
  41. .wallet-container{
  42. display: block;
  43. width: 100%;
  44. min-height:45px;
  45. position: relative;
  46. list-style: none;
  47. overflow: hidden;
  48. z-index: 1;
  49. }
  50. .wallet-container .swiper-slide{
  51. display: block;
  52. width: 33.33%;
  53. height: 45px;
  54. position: relative;
  55. border-radius: 8px;
  56. overflow: hidden;
  57. background-color: #FFFFFF;
  58. border: 1px solid #e8e8e8;
  59. }
  60. .wallet-container .swiper-slide.cur{
  61. border: 1px solid #cb5f1f;
  62. }
  63. .wallet-container .swiper-slide img{
  64. display: block;
  65. width: 100%;
  66. max-height: auto;
  67. }
  68. .wallet-container .swiper-slide .sum{
  69. position: relative;
  70. display: flex;
  71. justify-content: center;
  72. align-items: center;
  73. width: 100%;
  74. height: 100%;
  75. font-size: 14px;
  76. font-family: Arial;
  77. font-weight: bold;
  78. text-align: center;
  79. padding-top: 10px;
  80. }
  81. .wallet-container .swiper-slide .sum::after{
  82. content: '';
  83. position: absolute;
  84. top: 0;
  85. left: 0;
  86. display: block;
  87. width: 100%;
  88. height: 10px;
  89. background-color: #dd170e;
  90. }
  91. .swiper-button-prev{
  92. left: 0;
  93. }
  94. .swiper-button-next{
  95. right: 0;
  96. }
  97. .swiper-button-prev,.swiper-button-next{
  98. top: 17px;
  99. margin-top: 0;
  100. width: 15px;
  101. height: 15px;
  102. opacity: 0.6;
  103. }
  104. .swiper-button-disabled{
  105. opacity: 0.2;
  106. }
  107. .swiper-button-next:after,.swiper-button-prev:after{
  108. color: #929292;
  109. font-size: 18px;
  110. }
  111. .swiper-button-next:hover:after,.swiper-button-prev:hover:after{
  112. color: #FF6600;
  113. }
  114. </style>
  115. </head>
  116. <body>
  117. <input name="amount" id="trxamt"/>
  118. <input type="hidden" value="${u}" id="u"/>
  119. <input type="button" class="btn" value="支付" />
  120. <div class="mask"></div>
  121. <script>
  122. $(document).ready(function() {
  123. $(".btn").click(function(e){
  124. var param = {};
  125. param['amt']=$("#trxamt").val();
  126. $.post($("#u").val(),param,function(res){
  127. $('.mask').hide();
  128. if(typeof(res) === 'string'){
  129. res = JSON.parse(res);
  130. if(res.pay_info !== undefined) {
  131. var payInfo = JSON.parse(res.pay_info);
  132. }
  133. //alert(res.pay_info);
  134. }
  135. if(res.status !== "200"){
  136. alert(res.msg);
  137. }else{
  138. var payInfo = JSON.parse(res.pay_info);
  139. WeixinJSBridge.invoke(
  140. 'getBrandWCPayRequest',{
  141. "appId" : payInfo.appId, //公众号名称,由商户传入
  142. "timeStamp": payInfo.timeStamp, //戳,自1970 年以来的秒数
  143. "nonceStr" : payInfo.nonceStr, //随机串
  144. "package" : payInfo.package,
  145. "signType" : payInfo.signType, //微信签名方式:
  146. "paySign" : payInfo.paySign //微信签名,
  147. },function(res){
  148. if(res.err_msg == "get_brand_wcpay_request:ok" ) {
  149. // 此处可以使用此方式判断前端返回,微信团队郑重提示:res.err_msg 将在用户支付成功后返回ok,但并不保证它绝对可靠。
  150. location.href = "/result.html";
  151. }
  152. }
  153. );
  154. }
  155. isRequesting = false;
  156. });
  157. });
  158. });
  159. </script>
  160. </body>
  161. </html>