receipts.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="referrer" content="origin" />
  7. <meta
  8. name="viewport"
  9. content="width=device-width, viewport-fit=cover, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
  10. />
  11. <meta
  12. http-equiv="Cache-Control"
  13. content="no-cache, no-store, must-revalidate"
  14. />
  15. <title>支付完成</title>
  16. <script
  17. type="text/javascript"
  18. charset="UTF-8"
  19. src="https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js"
  20. ></script>
  21. <!-- <script
  22. type="text/javascript"
  23. src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"
  24. ></script> -->
  25. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  26. <style>
  27. body {
  28. font-family: PingFang SC, "Helvetica Neue", Arial, sans-serif;
  29. }
  30. .order_box {
  31. text-align: center;
  32. display: flex;
  33. flex-direction: column;
  34. justify-content: space-between;
  35. align-items: center;
  36. }
  37. .order_box .bussiness_avt img {
  38. width: 68px;
  39. height: 78px;
  40. }
  41. .b_name {
  42. font-size: 20px;
  43. font-weight: bold;
  44. color: #333333;
  45. margin-top: 6px;
  46. }
  47. .notice {
  48. padding: 10px 0;
  49. font-size: 12px;
  50. color: #999;
  51. }
  52. .btns {
  53. display: flex;
  54. align-items: center;
  55. justify-content: center;
  56. width:70%;
  57. margin: 10px auto 0;
  58. height: 40px;
  59. line-height: 40px;
  60. background: linear-gradient(93deg, #f97c55 0%, #f44545 100%);
  61. border-radius: 39px;
  62. color:#fff;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <div class="order_box">
  68. <div class="bussiness_avt">
  69. <img
  70. id="b_avt"
  71. src="https://s3.ax1x.com/2020/12/17/r8VTKK.png"
  72. alt=""
  73. />
  74. </div>
  75. <div class="b_name" id="b_name">大卫博士健康内裤</div>
  76. <div class="notice">感谢您购买大卫博士健康内裤,祝您身体健康!</div>
  77. <div class="btns" id="button">查看订单详情</div>
  78. </div>
  79. <script>
  80. $(document).ready(function () {
  81. // var vConsole = new VConsole(); //初始化console
  82. // console.log(window.location.href, "页面链接");
  83. // console.log(window.location.search, "链接参数");
  84. var initData = {
  85. //初始化小票信息
  86. action: "onIframeReady",
  87. displayStyle: "SHOW_CUSTOM_PAGE",
  88. }; //display可以展示官方的,也可以展示自定义的
  89. var initPostData = JSON.stringify(initData);
  90. parent.postMessage(initPostData, "https://payapp.weixin.qq.com"); //父页面的交互 这一行很重要
  91. //获取参数
  92. var sub_mch_id = getQueryString("sub_mch_id"); //特约商户号
  93. var out_trade_no = getQueryString("out_trade_no"); //商户订单号
  94. var check_code = getQueryString("check_code"); //md5 校验码
  95. let data = {
  96. check_code,
  97. out_trade_no,
  98. sub_mch_id,
  99. };
  100. $.ajax({
  101. url: "https://weidian.jiuweiyun.cn/api/order/get_pay_result", //正式
  102. type: "get",
  103. data: data,
  104. dataType: "json",
  105. success: (res) => {
  106. if (res.code == 200) {
  107. // console.log(res, "获取订单信息");
  108. let home = "";
  109. let info = "";
  110. let order_no = "";
  111. if (out_trade_no) {
  112. let index = out_trade_no.lastIndexOf("\_");
  113. order_no = out_trade_no.substring(
  114. index + 1,
  115. out_trade_no.length
  116. );
  117. }
  118. console.log(out_trade_no,'out_trade_no')
  119. console.log(order_no,'order_no')
  120. if (res.data.is_help == 1) {
  121. //代理端
  122. info =
  123. "http://api.app.jiuweiyun.cn/api/gzh#/pages/order-info/order-info?order_no=" +
  124. order_no+'&from='+1;
  125. // console.log(info,'info')
  126. } else {
  127. //用户端
  128. info =
  129. "https://weidian.jiuweiyun.cn/web/user#/pages/order-info/order-info?order_no=" +
  130. order_no;
  131. }
  132. //点击跳转到订单管理
  133. document.getElementById("button").onclick = function () {
  134. let mchData = {
  135. action: "jumpOut",
  136. jumpOutUrl: info,
  137. };
  138. let postData = JSON.stringify(mchData);
  139. parent.postMessage(postData, "https://payapp.weixin.qq.com");
  140. };
  141. } else {
  142. // console.log(11111);
  143. }
  144. },
  145. error: (err) => {
  146. // console.log(err, "错误信息");
  147. $("#button").hide();
  148. },
  149. });
  150. //获取返回页面参数
  151. function getQueryString(name) {
  152. var query = window.location.search.substring(1);
  153. var vars = query.split("&");
  154. for (var i = 0; i < vars.length; i++) {
  155. var pair = vars[i].split("=");
  156. if (pair[0] == name) {
  157. return pair[1];
  158. }
  159. }
  160. return null;
  161. }
  162. });
  163. </script>
  164. </body>
  165. </html>