<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="CN">
<head>
    <title>手机网站支付接口</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery.serializeJSON/3.2.1/jquery.serializejson.min.js"></script>
    <script src="https://baa-pay-server-pay.liangkebang.net/tech/ipv4"></script>
    <!--    <meta http-equiv="refresh" content="url=[[${payUrl}]]">-->
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul, ol {
            list-style: none;
        }

        body {
            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
        }

        .hidden {
            display: none;
        }

        .new-btn-login-sp {
            padding: 1px;
            display: inline-block;
            width: 75%;
        }

        .new-btn-login {
            background-color: #02aaf1;
            color: #FFFFFF;
            font-weight: bold;
            border: none;
            width: 100%;
            height: 30px;
            border-radius: 5px;
            font-size: 16px;
        }

        #main {
            width: 100%;
            margin: 0 auto;
            font-size: 14px;
        }

        .red-star {
            color: #f00;
            width: 10px;
            display: inline-block;
        }

        .null-star {
            color: #fff;
        }

        .content {
            margin-top: 5px;
        }

        .content dt {
            width: 100px;
            display: inline-block;
            float: left;
            margin-left: 20px;
            color: #666;
            font-size: 13px;
            margin-top: 8px;
        }

        .content dd {
            margin-left: 120px;
            margin-bottom: 5px;
        }

        .content dd input, .content dd select {
            width: 85%;
            height: 28px;
            border: 0;
            -webkit-border-radius: 0;
            -webkit-appearance: none;
        }

        #foot {
            margin-top: 10px;
            position: absolute;
            bottom: 15px;
            width: 100%;
        }

        .foot-ul {
            width: 100%;
        }

        .foot-ul li {
            width: 100%;
            text-align: center;
            color: #666;
        }

        .note-help {
            color: #999999;
            font-size: 12px;
            line-height: 130%;
            margin-top: 5px;
            width: 100%;
            display: block;
        }

        #btn-dd {
            margin: 20px;
            text-align: center;
        }

        .foot-ul {
            width: 100%;
        }

        .one_line {
            display: block;
            height: 1px;
            border: 0;
            border-top: 1px solid #eeeeee;
            width: 100%;
            margin-left: 20px;
        }

        .am-header {
            display: -webkit-box;
            display: -ms-flexbox;
            display: box;
            width: 100%;
            position: relative;
            padding: 7px 0;
            -webkit-box-sizing: border-box;
            -ms-box-sizing: border-box;
            box-sizing: border-box;
            background: #1D222D;
            height: 50px;
            text-align: center;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            box-pack: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            box-align: center;
        }

        .am-header h1 {
            -webkit-box-flex: 1;
            -ms-flex: 1;
            box-flex: 1;
            line-height: 18px;
            text-align: center;
            font-size: 18px;
            font-weight: 300;
            color: #fff;
        }
    </style>
</head>
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
<header class="am-header">
    <h1>手机网站支付接口</h1>
</header>
<div id="main">
    <form name=payment action='' method=post target="_blank"  enctype="application/x-www-form-urlencoded" th:object="${requestData}">
        <div id="body" style="clear:left">
            <dl class="content">
                <dt>支付方式
                    ：
                </dt>
                <dd>
                    <select name="data[chan_id]">
                        <option value="75772285618946309">微信</option>
                        <option value="75772285618946317_wxd678efh567hg6787">支付宝</option>
                    </select>
                </dd>
                <hr class="one_line">

                <dt>商户订单号
                    ：
                </dt>
                <dd>
                    <input id="outTradeNo" name="data[out_trade_no]"/>
                </dd>
                <hr class="one_line">
                <dt>订单名称
                    ：
                </dt>
                <dd>
                    <input id="subject" name="data[subject]"/>
                </dd>
                <hr class="one_line">
                <dt>付款金额
                    ：
                </dt>
                <dd>
                    <input id="amount" name="data[amount]"/>
                </dd>
                <hr class="one_line">
                <dt>商品描述：</dt>
                <dd>
                    <input id="body" name="data[body]"/>
                </dd>
                <hr class="one_line">
                <dt>openId：</dt>
                <dd>
                    <input id="accountNo" name="data[account_no]" value="oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"/>
                </dd>
                <hr class="one_line">
                <dt>通知地址：</dt>
                <dd>
                    <input id="notifyUrl" name="data[notify_url]" value="https://baa-pay-server-pay.liangkebang.net/debug/merchant/pay"/>
                </dd>
                <hr class="one_line">
                <dt>IP地址：</dt>
                <dd>
                    <input id="requestIp" name="request_ip" value=""/>
                </dd>
                <hr class="one_line">
                <dt></dt>
                <dd id="btn-dd">
                        <span class="new-btn-login-sp">
                            <button class="new-btn-login" type="button" style="text-align:center;">确 认</button>
                        </span>
                    <span class="note-help">如果您点击“确认”按钮，即表示您同意该次的执行操作。</span>
                </dd>
            </dl>
        </div>
    </form>
    <div id="foot">
        <ul class="foot-ul">
            <li>
                QUANTGROUP.CN
            </li>
        </ul>
    </div>
</div>
</body>
<script language="javascript">
    $(".new-btn-login").click(function() {
        $.ajax({
            type: "post",
            url: '/pay/goPay',
            async: false, // 使用同步方式
            // 1 需要使用JSON.stringify 否则格式为 a=2&b=3&now=14...
            // 2 需要强制类型转换，否则格式为 {"a":"2","b":"3"}
            data: JSON.stringify($('form').serializeJSON()),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                window.location.href = data.result.prepay;
            } // 注意不要在此行增加逗号
        });
    });
    function GetDateNow() {
        var vNow = new Date();
        var sNow = "";
        sNow += String(vNow.getFullYear());
        sNow += String(vNow.getMonth() + 1);
        sNow += String(vNow.getDate());
        sNow += String(vNow.getHours());
        sNow += String(vNow.getMinutes());
        sNow += String(vNow.getSeconds());
        sNow += String(vNow.getMilliseconds());
        document.getElementById("outTradeNo").value = sNow;
        document.getElementById("subject").value = "测试";
        document.getElementById("amount").value = "0.01";
        document.getElementById("body").value = "购买测试商品0.01元";
        document.getElementById("requestIp").value = CLIENT_IP;
    }

    GetDateNow();
</script>
</html>