out.html 11.6 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/com.css?v=0.1">
    <link rel="stylesheet" href="../css/provinceKey.css?v=0.1">
    <script src="../config.js"></script>
    <script src="../js/common.js?v=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>
        #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:block;">
                <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:none;" class="flexBoxRow">
                <input class="input_province" type="text" readonly="readonly" maxlength="1" id="selProvince" onclick="provinceSelect();" value="蒙">
                <span class="splitLine2"> |</span>
                <input type="text" name="inputCarNum" id="inputCarNum" />
            </div>
        </div>
        <img id="exChangeNum" src="../img/exchange.png"/>
    </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>
        <!--
          This HTML file is a template.
          If you open it directly in the browser, you will see an empty page.

          You can add webfonts, meta tags, or analytics to this file.
          The build step will place the bundled scripts into the <body> tag.

          To begin the development, run `npm start` or `yarn start`.
          To create a production bundle, use `npm run build` or `yarn build`.
        -->
        <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.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() {
                //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
                //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);
                                window.location.href = "../pay.html?" + queryParams;
                            } else {
                                var tipStr = "无需缴费,欢迎下次光临";
                                sucessTip(tipStr); alertMsg(tipStr);
                            }
                            //var tel = document.getElementById("inputPhoneNum").value.replace(/\s/g, "");//去除空格
                            //var orderFee = keepTwoDecimalFull((tmpObj.orderFee / 100));//本次出场实际应付金额(减去折扣,优惠券等之后的应付金额)
                            //var tmpUrl = "orderId=" + tmpObj.orderId + "&outtime=" + tmpObj.outtime + "&tel=" + tel + "&orderFee=" + orderFee;

                        } 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 exChangeNumClick() {
                var tmpPhone = getObjectByID("inputPhoneNum");
                var tmpCar = getObjectByID("carNumBox");
                var tmpTip = getObjectByID("phoneText");
                var state = tmpPhone.style.display == "block" ? true : false;
                if (state) {
                    tmpCar.style.display = "block"; tmpPhone.style.display = "none";
                    tmpTip.innerHTML = "请输入车牌号";
                } else {
                    tmpCar.style.display = "none"; tmpPhone.style.display = "block";
                    tmpTip.innerHTML = "请输入手机号";
                }
            }
            //获取查询条件值
            function getCarNumber() {
                var tmpValue = "";
                var tmpPhone = getObjectByID("inputPhoneNum");
                var state = tmpPhone.style.display == "block" ? true : false;
                if (state) {//默认手机号
                    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>