<hi:common_aliohheader runat="server" />
<div class="pbox apply-title search btn-group btn-group-justified">
    <div class="btn-group">
        <a href="#" type="button" class="btn btn-default active">申请提现</a>
    </div>
    <div class="btn-group">
        <a href="SplittinDrawRecords.aspx" type="button" class="btn btn-default">提现记录</a>
    </div>
</div>

<form id="form" role="form" class="pbox clearfix" runat="server">
    <div class="form-group">
        <label for="username">提现金额：</label>
        <div class="input-group">
            <input type="text" class="form-control" id="txtAmount" placeholder="">
            <span class="input-group-addon">元</span>
        </div>
        <p class="text-muted">最多可提现：￥<span id="spanMaxdraws"><%<asp:Literal ID="lblBanlance" runat="server" />%></span></p>
    </div>
    <div class="form-group">
        <label for="phone">提现帐号：</label>
        <textarea class="form-control" id="txtAccount" placeholder="填写你的提现帐号" rows="3"></textarea>
    </div>
    <div class="form-group">
        <label for="phone">交易密码：</label>
        <input type="password" class="form-control" id="txtTradePassword" placeholder="填写你的交易密码" />
    </div>

    <br />
    <button type="button" id="btnDraws" class="btn btn-danger btn-block">申请提现</button>
    <p class="text-muted">上次提现日期：<%<asp:Literal ID="lblLastDrawTime" runat="server" />%></p>

</form>
<script type="text/javascript">
    $(document).ready(function (e) {
        $("#btnDraws").click(function (e) {
            var amount = parseFloat($("#txtAmount").val());
            var maxDraws = parseFloat($("#spanMaxdraws").html());
            if (isNaN(maxDraws) || maxDraws < 0) maxDraws = 0;
            if (isNaN(amount) || amount <= 0 || amount > maxDraws) {
                alert_h("请填写提现金额，提现金额必须大于0，且不大于最多可以提现金额。！"); return false;
            }
            if ($("#txtAccount").val().trim().length == 0 || $("#txtAccount").val().trim().length > 300) {
                alert_h("请填写提现帐号，长度控制在300字以内！"); return false;
            }
            if ($("#txtTradePassword").val().trim().length <= 0) {
                alert_h("请填写交易密码。"); return false;
            }
            var data = {};
            var amount = $("#txtAmount").val().trim();
            var account = $("#txtAccount").val().trim();
            var tradePassword = $("#txtTradePassword").val().trim();
            data.Amount = amount;
            data.Account = account;
            data.TradePassword = tradePassword;
            $.post("/api/VshopProcess.ashx?action=SplittinDraws", data, function (json) {
                if (json.success === true) {
                    alert_h("申请提交成功", function () {
                        location.reload();
                    });
                }
                else {
                    alert_h(json.msg);
                }
            });
        })
    });
</script>
<hi:common_aliohfooter runat="server" />