<%@ Page Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="BusinessGlobalSetting.aspx.cs" Inherits="WAP2P.Web.PC.Admin.Sys.BusinessGlobalSetting" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
    <style type="text/css">
        .acc-order input {margin-left: 10px;}
        .acc-order li{float: left; width: 150px; height: 36px; text-align: center; line-height: 36px; margin: 5px; border: 1px solid #ccc; box-shadow: 1px 1px 1px #ccc;}
        .acc-order li a{margin: 0 5px; padding: 5px; font-size: 16px; visibility: hidden; color: #808080;}
        .acc-order li:hover a {visibility: visible;}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <dl class="ui-tabs">
        <dt><a href="?type=account" class="<%= type == "account" ? "on" : string.Empty %>">资金帐户设置</a></dt>
        <dt><a href="?type=risk" class="<%= type == "risk" ? "on" : string.Empty %>">风控设置</a></dt>
        <dt><a href="?type=agreement" class="<%= type == "agreement" ? "on" : string.Empty %>">合同协议</a></dt>

        <ruson:Space runat="server" ID="account" Visible="false">
            <dd>
                <form action="<% =Request.RawUrl %>" method="post" class="auto" beforesubmit="setAccOrder();">
                    <div class="m-content">
                        <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <th>月结日</th>
                                <td>
                                    <input type="text" name="monthlyDay" class="w250 ui-int" data-vtype="number|range" data-vmsg="请输入正确的数字|月结日应在1-28之间" data-vmust="false" data-vmin="1" data-vmax="28" value="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.MonthlyDay) %>" />
                                    <em>表示月份中的N号，在有月结日情况下才输入此值。</em>
                                </td>
                            </tr>
                            <tr>
                                <th>每日最大充值金额</th>
                                <td>
                                    <input type="text" name="maxRechargeAmount" class="w250 ui-int" data-vtype="number" data-vmsg="请输入正确的充值金额" data-vmust="false" value="<%= GlobalSetting.Get(GlobalSetting.Keys.Account.MaxRechargeAmount) %>" /> 元
                                    <em>不填写则不限制，0为暂时停用充值。</em>
                                </td>
                            </tr>
                            <tr>
                                <th>单笔最小提现金额</th>
                                <td>
                                    <input type="text" name="minCashAmount" class="w250 ui-int" data-vtype="number" data-vmsg="请输入正确的金额" data-vmust="false"  value="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.MinCashAmount) %>" /> 元
                                </td>
                            </tr>
                            <tr>
                                <th>每日最大提现金额</th>
                                <td>
                                    <input type="text" name="maxCashAmount" class="w250 ui-int" data-vtype="number" data-vmsg="请输入正确的金额" data-vmust="false"  value="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.MaxCashAmount) %>" /> 元
                                    <em>不填写则不限制，0为暂时停用提现。</em>
                                </td>
                            </tr>
                            <tr>
                                <th>每笔提现固定加收费用</th>
                                <td>
                                    <input type="text" name="cashAmountFixedFee" class="w250 ui-int" data-vtype="number" data-vmsg="请输入正确的金额" data-vmust="false"  value="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.CashAmountFixedFee) %>" /> 元
                                </td>
                            </tr>
                            <tr>
                                <th>提现代付接口标识</th>
                                <td>
                                    <input type="text" name="cashPayCallCode" class="w250" value="<% =GlobalSetting.Get(GlobalSetting.Keys.Account.CashPayCallCode).HtmlEncode() %>" />
                                    <em>对应支付设置中调用标识</em>
                                </td>
                            </tr>
                            <tr>
                                <th colspan="2" class="info-listhead">会员资金帐户扣款顺序</th>
                            </tr>
                            <asp:Repeater runat="server" ID="rptOrderList" >
                                <ItemTemplate>
                                    <tr>
                                        <th><%# Eval("Value") %></th>
                                        <td>
                                            <ul class="acc-order js-accorder" data-orderType="<%# Eval("Key") %>">
                                                <asp:Repeater runat="server" ID="rptList">
                                                    <ItemTemplate>
                                                        <li data-id="<%# Eval("Key") %>"><input class="mg5" type="checkbox" name="statu" <%# (int)Eval("Order") != 99999 || order.Count == 0 ? "checked=\"checked\"" : string.Empty %>  /><a href="javascript:void(0)" class="iconfont l">&#xe675;</a><%# Eval("Value") %><a href="javascript:void(0)" class="iconfont r">&#xe676;</a></li>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </ul>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>                            
                        </table>
                        <input type="hidden" id="valuesJson" name="valuesJson" />
                        <div class="g-fright pt10 pr5">
                            <input type="submit" class="btn-larger c-priority iconfont" value="&#xe684; 保存" />
                        </div>
                    </div>
                </form>
            </dd>
        </ruson:Space>

        <ruson:Space runat="server" ID="risk" Visible="false">
            <dd>
                <form action="<% =Request.RawUrl %>" method="post" class="auto">
                    <div class="m-content">                        
                        <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <th colspan="6" class="info-listhead">风险等级可用信用额度比</th>
                            </tr>
                            <tr>
                                <asp:Repeater runat="server" ID="rptGradeLevel" >
                                    <ItemTemplate>
                                        <%# Container.ItemIndex >0 && Container.ItemIndex % 3 == 0 ? "</tr><tr>" : string.Empty  %>
                                        <th><%# Eval("Value") %></th>
                                        <td><input name="gradeCreditQuotaRate" class="w100 ui-int" data-vtype="number" data-vmust="false" data-vmsg="请输入正确的数字" placeholder="100" value="<%# (WAP2P.Member.QuotaLog.GetGradeCreditQuotaRate((WAP2P.Member.GradeLevel)Eval("Key")) * 100).ToInterestString() %>" /> %</td>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <td colspan="2"><em>说明：用户所在信用等级额度 x 本比例 = 信用额度</em></td>
                            </tr>
                            <tr>
                                <th>实名认证</th>
                                <td colspan="5">
                                    <% =HtmlHelper.CheckBox("realnameNeedPhoto", "实名认证需上传身份证照片", GlobalSetting.Get<bool>(GlobalSetting.Keys.Risk.RealnameNeedPhoto)) %>
                                </td>
                            </tr>
                            <tr>
                                <th>银行卡</th>
                                <td colspan="5">
                                    <% =HtmlHelper.CheckBox("bankCardOnlyOneAndCannotChange", "仅能添加一张银行卡且不能修改", GlobalSetting.Get<bool>(GlobalSetting.Keys.Risk.BankCardOnlyOneAndCannotChange)) %>
                                </td>
                            </tr>
                        </table>
                        <input type="hidden" id="valuesJson" name="valuesJson" />
                        <div class="g-fright pt10 pr5">
                            <input type="submit" class="btn-larger c-priority iconfont" value="&#xe684; 保存" />
                        </div>
                    </div>
                </form>
            </dd>
        </ruson:Space>

        <ruson:Space runat="server" ID="agreement" Visible="false">
            <dd>
                <form action="<% =Request.RawUrl %>" method="post" class="auto">
                    <div class="m-content">                        
                        <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <th class="info-listhead">用户注册协议</th>
                            </tr>
                            <tr>
                                <td><script id="userRegAgreement" name="userRegAgreement" class="ui-editor" type="text/plain"><%= GlobalSetting.Get(GlobalSetting.Keys.Agreement.UserRegAgreement) %></script></td>
                            </tr>
                            <tr>
                                <th class="info-listhead">智能投标协议</th>
                            </tr>
                            <tr>
                                <td><script id="autoBidAgreement" name="autoBidAgreement" class="ui-editor" type="text/plain"><%= GlobalSetting.Get(GlobalSetting.Keys.Agreement.AutoBidAgreement) %></script></td>
                            </tr>
                            <tr>
                                <th class="info-listhead">委托投资协议</th>
                            </tr>
                            <tr>
                                <td><script id="entrustBidAgreement" name="entrustBidAgreement" class="ui-editor" type="text/plain"><%= GlobalSetting.Get(GlobalSetting.Keys.Agreement.EntrustBidAgreement) %></script></td>
                            </tr>
                            <tr>
                                <th class="info-listhead">预约协议</th>
                            </tr>
                            <tr>
                                <td><script id="reservationAgreement" name="reservationAgreement" class="ui-editor" type="text/plain"><%= GlobalSetting.Get(GlobalSetting.Keys.Agreement.ReservationAgreement) %></script></td>
                            </tr>
                        </table>                        
                        <div class="g-fright pt10 pr5">
                            <input type="submit" class="btn-larger c-priority iconfont" value="&#xe684; 保存" />
                        </div>
                    </div>
                </form>
            </dd>
        </ruson:Space>
    </dl>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script src="<% =this.ImportJsCss("../res/ueditor/ueditor.config.js") %>"></script>
    <script src="<% =this.ImportJsCss("../res/ueditor/ueditor.all.min.js") %>"></script>
    <script>        
        function setAccOrder() {
            var obj = [];
            $('.js-accorder').each(function (i, n) {
                var values = [];
                $('li', n).each(function (j, m) {
                    if ($(m).find('input[name=statu]').is(':checked')) 
                        values.push($(m).attr('data-id'));
                });
                var order = {
                    OrderType: $(this).attr('data-orderType'),
                    Values: values
                };
                if (order)
                    obj.push(order);
            });
            $('#valuesJson').val(utils.toJsonString(obj));
        };

        $('.js-accorder').on('click', 'a', function () {
            var me = $(this), li = me.closest('li');
            if (me.hasClass('r')) {
                var next = li.next();
                if (next.length)
                    next.after(li);
                else
                    li.parent().prepend(li);
            } else {
                var pre = li.prev();
                if (pre.length)
                    pre.before(li);
                else
                    li.parent().append(li);
            }
        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server"></asp:Content>
