Commit 903c4448cfb2ec3e1f6514e4b397a31a06394155

Authored by songchongxian
1 parent 99b0761b

微信支付

config.js
... ... @@ -6,7 +6,9 @@
6 6 window.webAppH5 = {};
7 7  
8 8 /*服务器地址*/
9   -var webAppRoot = "http://39.98.54.240:8090";
  9 +var webAppRoot = "http://39.98.54.240:8090"; //"http://39.98.54.240:8090";
  10 +//var webApp
  11 +var webAppPayResult = "http://test.pay.renniting.cn/codepay/page/wxpayResult.html";
10 12  
11 13 /*公共参数*/
12 14 webAppH5.comParams = {
... ... @@ -18,6 +20,13 @@ webAppH5.comParams = {
18 20 token: '666'
19 21 }
20 22  
  23 +//小票扫码支付参数
  24 +webAppH5.dynCode = {//卫岗固定参数
  25 + direction: 1,
  26 + codeType: 1,
  27 + channelId: "小票二维码"
  28 +}
  29 +
21 30 /*出、入场接口*/
22 31 webAppH5.comServer = "/keyTopQrCodeInOutPark/noCarQRcodeInOutPark";
23 32  
... ... @@ -60,6 +69,11 @@ webAppH5.aliPayServer = "/alipay/aliH5Pay";
60 69 // direction:1
61 70 //}
62 71  
  72 +//小票二维码出场
  73 +//http://39.98.54.240/codepay/index.html?appid=0&lotId=1&payConfigId=2&receiptNo=3
  74 +//http://localhost:1260/codepay/index.html?appid=0&lotId=1&payConfigId=2&receiptNo=3
  75 +
  76 +
63 77 //首页
64 78 //进出场标识>>>>>>>>>>direction=0 [通行方向 入:0,1:出 必填]
65 79 //测试服务器进场首页
... ... @@ -70,5 +84,10 @@ webAppH5.aliPayServer = "/alipay/aliH5Pay";
70 84  
71 85  
72 86  
  87 +//测试支付[任你停测试-首页-停车记录(停车列表车牌号,再找到对应停车场编号)]
  88 +//http://test.renniting.cn/parking/admin/SubMenus/allparkrecords.html
  89 +
  90 +//http://localhost:1260/pay.html?orderId=101526715300086198272&parkName=%E9%9D%99%E9%9B%85%E5%9C%B0%E4%B8%8A&parkCode=B1504020C7&inparktime=2018-12-24%2010%3A58%3A24&outtime=2018-12-24%2011%3A05%3A10&staytime=420&due=70&paid=0&orderTotalFee=70&orderFee=7&discountFee=63&plateno=%E8%92%99DTK366&outPayOrderNo=B1504020C720181224110510813DTK366-172192102&appOrderTimeout=%E8%AF%B7%E5%9C%A8%E6%94%AF%E4%BB%98%E5%AE%8C%E6%88%9010%E5%88%86%E9%92%9F%E5%86%85%E5%87%BA%E5%9C%BA%EF%BC%8C%E5%A6%82%E8%B6%85%E6%97%B6%E6%9C%AA%E5%87%BA%E5%9C%BA%EF%BC%8C%E4%BC%9A%E7%BB%A7%E7%BB%AD%E8%AE%A1%E8%B4%B9%E3%80%82&discountDesc=1%E6%8A%98%E4%BC%98%E6%83%A0&queryOrderInfo=%7B%22app_id%22%3A%221%22%2C%22carNumber%22%3A%22%E8%92%99DTK366%22%2C%22channelId%22%3A%22172192102%22%2C%22codeType%22%3A0%2C%22deviceInfo%22%3A%223%22%2C%22direction%22%3A1%2C%22parkingId%22%3A%22B1504020C7%22%2C%22plNo%22%3A%22B1504020C7%22%2C%22salt%22%3A%222%22%2C%22sign%22%3A%224%22%2C%22sign_type%22%3A%22md5%22%2C%22terminalSource%22%3A%227%22%2C%22token%22%3A%22666%22%7D&needPay=true
  91 +
73 92  
74 93  
... ...
dynCodePay.html 0 → 100644
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="utf-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6 + <meta name="theme-color" content="#000000">
  7 + <meta name="google" value="notranslate">
  8 + <meta name="format-detection" content="telephone=no">
  9 + <meta name="format-detection" content="email=no">
  10 + <meta name="apple-mobile-web-app-capable" content="yes">
  11 + <meta name="apple-mobile-web-app-status-bar-style" content="black">
  12 + <meta http-equiv="Pragma" content="no-cache">
  13 + <meta http-equiv="Cache-control" content="no-cache">
  14 + <meta http-equiv="Cache" content="no-cache">
  15 + <meta http-equiv="Expires" content="0">
  16 + <link rel="stylesheet" href="css/index.css?v=0.1">
  17 + <script src="config.js?v=0.1"></script>
  18 + <script src="js/common.js?v=0.1"></script>
  19 + <script src="js/dynCodePay.js?v=0.1"></script>
  20 + <!--<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"></script>-->
  21 + <!--<script src="config.js"></script>-->
  22 + <!--
  23 + Notice the use of %PUBLIC_URL% in the tags above.
  24 + It will be replaced with the URL of the `public` folder during the build.
  25 + Only files inside the `public` folder can be referenced from the HTML.
  26 +
  27 + Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
  28 + work correctly both with client-side routing and a non-root public URL.
  29 + Learn how to configure a non-root public URL by running `npm run build`.
  30 + -->
  31 + <title>订单支付</title>
  32 +</head>
  33 +<body>
  34 + <!--<noscript>-->
  35 + <!--You need to enable JavaScript to run this app.-->
  36 + <!--</noscript>-->
  37 + <header id="header" class="flexBoxRow panelBgColor">
  38 + <div class="headerBox">
  39 + <div class="carNumBox"><span></span><span id="carNum"></span></div>
  40 + <div class="moneyBox"><span>¥</span><span id="sumMoney">0.00</span></div>
  41 + </div>
  42 + </header>
  43 + <section id="payDetail" class="panelBgColor marginTop">
  44 + <div><span>车场名称:</span><span id="parkName"></span><a id="linkPayDetail">详情+</a> </div>
  45 + <div><span>停车时长:</span><span id="staytime"></span></div>
  46 + <div><span>进场时间:</span><span id="inparktime"></span></div>
  47 + <div><span>停车总费用:</span><span id="due"></span></div>
  48 + <div><span>已支付金额:</span><span id="paid"></span></div>
  49 + <div><span>优惠金额:</span><span id="discountFee"></span><span id="discountDesc"></span></div>
  50 + <div><span>订单编号: </span><span id="orderNum">1234567890</span> </div>
  51 + </section>
  52 + <section id="section" class="marginTop">
  53 + <div class="flexBoxRow">
  54 + <span class="payWayTitle">选择支付方式</span> <span class="orderTime colorGray">出场时间: <span id="outtime"></span></span>
  55 + </div>
  56 + <div class="row marginTop">
  57 + <!--AliPay-->
  58 + <div class="flexBoxRow" id="rowAliPay">
  59 + <img class="payIcon" src="img/aliPay.png" />
  60 + <span class="marginLeft">支付宝支付</span>
  61 + <label for="aliPay" class="radio">
  62 + <span class="radio-bg"></span>
  63 + <input type="radio" name="radioPayWay" id="aliPay" value="支付宝" checked="checked" />
  64 + <span class="radio-on"></span>
  65 + </label>
  66 + </div>
  67 + <hr class="splitLine marginTop" id="splitLine" />
  68 + <!--WxPay-->
  69 + <div class="flexBoxRow marginTop" id="rowWxPay">
  70 + <img class="payIcon" src="img/wxPay.png" />
  71 + <span class="marginLeft">微信支付</span>
  72 + <label for="wxPay" class="radio">
  73 + <span class="radio-bg"></span>
  74 + <input type="radio" name="radioPayWay" id="wxPay" value="微信" />
  75 + <span class="radio-on"></span>
  76 + </label>
  77 + </div>
  78 + </div>
  79 + </section>
  80 + <footer id="footer" class="flexBoxRow marginTop">
  81 + <div class="btnOK" id="btnPayOK">确定支付</div>
  82 + <img src="img/loading.gif" id="loading" style="display: none;" />
  83 + </footer>
  84 + <section id="payTip" style="padding: 5px;margin-top:5px; color: #3385ff; font-size: 14px; "></section>
  85 +
  86 + <!--
  87 + This HTML file is a template.
  88 + If you open it directly in the browser, you will see an empty page.
  89 +
  90 + You can add webfonts, meta tags, or analytics to this file.
  91 + The build step will place the bundled scripts into the <body> tag.
  92 +
  93 + To begin the development, run `npm start` or `yarn start`.
  94 + To create a production bundle, use `npm run build` or `yarn build`.
  95 + -->
  96 +</body>
  97 +
  98 +</html>
... ...
index.html
... ... @@ -68,10 +68,15 @@
68 68 function getResponse(params) {
69 69 var direction = params.direction;//direction=0 [通行方向 入:0,1:出 必填]
70 70 var queryParams = parseParams(params);
71   - if (direction == 0) {//入口
72   - window.location.href = "page/in.html?" + queryParams;
73   - } else {//出口
74   - window.location.href = "page/out.html?" + queryParams;
  71 + //首先判断是否小票二维码标识位lotId
  72 + if (typeof(params.lotId)!="undefined") {
  73 + window.location.href = "dynCodePay.html?" + queryParams;
  74 + } else {
  75 + if (direction == 0) {//入口
  76 + window.location.href = "page/in.html?" + queryParams;
  77 + } else {//出口
  78 + window.location.href = "page/out.html?" + queryParams;
  79 + }
75 80 }
76 81 }
77 82 </script>
... ...
js/dynCodePay.js 0 → 100644
  1 +/*
  2 +@songcxa
  3 +@2018-12-14
  4 +@小票动态扫码移动支付
  5 +*/
  6 +var webAppParams = null;
  7 +var $btnObj = null;
  8 +var $btnLoad = null;
  9 +//var $btnLoad = document.getElementById("loading");
  10 +window.onload = function () {
  11 + //var root = document.getElementById("root");
  12 + $btnObj = document.getElementById("btnPayOK");
  13 + $btnLoad = document.getElementById("loading");
  14 + $linkPayDetail = getObjectByID("linkPayDetail");
  15 + $linkPayDetail.onclick = webAppClass.linkPayDetailClick;
  16 + var webRoot = window.location.href;
  17 + //当前客户端浏览器模式[微信、支付宝、其他]
  18 + webAppClass.clientBrowser();
  19 + //绑定事件
  20 + var ali = document.getElementById("rowAliPay");
  21 + var wx = document.getElementById("rowWxPay");
  22 + ali.onclick = webAppClass.aliClick;
  23 + wx.onclick = webAppClass.wxClick;
  24 + $btnObj.onclick = webAppClass.okClick;
  25 + document.getElementById("payTip").innerHTML = "";
  26 + //参数
  27 + var tmpURLparams = getQueryString(window.location);
  28 + if (tmpURLparams != null) {
  29 + //设置UI参数
  30 + //webAppClass.setUI(webAppParams);
  31 + webAppClass.init(tmpURLparams);
  32 + } else {
  33 + alertMsg("没有接收到url参数信息");
  34 + }
  35 +}
  36 +/**/
  37 +var webAppClass = {
  38 + //appid={0}&lotId={1}&payConfigId={2}&receiptNo=
  39 + init: function (params) {
  40 + var urlParams = params;
  41 + var newParams = urlParams || {};
  42 + $btnObj.style.display = "none";
  43 + $btnLoad.style.display = "block";
  44 + newParams.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
  45 + //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
  46 + newParams.parkingId = params.lotId;
  47 + newParams.carNumber = params.receiptNo;
  48 + var tmpParams = Object.assign(newParams, window.webAppH5.comParams, window.webAppH5.dynCode);
  49 + this.initRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "init");
  50 + },
  51 + initRequest: function (url, params, init) {
  52 + var btnObj = $btnObj;
  53 + postRequest(url, params, function (res) {
  54 + btnObj.style.display = "block";
  55 + $btnLoad.style.display = "none";
  56 + if (res.code == 0) {//进场
  57 + //alertMsg("出场成功");
  58 + if (res.data) {
  59 + var tmpObj = res.data;
  60 + //判断是否需要支付
  61 + if (tmpObj.needPay) {
  62 + //var queryParams = parseParams(tmpObj);
  63 + //window.location.href = "../pay.html?" + queryParams;
  64 + webAppParams = tmpObj;
  65 + webAppClass.setUI(tmpObj);
  66 + } else {
  67 + var tipStr = "无需缴费,欢迎下次光临";
  68 + alertMsg(tipStr);
  69 + }
  70 + } else {
  71 + alertMsg("没有找到订单");
  72 + }
  73 + } else {//其他情况如【该卡号场内已存在】
  74 + console.log(res.message); alertMsg(res.message);
  75 + if ((init) != "init") { alertMsg(res.message); }
  76 + }
  77 + }, function (err) {
  78 + console.log("网络服务超时..." + url);
  79 + alertMsg("网络服务超时");
  80 + btnObj.style.display = "block";
  81 + $btnLoad.style.display = "none";
  82 + });
  83 + },
  84 + //OK
  85 + okClick: function (ev) {
  86 + document.getElementById("payTip").innerHTML = "";
  87 + if (webAppParams == null) {
  88 + alertMsg("暂无订单信息");return;
  89 + }
  90 + //先校验停车费用后缴费提交
  91 + webAppClass.checkParkCost();
  92 + },
  93 + //校验该订单当前支付时的费用(排除扫描订单后不支付时长)
  94 + checkParkCost: function () {
  95 + $btnObj.style.display = "none";
  96 + $btnLoad.style.display = "block";
  97 + if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页
  98 + window.history.back(-1);
  99 + }
  100 + var tmpParams = JSON.parse(webAppParams.queryOrderInfo);
  101 + var url = webAppRoot + window.webAppH5.comServer;
  102 + postRequest(url, tmpParams, function (res) {
  103 + //btnObj.style.display = "block"; //$btnLoad.style.display = "none";
  104 + //$btnObj.style.display = "block";
  105 + if (res.code == 0) {//进场
  106 + var tmpObj = res.data;
  107 + if (tmpObj) {
  108 + webAppClass.setUI(tmpObj);
  109 + webAppParams = tmpObj;//重新赋值
  110 + webAppClass.okPay(tmpObj);//唤醒支付
  111 + } else {
  112 + alertMsg("没有找到相应订单");
  113 + }
  114 + } else {//其他情况如【该卡号场内已存在】
  115 + $btnLoad.style.display = "none";
  116 + $btnObj.style.display = "block";
  117 + console.log(res.message); alertMsg(res.message);
  118 + }
  119 + }, function (err) {
  120 + console.log("网络服务超时..." + url);
  121 + alertMsg("网络服务超时");
  122 + $btnLoad.style.display = "none";
  123 + $btnObj.style.display = "block";
  124 + //$btnLoad.style.display = "none";
  125 + });
  126 + },
  127 +
  128 + //确定支付
  129 + okPay: function (params) {
  130 + var orderID = params.orderId;//订单号
  131 + //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号
  132 + var root = webAppRoot;
  133 + //默认支付宝
  134 + if (document.getElementById("aliPay").checked) {
  135 + console.log("aliPay");
  136 + //订单号
  137 + var obj = {};
  138 + //this.payAjax(url, { orderId: "11111", price: 0.01 });
  139 + var aliPay = webAppH5.aliPayServer;
  140 + var aliParams = webAppH5.comParams;
  141 + aliParams.orderId = orderID;
  142 + aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号
  143 + aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
  144 + aliParams.paySrcType = 101;//101停车支付
  145 + webAppClass.payAliAjax(root + aliPay, aliParams);
  146 + } else {//微信
  147 + var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096";
  148 + //window.location.href = url;
  149 + var wxPay = webAppH5.wxPayServer;
  150 + var wxParams = webAppH5.comParams;
  151 + wxParams.orderId = orderID;
  152 + wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号
  153 + wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
  154 + webAppClass.payAjax(root + wxPay, wxParams);
  155 + console.log("wxPay");
  156 + }
  157 + },
  158 +
  159 + //Ali
  160 + aliClick: function (ev) {
  161 + console.log("AliClick");
  162 + document.getElementById("aliPay").checked = true;
  163 + ev.preventDefault();
  164 + },
  165 + //Wx
  166 + wxClick: function (ev) {
  167 + console.log("wxClick");
  168 + document.getElementById("wxPay").checked = true;
  169 + ev.preventDefault();
  170 + },
  171 + //浏览器
  172 + clientBrowser: function () {
  173 + if (/MicroMessenger/.test(window.navigator.userAgent)) {
  174 + console.log("微信客户端");
  175 + this.switchShow("wxPay");
  176 + } else if (/AlipayClient/.test(window.navigator.userAgent)) {
  177 + console.log("支付宝客户端");
  178 + this.switchShow("aliPay");
  179 + } else {
  180 + console.log("其他浏览器");
  181 + this.switchShow("other");
  182 + }
  183 + },
  184 + //根据浏览器显示内容[aliPay、wxPay、other]
  185 + switchShow: function (type) {
  186 + var aliObj = document.getElementById("rowAliPay");
  187 + var wxObj = document.getElementById("rowWxPay");
  188 + var lineObj = document.getElementById("splitLine");
  189 + switch (type) {
  190 + case "aliPay":
  191 + lineObj.style.display = "none";
  192 + wxObj.style.display = "none";
  193 + document.getElementById("aliPay").checked = true;
  194 + break;
  195 + case "wxPay":
  196 + lineObj.style.display = "none";
  197 + aliObj.style.display = "none";
  198 + document.getElementById("wxPay").checked = true;
  199 + break;
  200 + default://其他浏览器
  201 + break;
  202 + }
  203 + },
  204 +
  205 + //异步请求-微信
  206 + payAjax: function (url, params) {
  207 + var btnOBj = $btnObj;
  208 + postRequest(url, params, function (res) {
  209 + btnOBj.style.display = "block";
  210 + $btnLoad.style.display = "none";
  211 + //debugger;
  212 + if (res.code == 0) {//进场
  213 + if (res.data) {
  214 + var tmpObj = res.data;
  215 + if (typeof (tmpObj.mwebUrl) != "undefined") {
  216 + window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult;
  217 + } else {
  218 + alertMsg("没有返回支付地址mwebUrl");
  219 + }
  220 + console.log(JSON.stringify(tmpObj));
  221 + } else {
  222 + alertMsg("没有找到返回值");
  223 + }
  224 + } else {//其他情况如【该卡号场内已存在】
  225 + console.log(res.message);
  226 + alertMsg(res.message);
  227 + }
  228 + }, function (err) {
  229 + console.log("网络地址出错...");
  230 + alertMsg("网络地址出错...");
  231 + btnOBj.style.display = "block";
  232 + });
  233 + },
  234 +
  235 + //异步请求-支付宝
  236 + payAliAjax: function (url, params) {
  237 + var btnOBj = $btnObj;
  238 + postRequest(url, params, function (res) {
  239 + btnOBj.style.display = "block";
  240 + $btnLoad.style.display = "none";
  241 + if (res.code == 0) {//进场
  242 + document.write(res.data);//打开支付表单
  243 + } else {//其他情况如【该卡号场内已存在】
  244 + console.log(res.message);
  245 + alertMsg(res.message);
  246 + }
  247 + }, function (err) {
  248 + console.log("网络地址出错...");alertMsg("网络地址出错...");
  249 + $btnLoad.style.display = "none";
  250 + btnOBj.style.display = "block";
  251 + });
  252 + },
  253 +
  254 + //设置UI
  255 + setUI: function (params) {
  256 + var $carNum = getObjectByID("carNum"),//车牌号
  257 + $orderNum = getObjectByID("orderNum"),//订单号
  258 + $sumMoney = getObjectByID("sumMoney"),//实际应付金额
  259 + $outtime = getObjectByID("outtime"),//实际出场时间
  260 + $payTip = getObjectByID("payTip"),//支付提示
  261 +
  262 + $parkName = getObjectByID("parkName"),//车场名称
  263 + $inparktime = getObjectByID("inparktime"),//进场时间
  264 + $staytime = getObjectByID("staytime"),//停车时长
  265 + $due = getObjectByID("due"),//停车总费用
  266 +
  267 + $paid = getObjectByID("paid"),//已支付金额
  268 + $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用
  269 + $discountFee = getObjectByID("discountFee");//优惠金额
  270 +
  271 + if (params != null && params!="") {
  272 + var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100);
  273 + $carNum.innerHTML = params.plateno;//手机号
  274 + $orderNum.innerHTML = params.orderId;//订单号
  275 + $sumMoney.innerHTML = price;///params.orderFee//缴费金额
  276 + $outtime.innerHTML = params.outtime;//实际出场时间
  277 + //.appOrderTimeout
  278 + $payTip.innerHTML = "注意: " + params.appOrderTimeout;//请在支付完成10分钟内出场,如超时未出场,会继续计费。
  279 +
  280 + $parkName.innerHTML = params.parkName;
  281 + $inparktime.innerHTML = params.inparktime;
  282 + $staytime.innerHTML = formatSeconds(params.staytime);
  283 +
  284 + $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用
  285 + $paid.innerHTML = params.paid;
  286 + $discountFee.innerHTML = keepTwoDecimalFull((params.discountFee / 100));//优惠金额
  287 + $discountDesc.innerHTML = params.discountDesc;
  288 + } else {
  289 + console.log("没有接受到参数");
  290 + }
  291 + },
  292 +
  293 + //查看详情
  294 + linkPayDetailClick: function (ev) {
  295 + var $payDetail = getObjectByID("payDetail");
  296 + var $linkPayDetail = getObjectByID("linkPayDetail");
  297 + if ($linkPayDetail.innerHTML == "详情+") {
  298 + $linkPayDetail.innerHTML = "详情-";
  299 + $payDetail.style.height = "195px";
  300 + } else {
  301 + $linkPayDetail.innerHTML = "详情+";
  302 + $payDetail.style.height = "55px";
  303 + }
  304 + }
  305 +}
0 306 \ No newline at end of file
... ...
js/pay.js
... ... @@ -161,11 +161,17 @@ var webAppClass = {
161 161 postRequest(url, params, function (res) {
162 162 btnOBj.style.display = "block";
163 163 $btnLoad.style.display = "none";
164   - debugger;
  164 + //debugger;
165 165 if (res.code == 0) {//进场
166   - alertMsg("出场成功");
  166 + //alertMsg("出场成功");
167 167 if (res.data) {
168 168 var tmpObj = res.data;
  169 + if (typeof (tmpObj.mwebUrl)!="undefined") {
  170 + window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult;
  171 + } else {
  172 + alertMsg("没有返回支付地址mwebUrl");
  173 + }
  174 + console.log(JSON.stringify(tmpObj));
169 175 } else {
170 176 alertMsg("没有找到返回值");
171 177 }
... ...
page/out.html
... ... @@ -180,7 +180,7 @@
180 180 alertMsg("没有找到订单");
181 181 }
182 182 } else {//其他情况如【该卡号场内已存在】
183   - console.log(res.message);
  183 + console.log(res.message); alertMsg(res.message);
184 184 if ((init) != "init") {
185 185 alertMsg(res.message);
186 186 }
... ...
page/wxpayResult.html 0 → 100644
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="utf-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6 + <meta name="theme-color" content="#000000">
  7 + <meta name="google" value="notranslate">
  8 + <meta name="format-detection" content="telephone=no">
  9 + <meta name="format-detection" content="email=no">
  10 + <meta name="apple-mobile-web-app-capable" content="yes">
  11 + <meta name="apple-mobile-web-app-status-bar-style" content="black">
  12 + <meta http-equiv="Pragma" content="no-cache">
  13 + <meta http-equiv="Cache-control" content="no-cache">
  14 + <meta http-equiv="Cache" content="no-cache">
  15 + <meta http-equiv="Expires" content="0">
  16 + <script src="../js/common.js"></script>
  17 + <!--
  18 + Notice the use of %PUBLIC_URL% in the tags above.
  19 + It will be replaced with the URL of the `public` folder during the build.
  20 + Only files inside the `public` folder can be referenced from the HTML.
  21 +
  22 + Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
  23 + work correctly both with client-side routing and a non-root public URL.
  24 + Learn how to configure a non-root public URL by running `npm run build`.
  25 + -->
  26 + <title>支付状态</title>
  27 +</head>
  28 +<body style="background-color: #f0f4f5;">
  29 + <!--<noscript>-->
  30 + <!--You need to enable JavaScript to run this app.-->
  31 + <!--</noscript>-->
  32 + <header id="header" style="margin-top:25%; display: flex; justify-content: center; align-items: center; flex-direction: column; ">
  33 + <img id="stateImg" src="../img/default.png" style="width: 64px; height: 64px; " />
  34 + <div id="stateLable" style="font-size: 18px; color: #777; margin-top: 20px;">状态</div>
  35 + </header>
  36 +
  37 + <!--
  38 + This HTML file is a template.
  39 + If you open it directly in the browser, you will see an empty page.
  40 +
  41 + You can add webfonts, meta tags, or analytics to this file.
  42 + The build step will place the bundled scripts into the <body> tag.
  43 +
  44 + To begin the development, run `npm start` or `yarn start`.
  45 + To create a production bundle, use `npm run build` or `yarn build`.
  46 + -->
  47 + <script type="text/javascript">
  48 + window.onload = function () {
  49 + var tmpParams = getQueryString(window.location);
  50 + if (tmpParams != null) {
  51 + console.log(JSON.stringify(tmpParams));
  52 + if (tmpParams.trade_no != "") {
  53 + getResponse("success");
  54 + }
  55 + //alertMsg("支付返回参数:" + JSON.stringify(tmpParams));
  56 + } else {
  57 + console.log("支付返回参数" + tmpParams);
  58 + }
  59 + }
  60 + //type[fail、sucesss]
  61 + function getResponse(type) {
  62 + var img = document.getElementById("stateImg");
  63 + var label = document.getElementById("stateLable");
  64 + if (type == "fail") {
  65 + img.src = "../img/no.png";
  66 + label.innerHTML = "支付失败,尝试重新扫码";
  67 + } else {
  68 + img.src = "../img/ok.png";
  69 + label.innerHTML = "订单支付成功";
  70 + }
  71 + }
  72 + </script>
  73 +</body>
  74 +
  75 +
  76 +</html>
... ...