v.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  4. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  5. <title>微信支付样例-支付</title>
  6. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.0.js"></script>
  7. <script type="text/javascript">
  8. window.onload=function () {
  9. wx.miniProgram.redirectTo({url: '/pages/success/success'})
  10. }
  11. //调用微信JS api 支付
  12. function jsApiCall()
  13. {
  14. WeixinJSBridge.invoke(
  15. 'getBrandWCPayRequest',{"appId":"wx17b60e8bcb1f9018","timeStamp":"1564468116","nonceStr":"5d3fe394419cc","package":"prepay_id=wx30142836212143ed7724a4ac1121113500","signType":"MD5","paySign":"46A4A0E8DD5357FC61FF710CA33FF74D"},
  16. function(res){
  17. if(res.err_msg == "get_brand_wcpay_request:ok" ){
  18. wx.miniProgram.redirectTo({url: '/pages/success/success'})
  19. }
  20. WeixinJSBridge.log(res.err_msg);
  21. alert(res.err_code+res.err_desc+res.err_msg);
  22. }
  23. );
  24. }
  25. function callpay()
  26. {
  27. if (typeof WeixinJSBridge == "undefined"){
  28. if( document.addEventListener ){
  29. document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
  30. }else if (document.attachEvent){
  31. document.attachEvent('WeixinJSBridgeReady', jsApiCall);
  32. document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
  33. }
  34. }else{
  35. jsApiCall();
  36. }
  37. }
  38. </script>
  39. <script type="text/javascript">
  40. window.onload = function(){
  41. if (typeof WeixinJSBridge == "undefined"){
  42. if( document.addEventListener ){
  43. document.addEventListener('WeixinJSBridgeReady', editAddress, false);
  44. }else if (document.attachEvent){
  45. document.attachEvent('WeixinJSBridgeReady', editAddress);
  46. document.attachEvent('onWeixinJSBridgeReady', editAddress);
  47. }
  48. }else{
  49. /*editAddress();*/
  50. }
  51. };
  52. </script>
  53. </head>
  54. <body>
  55. <br/>
  56. <font color="#9ACD32"><b>该笔订单支付金额为<span style="color:#f00;font-size:50px">1分</span>钱</b></font><br/><br/>
  57. <div align="center">
  58. <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" >立即支付</button>
  59. </div>
  60. </body>
  61. </html>