Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

75 linhas
2.2 KiB

  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">
  7. //调用微信JS api 支付
  8. function jsApiCall()
  9. {
  10. WeixinJSBridge.invoke(
  11. 'getBrandWCPayRequest',
  12. <?php echo $jsApiParameters; ?>,
  13. function(res){
  14. WeixinJSBridge.log(res.err_msg);
  15. alert(res.err_code+res.err_desc+res.err_msg);
  16. }
  17. );
  18. }
  19. function callpay()
  20. {
  21. if (typeof WeixinJSBridge == "undefined"){
  22. if( document.addEventListener ){
  23. document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
  24. }else if (document.attachEvent){
  25. document.attachEvent('WeixinJSBridgeReady', jsApiCall);
  26. document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
  27. }
  28. }else{
  29. jsApiCall();
  30. }
  31. }
  32. </script>
  33. <script type="text/javascript">
  34. //获取共享地址
  35. function editAddress()
  36. {
  37. WeixinJSBridge.invoke(
  38. 'editAddress',
  39. <?php echo $editAddress; ?>,
  40. function(res){
  41. var value1 = res.proviceFirstStageName;
  42. var value2 = res.addressCitySecondStageName;
  43. var value3 = res.addressCountiesThirdStageName;
  44. var value4 = res.addressDetailInfo;
  45. var tel = res.telNumber;
  46. alert(value1 + value2 + value3 + value4 + ":" + tel);
  47. }
  48. );
  49. }
  50. window.onload = function(){
  51. if (typeof WeixinJSBridge == "undefined"){
  52. if( document.addEventListener ){
  53. document.addEventListener('WeixinJSBridgeReady', editAddress, false);
  54. }else if (document.attachEvent){
  55. document.attachEvent('WeixinJSBridgeReady', editAddress);
  56. document.attachEvent('onWeixinJSBridgeReady', editAddress);
  57. }
  58. }else{
  59. editAddress();
  60. }
  61. };
  62. </script>
  63. </head>
  64. <body>
  65. <br/>
  66. <font color="#9ACD32"><b>该笔订单支付金额为<span style="color:#f00;font-size:50px">1分</span>钱</b></font><br/><br/>
  67. <div align="center">
  68. <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>
  69. </div>
  70. </body>
  71. </html>