out.html 10.4 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <meta name="google" value="notranslate">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="stylesheet" href="css/reset.css?v=0.1">
    <link rel="stylesheet" href="css/provinceKey.css?v=0.1">
    <script src="js/config.js?a=111"></script>
    <script src="js/common.js?j=0.01"></script>
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->

    <title>扫码查询出场</title>
    <style>
        body {
            background: #f0f4f5;
            margin: 0;
            padding: 0;
            font-family: 'Microsoft YaHei';
            font-size:62.5%; /*1rem=10px*/
        }
        #header {
            margin-top: 25%;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .phoneText {
            font-size: 18px;
        }
        .inputBox {
            position: relative;
            font-size: 16px;
            margin-top: 20px;
        }
        .subLabel {
            position: absolute;
            left: 0px;
            top: 5px;
            padding:5px;
        }
        .subLabel > span {
            color: #5eb2c0;
        }
        #inputPhoneNum ,#inputCarNum{
            transition: all 0.30s ease-in-out; <!-- -->
            -webkit-transition: all 0.30s ease-in-out;
            -moz-transition: all 0.30s ease-in-out;
            border: #c1bfc5 1px solid;
            border-radius: 3px;
            outline: none;
            height: 30px;
            width: 160px;
            line-height: 30px;
            padding: 5px;
            padding-left: 60px;
            font-size: 18px;
            color:#ff6f16;
        }

        #inputPhoneNum:focus {
            box-shadow: 0 0 5px rgba(81, 203, 238, 1);
            -webkit-box-shadow: 0 0 5px rgba(81, 203, 238, 1);
            -moz-box-shadow: 0 0 5px rgba(81, 203, 238, 1);
        }
        .btnOK {
            background:#75cbbe;
            width: 230px;
            height: 3rem;
            line-height: 3rem;
            text-align: center;
            border-radius: 5px;
            color: #ffffff;
            font-size: 1.2rem;
            cursor: pointer;
        }
        .flexBoxRow {
            display: flex;
            justify-content: left;
            flex-direction:row;
            align-items:center;
            width:100%;
        }
        #footer {
            justify-content:center !important;
            padding-top:2rem;
        }



        #tipResult {
            display: none;
            font-size: 2rem;
            font-size: 20px;
            color: #ff6f16;
            margin-top: 25%;
            text-align: center;
            padding: 10px;
        }
        .input_province {
            font-size:1.4rem;
        }
        .input_province:after {
            content: " ";
            position: absolute;
            right: 0px;
            top: 5px;
            width: 1px;
            height: 90%;
            background: #5eb2c0;
        }
        #carNumBox {
            position: relative;
        }
        .splitLine2 {
            color: #5eb2c0;
            position: absolute;
            left: 40px;
            bottom: 11px;
        }
        #exChangeNum {
            margin-top: 1rem;cursor: pointer;
        }
    </style>
</head>
<body style="background-color: #f0f4f5;">
<!--<noscript>-->
<!--You need to enable JavaScript to run this app.-->
<!--</noscript>-->
<header id="header" style="margin-top:20%; display: flex; justify-content: center; align-items: center; flex-direction: column; ">
    <span class="phoneText" id="phoneText">请输入车牌号</span>
    <div class="inputBox">
        <div id="phoneNumBox" style="display:none;">
            <div class="subLabel">+86 <span> |</span></div>
            <input type="tel" id="inputPhoneNum" value="" onkeydown="inputDown();" placeholder="请输入手机号码" maxlength="14" onpaste="return false" style="display:block;" />
        </div>
        <div id="carNumBox" style="display:block;" class="flexBoxRow">
            <input class="input_province" type="text" readonly="readonly" maxlength="1" id="selProvince" onclick="provinceSelect();" value="鄂">
            <span class="splitLine2"> |</span>
            <input type="text" maxlength="10" name="inputCarNum" id="inputCarNum" />
        </div>
    </div>

</header>
<footer id="footer" class="flexBoxRow">
    <div class="btnOK" id="btnPayOK" disabled="disabled">获取订单</div>
    <img src="img/loading.gif" id="loading" style="display: none;" />
</footer>
<section id="tipResult" style="display:none;">
    <img src="img/by.png" style="width:220px;height:110px;"/>
    <div id="outTipContent"></div>
</section>
<div id="id_keyboard_province"> </div>

<script type="text/javascript">
var queryParams = null;//?参数名称
var $btnObj = null, $btnLoad = null;
function inputDown() {
  var numObj = getObjectByID("inputPhoneNum");
  numObj.value = numObj.value.replace(/\D/g, '').replace(/^/, '$& ').replace(/....(?!$)/g, '$& ');
}
window.onload = function () {
  $btnObj = getObjectByID("btnPayOK");
  $btnLoad = getObjectByID("loading");
  $exChangeNum = getObjectByID("exChangeNum");
  // $exChangeNum.onclick = exChangeNumClick;
  queryParams = getQueryString(window.location);//获取url参数?sign=4&token=6&codeType=888
  var ok = $btnObj;
  ok.onclick = btnOkClick;
  //初始化请求订单,有跳转选择支付,没有填入手机号
  $inputCarNum = getObjectByID("inputCarNum");
  $inputCarNum.onkeyup = checkCharAndNumber
  //init();//初始化init
}
function init() {
  if (queryParams == null) {
    var str = "没有接收到请求参数"; alertMsg(str); console.log(str); return;
  }
  var params = queryParams || {};
  $btnObj.style.display = "none";
  $btnLoad.style.display = "block";
  params.payType = IsWeixinOrAlipay()//4:微信     1:支付宝
  params.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
  //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
  var tmpParams = Object.assign(params, window.webAppH5.comParams);
  getRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "init");
}
//点击查询订单
function btnOkClick() {
  window.location.href = "listnew.html?carNumber=" + getCarNumber();

//   //var phoneNum = document.getElementById("inputPhoneNum").value.replace(/\s*/g, "");//去除空格
//   if (queryParams == null) {
//     var str = "没有接收到请求参数"; alertMsg(str); console.log(str); return;
//   }
//   $btnObj.style.display = "none";
//   $btnLoad.style.display = "block";
//   var params = queryParams || {};
//   //获取当前选中手机号或车牌号
//   params.carNumber = getCarNumber();//手机号
//   if (params.carNumber == "") {
//     $btnObj.style.display = "block"; $btnLoad.style.display = "none";
//     return;
//   }
//   params.terminalSource = "7";//1:任你听 3:微信公共号 4:云平台 7:H5
//   params.payType = IsWeixinOrAlipay()//4:微信     1:支付宝
//   //var tmpParams = Object.assign(params, window.webAppH5.comParams, window.webAppH5.appOut);
//   var tmpParams = Object.assign(params, window.webAppH5.comParams);
//   getRequest(webAppRoot + window.webAppH5.comServer, tmpParams, "okClick");
}

//读取订单数据
function getRequest(url, params, init) {
  var btnObj = $btnObj;
  postRequest(url, params, function (res) {
    btnObj.style.display = "block";
    $btnLoad.style.display = "none";
    if (res.code == 0) {//进场
      //alertMsg("出场成功");
      if (res.data) {
        var tmpObj = res.data;
        //判断是否需要支付
        if (tmpObj.needPay) {
          var queryParams = parseParams(tmpObj);
          console.log(tmpObj)
          window.location.href = "../listnew.html?carNumber" + queryParams;
        } else {
          var tipStr = "无需缴费,欢迎下次光临";
          sucessTip(tipStr); alertMsg(tipStr);
        }


      } else {
        alertMsg("没有找到订单");
      }
    } else {//其他情况如【该卡号场内已存在】
      console.log(res.message); alertMsg(res.message);
      if ((init) != "init") {
        alertMsg(res.message);
      }
      document.getElementById("inputPhoneNum").focus();
    }
  }, function (err) {
    console.log("网络服务超时..." + url);
    alertMsg("网络服务超时");
    btnObj.style.display = "block";
    $btnLoad.style.display = "none";
  });
}
//直接无需缴费出场
function sucessTip(content) {
  var obj = ["header", "footer"];
  for (var i = 0; i < obj.length; i++) {
    var tmpObj = document.getElementById("" + obj[i] + "");
    tmpObj.style.display = "none";
  }
  document.getElementById("tipResult").style.display = "block";
  document.getElementById("outTipContent").innerHTML = content;
}


//获取查询条件值
function getCarNumber() {



  var tmpValue = "";
  var tmpPhone = getObjectByID("inputPhoneNum");
  var phoneNumBox = getObjectByID("phoneNumBox");//手机号
  if(phoneNumBox.style.display === "block"){
    tmpValue = tmpPhone.value.replace(/\s*/g, "")+'111';//去除空格
    if (tmpValue == "" || tmpValue.length < 11) {
      alertMsg("请输入正确的手机号码!");
      tmpValue = "";
    }
  }else{
    var tmpNum = getObjectByID("inputCarNum").value;
    tmpValue = getObjectByID("selProvince").value + tmpNum;
    if (tmpNum == "" || tmpNum == " ") {
      alertMsg("车牌号不能为空!");
      tmpValue = "";
    }
  }
  console.log("查询值:" + tmpValue);
  return tmpValue;

}
</script>

<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/provinceKey.js?v=0.1"></script>
</body>


</html>