Commit bdca61decf2720bc9e694a7199f37d8dce4c767a

Authored by liuqimichale
1 parent eb504830

西城 扫码支付 签名

Showing 2 changed files with 113 additions and 174 deletions
js/out.js 0 → 100644
  1 +var queryParams = null;//?参数名称
  2 +var $btnObj = null, $btnLoad = null;
  3 +function inputDown() {
  4 + var numObj = getObjectByID("inputPhoneNum");
  5 + numObj.value = numObj.value.replace(/\D/g, '').replace(/^/, '$& ').replace(/....(?!$)/g, '$& ');
  6 +}
  7 +window.onload = function () {
  8 + $btnObj = getObjectByID("btnPayOK");
  9 + $btnLoad = getObjectByID("loading");
  10 + $exChangeNum = getObjectByID("exChangeNum");
  11 + // $exChangeNum.onclick = exChangeNumClick;
  12 + queryParams = getQueryString(window.location);//获取url参数?sign=4&token=6&codeType=888
  13 + var ok = $btnObj;
  14 + ok.onclick = btnOkClick;
  15 + //初始化请求订单,有跳转选择支付,没有填入手机号
  16 + $inputCarNum = getObjectByID("inputCarNum");
  17 + $inputCarNum.onkeyup = checkCharAndNumber
  18 + //init();//初始化init
  19 +}
  20 +function init() {
  21 + if (queryParams == null) {
  22 + var str = "没有接收到请求参数"; alertMsg(str); console.log(str); return;
  23 + }
  24 + var params = queryParams || {};
  25 + $btnObj.style.display = "none";
  26 + $btnLoad.style.display = "block";
  27 + params.payType = IsWeixinOrAlipay()//4:微信 1:支付宝
  28 + params.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
  29 + //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
  30 + var tmpParams = Object.assign(params, window.webAppH5.comParams);
  31 + getRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "init");
  32 +}
  33 +//点击查询订单
  34 +function btnOkClick() {
  35 + window.location.href = "listnew.html?carNumber=" + getCarNumber();
  36 +}
  37 +
  38 +//读取订单数据
  39 +function getRequest(url, params, init) {
  40 + var btnObj = $btnObj;
  41 + postRequest(url, params, function (res) {
  42 + btnObj.style.display = "block";
  43 + $btnLoad.style.display = "none";
  44 + if (res.code == 0) {//进场
  45 + //alertMsg("出场成功");
  46 + if (res.data) {
  47 + var tmpObj = res.data;
  48 + //判断是否需要支付
  49 + if (tmpObj.needPay) {
  50 + var queryParams = parseParams(tmpObj);
  51 + console.log(tmpObj)
  52 + window.location.href = "../listnew.html?carNumber" + queryParams;
  53 + } else {
  54 + var tipStr = "无需缴费,欢迎下次光临";
  55 + sucessTip(tipStr); alertMsg(tipStr);
  56 + }
  57 +
  58 + } else {
  59 + alertMsg("没有找到订单");
  60 + }
  61 + } else {//其他情况如【该卡号场内已存在】
  62 + console.log(res.message); alertMsg(res.message);
  63 + if ((init) != "init") {
  64 + alertMsg(res.message);
  65 + }
  66 + document.getElementById("inputPhoneNum").focus();
  67 + }
  68 + }, function (err) {
  69 + console.log("网络服务超时..." + url);
  70 + alertMsg("网络服务超时");
  71 + btnObj.style.display = "block";
  72 + $btnLoad.style.display = "none";
  73 + });
  74 +}
  75 +//直接无需缴费出场
  76 +function sucessTip(content) {
  77 + var obj = ["header", "footer"];
  78 + for (var i = 0; i < obj.length; i++) {
  79 + var tmpObj = document.getElementById("" + obj[i] + "");
  80 + tmpObj.style.display = "none";
  81 + }
  82 + document.getElementById("tipResult").style.display = "block";
  83 + document.getElementById("outTipContent").innerHTML = content;
  84 +}
  85 +
  86 +
  87 +//获取查询条件值
  88 +function getCarNumber() {
  89 +
  90 +
  91 +
  92 + var tmpValue = "";
  93 + var tmpPhone = getObjectByID("inputPhoneNum");
  94 + var phoneNumBox = getObjectByID("phoneNumBox");//手机号
  95 + if(phoneNumBox.style.display === "block"){
  96 + tmpValue = tmpPhone.value.replace(/\s*/g, "")+'111';//去除空格
  97 + if (tmpValue == "" || tmpValue.length < 11) {
  98 + alertMsg("请输入正确的手机号码!");
  99 + tmpValue = "";
  100 + }
  101 + }else{
  102 + var tmpNum = getObjectByID("inputCarNum").value;
  103 + tmpValue = getObjectByID("selProvince").value + tmpNum;
  104 + if (tmpNum == "" || tmpNum == " ") {
  105 + alertMsg("车牌号不能为空!");
  106 + tmpValue = "";
  107 + }
  108 + }
  109 + console.log("查询值:" + tmpValue);
  110 + return tmpValue;
  111 +
  112 +}
... ...
out.html
... ... @@ -17,15 +17,7 @@
17 17 <link rel="stylesheet" href="css/provinceKey.css?v=0.1">
18 18 <script src="js/config.js?b=111"></script>
19 19 <script src="js/common.js?i=1.01"></script>
20   - <!--
21   - Notice the use of %PUBLIC_URL% in the tags above.
22   - It will be replaced with the URL of the `public` folder during the build.
23   - Only files inside the `public` folder can be referenced from the HTML.
24 20  
25   - Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
26   - work correctly both with client-side routing and a non-root public URL.
27   - Learn how to configure a non-root public URL by running `npm run build`.
28   - -->
29 21  
30 22 <title>扫码查询出场</title>
31 23 <style>
... ... @@ -170,177 +162,12 @@
170 162 <div id="outTipContent"></div>
171 163 </section>
172 164 <div id="id_keyboard_province"> </div>
173   -<!--
174   - This HTML file is a template.
175   - If you open it directly in the browser, you will see an empty page.
176 165  
177   - You can add webfonts, meta tags, or analytics to this file.
178   - The build step will place the bundled scripts into the <body> tag.
179 166  
180   - To begin the development, run `npm start` or `yarn start`.
181   - To create a production bundle, use `npm run build` or `yarn build`.
182   --->
183   -<script type="text/javascript">
184   -var queryParams = null;//?参数名称
185   -var $btnObj = null, $btnLoad = null;
186   -function inputDown() {
187   - var numObj = getObjectByID("inputPhoneNum");
188   - numObj.value = numObj.value.replace(/\D/g, '').replace(/^/, '$& ').replace(/....(?!$)/g, '$& ');
189   -}
190   -window.onload = function () {
191   - $btnObj = getObjectByID("btnPayOK");
192   - $btnLoad = getObjectByID("loading");
193   - $exChangeNum = getObjectByID("exChangeNum");
194   - // $exChangeNum.onclick = exChangeNumClick;
195   - queryParams = getQueryString(window.location);//获取url参数?sign=4&token=6&codeType=888
196   - var ok = $btnObj;
197   - ok.onclick = btnOkClick;
198   - //初始化请求订单,有跳转选择支付,没有填入手机号
199   - $inputCarNum = getObjectByID("inputCarNum");
200   - $inputCarNum.onkeyup = checkCharAndNumber
201   - //init();//初始化init
202   -}
203   -function init() {
204   - if (queryParams == null) {
205   - var str = "没有接收到请求参数"; alertMsg(str); console.log(str); return;
206   - }
207   - var params = queryParams || {};
208   - $btnObj.style.display = "none";
209   - $btnLoad.style.display = "block";
210   - params.payType = IsWeixinOrAlipay()//4:微信 1:支付宝
211   - params.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
212   - //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
213   - var tmpParams = Object.assign(params, window.webAppH5.comParams);
214   - getRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "init");
215   -}
216   -//点击查询订单
217   -function btnOkClick() {
218   - window.location.href = "listnew.html?carNumber=" + getCarNumber();
219   -
220   -// //var phoneNum = document.getElementById("inputPhoneNum").value.replace(/\s*/g, "");//去除空格
221   -// if (queryParams == null) {
222   -// var str = "没有接收到请求参数"; alertMsg(str); console.log(str); return;
223   -// }
224   -// $btnObj.style.display = "none";
225   -// $btnLoad.style.display = "block";
226   -// var params = queryParams || {};
227   -// //获取当前选中手机号或车牌号
228   -// params.carNumber = getCarNumber();//手机号
229   -// if (params.carNumber == "") {
230   -// $btnObj.style.display = "block"; $btnLoad.style.display = "none";
231   -// return;
232   -// }
233   -// params.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
234   -// params.payType = IsWeixinOrAlipay()//4:微信 1:支付宝
235   -// //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
236   -// var tmpParams = Object.assign(params, window.webAppH5.comParams);
237   -// getRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "okClick");
238   -}
239   -
240   -//读取订单数据
241   -function getRequest(url, params, init) {
242   - var btnObj = $btnObj;
243   - postRequest(url, params, function (res) {
244   - btnObj.style.display = "block";
245   - $btnLoad.style.display = "none";
246   - if (res.code == 0) {//进场
247   - //alertMsg("出场成功");
248   - if (res.data) {
249   - var tmpObj = res.data;
250   - //判断是否需要支付
251   - if (tmpObj.needPay) {
252   - var queryParams = parseParams(tmpObj);
253   - console.log(tmpObj)
254   - window.location.href = "../listnew.html?carNumber" + queryParams;
255   - } else {
256   - var tipStr = "无需缴费,欢迎下次光临";
257   - sucessTip(tipStr); alertMsg(tipStr);
258   - }
259   - //var tel = document.getElementById("inputPhoneNum").value.replace(/\s/g, "");//去除空格
260   - //var orderFee = keepTwoDecimalFull((tmpObj.orderFee / 100));//本次出场实际应付金额(减去折扣,优惠券等之后的应付金额)
261   - //var tmpUrl = "orderId=" + tmpObj.orderId + "&outtime=" + tmpObj.outtime + "&tel=" + tel + "&orderFee=" + orderFee;
262   -
263   - } else {
264   - alertMsg("没有找到订单");
265   - }
266   - } else {//其他情况如【该卡号场内已存在】
267   - console.log(res.message); alertMsg(res.message);
268   - if ((init) != "init") {
269   - alertMsg(res.message);
270   - }
271   - document.getElementById("inputPhoneNum").focus();
272   - }
273   - }, function (err) {
274   - console.log("网络服务超时..." + url);
275   - alertMsg("网络服务超时");
276   - btnObj.style.display = "block";
277   - $btnLoad.style.display = "none";
278   - });
279   -}
280   -//直接无需缴费出场
281   -function sucessTip(content) {
282   - var obj = ["header", "footer"];
283   - for (var i = 0; i < obj.length; i++) {
284   - var tmpObj = document.getElementById("" + obj[i] + "");
285   - tmpObj.style.display = "none";
286   - }
287   - document.getElementById("tipResult").style.display = "block";
288   - document.getElementById("outTipContent").innerHTML = content;
289   -}
290   -
291   -
292   -//获取查询条件值
293   -function getCarNumber() {
294   - // var tmpValue = "";
295   - // var tmpPhone = getObjectByID("inputPhoneNum");
296   - // var state = tmpPhone.style.display == "block" ? true : false;
297   - // if (state) {//默认手机号
298   - // tmpValue = tmpPhone.value.replace(/\s*/g, "")+'111';//去除空格
299   - // if (tmpValue == "" || tmpValue.length < 11) {
300   - // alertMsg("请输入正确的手机号码!");
301   - // tmpValue = "";
302   - // }
303   - // } else {//车牌号
304   - // var tmpNum = getObjectByID("inputCarNum").value;
305   - // tmpValue = getObjectByID("selProvince").value + tmpNum;
306   - // if (tmpNum == "" || tmpNum == " ") {
307   - // alertMsg("车牌号不能为空!");
308   - // tmpValue = "";
309   - // }
310   - //
311   - //
312   - //
313   - // }
314   - // console.log("查询值:" + tmpValue);
315   - // return tmpValue;
316   -
317   -
318   -
319   - var tmpValue = "";
320   - var tmpPhone = getObjectByID("inputPhoneNum");
321   - var phoneNumBox = getObjectByID("phoneNumBox");//手机号
322   - if(phoneNumBox.style.display === "block"){
323   - tmpValue = tmpPhone.value.replace(/\s*/g, "")+'111';//去除空格
324   - if (tmpValue == "" || tmpValue.length < 11) {
325   - alertMsg("请输入正确的手机号码!");
326   - tmpValue = "";
327   - }
328   - }else{
329   - var tmpNum = getObjectByID("inputCarNum").value;
330   - tmpValue = getObjectByID("selProvince").value + tmpNum;
331   - if (tmpNum == "" || tmpNum == " ") {
332   - alertMsg("车牌号不能为空!");
333   - tmpValue = "";
334   - }
335   - }
336   - console.log("查询值:" + tmpValue);
337   - return tmpValue;
338   -
339   -}
340   -</script>
341 167  
342 168 <script src="js/jquery-3.2.1.min.js"></script>
343 169 <script src="js/provinceKey.js?v=0.1"></script>
  170 +<script src="js/out.js?v=0.1"></script>
344 171 </body>
345 172  
346 173  
... ...