<%@ Page Language="C#" CodeBehind="PayPassword.aspx.cs" Inherits="WAP2P.Web.PC.User.PayPassword" %>
<div class="mini-box">
    <div class="paypassword form-normal">
        <form class="js-auto js-vsum" method="post" action="<% =Request.RawUrl.UrlEncodeParam() %>" data-onsuccess="if(window['payCallback']) window['payCallback']();">
            <div class="minimiddle">
                <div class="input-big">
                    <label class="leftfont">当前正进行</label>
                    <span class="fcblue-2"><% =GetActionDescription() %></span>
                </div>
                <ruson:Space ID="appointment" runat="server" Visible="false">
                    <div class="input-big">
                        <label class="leftfont">预约金额</label>
                        <span class="fcred-3"><% =amount.ToMoneyString() %>元</span>
                    </div>
                </ruson:Space>
                <ruson:Space ID="amountSpace" runat="server" Visible="false">
                    <div class="input-big">
                        <label class="leftfont">操作金额</label>
                        <span class="fcred-3 js-amountmoney"><% =(action == WAP2P.Account.AccountActionType.交纳预约保证金 ? amount * reservation.BailRate : amount).ToMoneyString() %>元<% =action == WAP2P.Account.AccountActionType.交纳预约保证金 ? " (保证金)" : string.Empty %></span>
                    </div>
                </ruson:Space>
                <ruson:Space ID="isRedPackageSpace" runat="server" Visible="false">
                    <div class="input-big">
                        <label class="leftfont">使用红包</label>
                        <span><% =HtmlHelper.CheckBox("isUseRedPackage" , "使用" , true, new Dictionary<string, string> { { "onclick", "isUseRedPackageClick()" } }) %></span>
                        <input type="hidden" id="redMoney" value="<% =redMoney %>" />
                        <input type="hidden" id="amountMoney" value="<% =amount %>" />
                    </div>
                </ruson:Space>
                <ruson:Space ID="passwordCode" runat="server" Visible="false">
                    <div class="input-big">
                        <label class="leftfont">定向密码</label>
                        <input type="password" class="text" name="passwordCode" maxlength="50" data-vtype="must" data-vmsg="请输入的定向密码。" placeholder="请输入的定向密码" />
                    </div>
                </ruson:Space>
                <ruson:Space ID="finance" runat="server" Visible="false">
                    <div class="input-big">
                        <label class="leftfont">认购金额</label>
                        <span class="fcred-3"><% =amount.ToMoneyString() %> 元</span>
                    </div>
                </ruson:Space>                
                <div class="input-big">
                    <label class="leftfont">支付密码</label>
                    <input type="password" class="text" name="password" maxlength="50" data-vtype="must" data-vmsg="请输入您的支付密码。" placeholder="请输入您的支付密码" />
                </div>
            </div>
            <div class="minifoot">
                <input type="submit" value="提交" class="btn-nobord c-important w70" />
                <input type="button" value="取消" class="btn-nobord c-normal w70 mr20" onclick="$(document.body).dialog('destroy');" />
                <em class="m-sumtip js-vsum"></em>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        function isUseRedPackageClick() {
            var isUse = document.getElementById('isUseRedPackage');
            if (isUse) {
                if (isUse.checked == true) {
                    var redMoney = finance.toMoneyNumber($('#redMoney').val());
                    var money = finance.toMoneyNumber($('#amountMoney').val()) - redMoney;
                    if (money < 0) {
                        money = 0;
                        redMoney = finance.toMoneyNumber($('#amountMoney').val());
                    }

                    $('.js-amountmoney').html(finance.toMoneyString(money) + ' 元 (红包：' + finance.toMoneyString(redMoney) + ' 元)');
                }
                else {
                    $('.js-amountmoney').html(finance.toMoneyString($('#amountMoney').val()) + ' 元');
                }
            }
        }

        $(function () { isUseRedPackageClick(); });
    </script>
</div>
