<%@ page language="C#" autoeventwireup="true" inherits="user_m_weixin_pay, DianCMS" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>确认支付</title>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
    <script src="/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="http://res.mail.qq.com/mmr/static/lib/js/lazyloadv3.js" type="text/javascript"></script>
    <meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no;" />
    <link href="/image/main.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <div class="wrap wddd">
            <h2>确认支付</h2>
        </div>
        <div class="main">
            <div class="address">
                <span class="fa"></span>
                <div>
                    <asp:Literal ID="LitAddress" runat="server"></asp:Literal>
                </div>
            </div>
            <div class="payul1">
                <ul>
                    <asp:Repeater ID="RepOrderItem" runat="server">
                        <ItemTemplate>
                            <li class="li2">
                                <img src="/upload/shop/<%#Eval("Picture") %>" alt="产品" /><div><%#Eval("Name") %>*<%#Eval("Number") %></div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>
            <div class="payul2">
                <ul>
                    <li><span>
                        <asp:Literal ID="Literal1" runat="server"></asp:Literal></span>订单号</li>
                    <li><span>¥<asp:Literal ID="Literal2" runat="server"></asp:Literal>元</span>订单金额</li>
                    <li><span>¥<asp:Literal ID="Literal3" runat="server"></asp:Literal>元</span>运费</li>
                </ul>
            </div>
            <div class="payul3">
                应付金额：<span>¥<asp:Literal ID="Literal4" runat="server"></asp:Literal></span>
                <a id="getBrandWCPayRequest" href="javascript:" class="needMoney_Purple">微信支付</a>
            </div>
        </div>
        <asp:TextBox ID="txtOrderId" runat="server" Style="display: none"></asp:TextBox>
        <script language="javascript" type="text/javascript">
            // 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
            document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
                //公众号支付
                $('#getBrandWCPayRequest').click(function (e) {
                    WeixinJSBridge.invoke('getBrandWCPayRequest', <%=wx_packageValue %> 
                , function (res) {
                    if (res.err_msg == "get_brand_wcpay_request:ok") {
                        window.location.href="/user/m/weixin/wxpayuccess.aspx?OrderId="+$("#txtOrderId").val();
                    }
                    // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                    //因此微信团队建议，当收到ok返回时，向商户后台询问是否收到交易成功的通知，若收到通知，前端展示交易成功的界面；若此时未收到通知，商户后台主动调用查询订单接口，查询订单的当前状态，并反馈给前端展示相应的界面。
                });
                });

            }, false)					  
        </script>

    </form>
</body>
</html>
