12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <script
- type="text/javascript"
- charset="UTF-8"
- src="//wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js"
- ></script>
- <title>支付完成</title>
- </head>
- <body>
- <h2>商家小票页面示例</h2>
- <script>
- document.addEventListener("DOMContentLoaded", function () {
- console.info("app URL", window.location.href);
- // 展示商家小票:
- let mchData = {
- action: "onIframeReady",
- displayStyle: "SHOW_CUSTOM_PAGE",
- };
- let postData = JSON.stringify(mchData);
- parent.postMessage(postData, "https://payapp.weixin.qq.com");
- var sub_mch_id = getQueryString("sub_mch_id");
- var serviceCode = getQueryString("serviceCode");
- console.log("sub_mch_id", sub_mch_id);
- });
- /**
- * 获取链接某个参数
- */
- function getQueryString(key, url) {
- const reg = new RegExp(`([?&]+)${key}=([^&#]*)`);
- const href = url || window.location.href;
- const matches = href.substring(1).match(reg);
- return matches ? decodeURIComponent(matches[2]) : "";
- }
- </script>
- </body>
- </html>
|