<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="BorrowDetail.aspx.cs" Inherits="WAP2P.Web.PC.Admin.BorrowLoan.BorrowDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
<style type="text/css">
    .borrowSel{overflow:hidden;}
    .borrowSel li{float:left; margin:6px;}
    .borrowSel img{float:left;}
    .borrowSel a{display:block; border:1px solid #ddd; width:350px; height:96px; background-color:#eff3f3; overflow:hidden; padding:6px;}
    .borrowSel a:hover{border-color:#aaa;}
    .borrowSel h6{font-size:20px; line-height:36px; padding-left:106px;}
    .borrowSel p{font-size:12px; padding-left:106px;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <ruson:Space runat="server" ID="start" Visible="false">
        <dl class="ui-tabs">
            <dt><a href="javascript:" class="on"><% =borrowType == null ? "选择借款类型" : IsNew ? "发布新借款-" + borrowType.Name : "借款详情-" + borrowType.Name %></a></dt>
            <dd>
                <div class="m-content">
                    <ul class="borrowSel">
                        <asp:Repeater runat="server" ID="rptBorrowType" ItemType="WAP2P.Sys.BorrowType">
                            <ItemTemplate>
                                <li><a href="javascript:void(0);" onclick="$.jPopupEdit('发布<%# Item.Name %>', 'BorrowDetail.aspx?typeId=<%# Item.Id %>');"><img src="<%# Item.Cover %>" height="96" width="96" alt="" /><h6><%# Item.Name.LeftX(8) %></h6><p><%# Item.Description.LeftX(55) %></p></a></li>
                            </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </div>
            </dd>
        </dl>
    </ruson:Space> 
    <ruson:Space runat="server" ID="selUser" Visible="false">
        <form class="auto" method="post" action="<% =Request.RawUrl %>">
            <div class="m-editbar">
                <input type="button" class="btn-larger c-normal iconfont" value="&#xe634; 关闭" onclick="parent.$.jPopupEdit.close();" />
            </div>
            <div class="m-content m-editcontent">
                <table class="m-info" cellpadding="0" cellspacing="0" width="100%">                           
                    <tr>
                        <th>借款类型</th>
                        <td><% =borrowType.Name %></td>
                    </tr>
                    <tr>
                        <th>借款用户名称</th>
                        <td>
                            <input type="button" class="btn-base c-normal iconfont" id="btnSelectUser" value="&#xe60f; 选择代发标会员" onclick="$.jPopupEdit('选择代发标会员', '../Common/UserSelect.aspx?radio=true&fn=selectUser');" />
                        </td>
                    </tr>
                </table>
            </div>
        </form>        
    </ruson:Space>               
    <ruson:Space runat="server" ID="edit">
        <form class="auto" method="post" action="<% =Request.RawUrl %>" beforeSubmit="initInterestInput();" onsuccess="parent.$.jPopupEdit.close(<% =IsNew ? string.Empty : "true" %>);">
            <div class="m-editbar">
                <input type="submit" class="btn-larger c-priority iconfont" value="&#xe684; 保存" />
                <input type="button" class="btn-larger c-normal iconfont" value="&#xe634; 关闭" onclick="parent.$.jPopupEdit.close();" />
            </div>
            <div class="m-content m-editcontent">
                <table class="m-info" cellpadding="0" cellspacing="0" width="100%">                           
                    <tr>
                        <th>借款类型</th>
                        <td><% =borrowType.Name %></td>
                    </tr>
                    <tr>
                        <th>借款用户名称</th>
                        <td>
                            <% =user.Name %> <input type="button" class="btn-base c-normal iconfont ml10" value="&#xe655; 查看资料" id="btnViewUser" onclick="$.jPopupEdit('查看会员资料', '../Common/UserInfo.aspx?Id=<% =user.Id %>');" />
                        </td>
                    </tr>
                    <tr>
                        <th>借款标题</th>
                        <td>
                            <input type="text" name="name" class="w250" maxlength="50" value="<%=Model.Name.HtmlEncode() %>" data-vtype="must" data-vmsg="请输入借款标题" />
                            <ruson:Select runat="server" ID="color">
                                <option value="" style="background-color:#fff; color:black;">默认</option>
                                <option value="red" style="background-color:red; color:#fff;">红色</option>
                                <option value="blue" style="background-color:blue; color:#fff;">蓝色</option>
                                <option value="green" style="background-color:green; color:#fff;">绿色</option>
                                <option value="purple" style="background-color:purple; color:#fff;">紫色</option>
                            </ruson:Select>
                        </td>
                    </tr>
                    <tr runat="server" id="mortgage" visible="false">
                        <th>用于该借款的抵押物</th>
                        <td>
                            <select name="mortgageId" id="mortgageId">
                                <asp:Repeater runat="server" ID="rptMortgage">
                                    <ItemTemplate>
                                        <option value="<%# Eval("Id") %>"<%# Model.MortgageId == (long)Eval("Id") ? " selected=\"selected\"" : string.Empty %> data-expires="<%# Eval("Expires") %>" data-quota="<%# ((decimal)Eval("Quota") + (Model.MortgageId.HasValue && (long)Eval("Id") == Model.MortgageId ? Model.LoanAmount : 0)) %>"><%# Eval("Name") %></option>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </select>                            
                            <span class="ml20">可用额度：<span class="fcred-2"></span> 元，到期：<span class="fcred-2"></span></span>
                        </td>
                    </tr>
                    <tr>
                        <th>借款金额</th>
                        <td>
                            <input type="text" name="loanAmount" id="loanAmount" value="<% =Model.LoanAmount.ToMoneyString() %>" class="w150 ui-float" data-vtype="money" data-vmsg="请输入正确的借款金额" /> 元
                            <em>最少<span class="fcred-2"><% =borrowType.MinAmount.ToMoneyString() %></span>元，
                                最大<span class="fcred-2" id="js-maxAmount" data-maxamount="<% =borrowType.MaxAmount %>"><% =(string.IsNullOrWhiteSpace(Request.QueryString["quota"]) ? borrowType.MaxAmount : Math.Min(Request.QueryString["quota"].ToDecimal(0), borrowType.MaxAmount)).ToMoneyString() %></span>元
                                <% =(IsNew && borrowType.ByStep) || (!IsNew && Model.ByStep) ? string.Format("，请输入<span class=\"fcred-2\">{0}</span>元的倍数", (IsNew ? borrowType.StepAmount : Model.StepAmount).ToMoneyString()) : string.Empty %>。</em>


                        </td>
                    </tr>
                    <tr>
                        <th>借款期限</th>
                        <td>
                            <input type="text" name="loanDate" value="<% =Model.LoanDate %>" class="w100 ui-int" data-vtype="number" data-vmsg="请输入正确的借款期限" /> 
                            <span class="ui-radio pl5" id="loanTimeType">
                                <asp:Repeater runat="server" ID="loanTimeType" ItemType="WAP2P.Sys.BorrowType.LoanTimeInfo">
                                    <ItemTemplate>
                                        <label><input type="radio" name="loanDateUnit" value="<%# (int)Item.Unit %>" data-min="<%# Item.Min %>" data-max="<%# Item.Max %>"<%# (IsNew && Container.ItemIndex == 0) || Item.Unit == Model.LoanDateUnit ? " checked=\"checked\"" : string.Empty %> /><%# Item.Unit.GetDescription() %></label>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </span>
                            <em>当前标类型设置：最少<span class="fcred-2" id="js-minLoanTime"></span>，最大<span class="fcred-2" id="js-maxLoanTime"></span>。</em>
                        </td>
                    </tr>
                    <tr>
                        <th>还款方式</th>
                        <td>
                            <select name="repayment" id="repayment" data-vtype="must" data-vmsg="请选择还款方式">
                                <option value="" data-minInterest="<% =(borrowType.MinInterest * 100).ToInterestString() %>%" data-maxInterest="<% =(borrowType.MaxInterest * 100).ToInterestString() %>%">请选择还款方式</option>
                                <asp:Repeater runat="server" ID="rptRepayment">
                                    <ItemTemplate>
                                        <option value="<%# Eval("Item1") %>" <%# Model.Repayment == (string)Eval("Item1") ? " selected=\"selected\"" : string.Empty %> data-minInterest="<%# (borrowType.MinInterest * 100).ToInterestString() %>%" data-maxInterest="<%# (borrowType.MaxInterest * 100).ToInterestString() %>%"><%# Eval("Item2") %></option>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>借款利率(年化率)</th>
                        <td id="interestArea">                            
                             <% if(borrowType.MinInterest == borrowType.MaxInterest) { %>
                                <span class="fcred-2 js-mininterest"><% =(borrowType.MinInterest * 100).ToInterestString() %>%</span>
                                <input type="hidden" id="ui-interest" class="js-mininterest" value="<% =IsNew ? (borrowType.MinInterest * 100).ToInterestString() : (WAP2P.Sys.FinanceHelper.DayRateTo(Model.LoanInterest.First().DayRate, BorrowType.LoanTimeUnit.Year, Model.InterestType, Model.CreateAt.Year) * 100).RoundX().ToInterestString() %>" />
                            <% } else if(borrowType.InterestPeriod > 1) { %> 
                                <span><input type="text" class="w100 ui-interest" data-vtype="money|range" data-vmax="100" data-vmsg="请输入正确的利率|利率需在0%-100%之间" value="<% =IsNew ? string.Empty : (WAP2P.Sys.FinanceHelper.DayRateTo(Model.LoanInterest.First().DayRate, BorrowType.LoanTimeUnit.Year, Model.InterestType, Model.CreateAt.Year) * 100).RoundX().ToInterestString() %>" /> %</span>
                                <span class="pl10">(执行月利率约为<span class="js-ratem fcred-3"></span>，执行日利率约为<span class="js-rated fcred-3"></span>)</span>
                                <ul class="ui-listvalue pt10" id="js-interestUl">
                                    <asp:Repeater runat="server" ID="rptInterestArea" ItemType="WAP2P.BorrowLoan.Borrow.LoanInterestInfo">
                                        <ItemTemplate>
                                            <li style="height:52px; width:500px;">
                                                <a href="javascript:void(0)" class="iconfont fs22 listvalue-delete js-areaOper" title="删除">&#xe65a;</a>
                                                <div class="pt10">
                                                    投标金额 >= <input type="text" class="w100 ui-float" data-vtype="money" value="<%# Item.Amount.ToMoneyString() %>" data-vmsg="请输入正确的金额" /> 元时，执行年化率 <input type="text" class="w100 ui-interest" value="<%# (WAP2P.Sys.FinanceHelper.DayRateTo(Item.DayRate, BorrowType.LoanTimeUnit.Year, Model.InterestType, Model.CreateAt.Year) * 100).RoundX().ToInterestString() %>" data-vtype="money|range" data-vmax="100" data-vmsg="请输入正确的利率|利率需在0%-100%之间" /> %                    
                                                </div>
                                            </li>
                                        </ItemTemplate>
                                    </asp:Repeater>                                    
                                </ul>
                                <input type="button" class="btn-base c-normal iconfont js-areaOper" id="js-btnInterestArea" value="&#xe67a; 新增利率区间" onclick="$('#js-interestUl').append(document.getElementById('tmpInterest').innerHTML);" />
                                <em>最小年化率<span class="fcred-2 js-mininterest"><% =(borrowType.MinInterest * 100).ToInterestString() %>%</span>，最大年化率<span class="fcred-2 js-maxinterest"><% =(borrowType.MaxInterest * 100).ToInterestString() %>%</span>。</em>
                                <input type="hidden" id="interestPeriod" value="<% =borrowType.InterestPeriod - 1 %>" />
                            <% } else { %>
                                <span><input type="text" class="w100 ui-interest" data-vtype="money|range" data-vmax="100" data-vmsg="请输入正确的利率|利率需在0%-100%之间" value="<% =IsNew ? string.Empty : (WAP2P.Sys.FinanceHelper.DayRateTo(Model.LoanInterest.First().DayRate, BorrowType.LoanTimeUnit.Year, Model.InterestType, Model.CreateAt.Year) * 100).RoundX().ToInterestString() %>" /> %</span>
                                <span class="pl10">(执行月利率约为<span class="js-ratem fcred-3"></span>，执行日利率约为<span class="js-rated fcred-3"></span>)</span>
                                <em>最小年化率<span class="fcred-2 js-mininterest"><% =(borrowType.MinInterest * 100).ToInterestString() %>%</span>，最大年化率<span class="fcred-2 js-maxinterest"><% =(borrowType.MaxInterest * 100).ToInterestString() %>%</span>。</em>
                            <% } %>
                            <input type="hidden" name="loanInterestJson" id="loanInterestJson" />
                        </td>
                    </tr>
                    <tr>
                        <th>投标结束时间</th>
                        <td>
                            <input type="text" placeholder="请设置结束时间" name="bidEndAt" value="<% =Model.BidEndAt.ToDateTimeString() %>" class="w150 ui-date ui-datetime" data-vtype="date" data-vmsg="请输入结束时间" />                        
                        </td>
                    </tr>
                    <tr>
                        <th>投资限额</th>
                        <td>
                            <div class="mt5 mb5">
                                单次至少投资 <input type="text" name="bidMinAmount" value="<% =IsNew ? borrowType.StepAmount.ToMoneyString() : Model.BidMinAmount.ToMoneyString() %>" class="w100 ui-float" /> 元 
                            </div>
                            <div class="mt5 mb5">
                                最多可以投资 <input type="text" name="bidMaxAmount" value="<% =Model.BidMaxAmount.ToMoneyString() %>" class="w100 ui-float" /> 元
                            </div>
                            <% =borrowType.ByStep ? string.Format("<em>请输入 {0} 元的整数倍</em>", borrowType.StepAmount.ToMoneyString()) :string.Format("<em>最小投资金额必须大于或等于 {0} 元，最大投资金额不填则不限制。</em>", borrowType.StepAmount.ToMoneyString()) %>
                        </td>
                    </tr>
                    <% if(borrowType.AdvanceRepay != BorrowType.AdvanceRepayEnum.NoSupport) { %>
                    <tr>
                        <th>满标立即还款</th>
                        <td>
                            <% =HtmlHelper.CheckBox("bidFullAutoRepay", "满标立即还款", Model.BidFullAutoRepay) %>
                        </td>
                    </tr>
                    <% } %>
                    <tr>
                        <th>定向密码</th>
                        <td>
                            <input name="passwordCode" value="<% =Model.PasswordCode.HtmlEncode() %>" class="w250" maxlength="50" />
                            <em>设置定向密码，则该笔借款只允许获得此密码的会员进行投资。不填则无设定。</em>
                        </td>
                    </tr>
                    <tr>
                        <th>投标奖励</th>
                        <td>
                            <div class="ui-radio" id="bidReward">
                                <label><input type="radio" name="bidRewardType" value="<% =(int)WAP2P.BorrowLoan.Borrow.BidReward.None %>"<% =Model.BidRewardType == WAP2P.BorrowLoan.Borrow.BidReward.None ? " checked=\"checked\"" : string.Empty %> /> <% =WAP2P.BorrowLoan.Borrow.BidReward.None.GetDescription() %></label>                                
                                <label><input type="radio" name="bidRewardType" value="<% =(int)WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio %>"<% =Model.BidRewardType == WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio ? " checked=\"checked\"" : string.Empty %> /> <% =WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio.GetDescription() %></label>
                                <span class="g-hide"><input type="text" name="bidRewardRatio" class="ui-interest w100" value="<% =Model.BidRewardRatio.HasValue ? (Model.BidRewardRatio.Value * 100).ToInterestString() : string.Empty %>" data-vtype="money" data-vmsg="请输入正确的值" data-vmust="false" /> %</span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>信息公开</th>
                        <td>
                            <div class="ui-checkbox">
                                <div class="mt5">
                                    <% =HtmlHelper.CheckBox("openMyInfo", "公开基本信息资料", Model.OpenMyInfo) %>
                                    <span class="ml20"><% =HtmlHelper.CheckBox("openMyBorrowInfo", "公开我的借款资料", Model.OpenMyBorrowInfo) %></span>
                                </div>
                                <div class="mt5">
                                    <% =HtmlHelper.CheckBox("openMyBid", "公开我的投资记录", Model.OpenMyBid) %>
                                    <span class="ml20"><% =HtmlHelper.CheckBox("openMyBorrow", "公开我的借款记录", Model.OpenMyBorrow) %></span>
                                </div>
                                <div class="mt5">
                                    <% =HtmlHelper.CheckBox("openMyQuota", "公开我的额度状况", Model.OpenMyQuota) %>
                                    <span class="ml20"><% =HtmlHelper.CheckBox("openMyAccount", "公开我的资金账户", Model.OpenMyAccount) %></span>
                                </div>
                            </div>
                        </td>
                    </tr>       
                    <asp:Repeater runat="server" ID="rptBorrowUserFilters">
                        <ItemTemplate>
                            <tr>
                                <th><%# Eval("Item2") %></th>
                                <td><%# ConfigService.GetConfig<WAP2P.BorrowLoan.IBorrowUserFilter>((string)Eval("Item1")).SettingHtml(Model.UserFilterInterfaces == null ? null : (Model.UserFilterInterfaces.FirstOrDefault(item => item.Id == (string)Eval("Item1")) ?? new ExtensionSetting()).Setting) %></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <th>封面图片</th>
                        <td>
                            <div id="coverResult" class="mb10"><% =string.Format("<img src=\"{0}\" alt=\"\">", Model.GetCover())  %></div>
                            <div class="pl136" ><input type="hidden" name="cover" id="cover" value="<% =Model.Cover.HtmlEncode() %>" /></div>
                            <input type="file" id="coverFile" />
                            <em>请上传尺寸为 <i class="fcred-3">330 X 220 像素</i> 的封面图片</em>
                        </td>
                    </tr>
                    <tr>
                        <th>借款用途</th>
                        <td>
                            <textarea name="useTo" data-vtype="must" data-vmsg="请输入贷款用途"><% =Model.UseTo.HtmlEncode() %></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>还款来源</th>
                        <td> <textarea name="repaySrc" data-vtype="must" data-vmsg="请输入还款来源"><% =Model.RepaySrc.HtmlEncode() %></textarea>
                    </tr>
                    <tr>
                        <th>补充说明</th>
                        <td><script id="detail" name="detail" class="ui-editor" type="text/plain"><%= Model.Detail %></script></td>
                    </tr>
                </table>                        
            </div>
        </form>
        <script type="text/template" id="tmpInterest">
            <li style="height:52px; width:500px;">
                <a href="javascript:void(0)" class="iconfont fs22 listvalue-delete js-areaOper" title="删除">&#xe65a;</a>
                <div class="pt10">
                    投标金额 >= <input type="text" class="w100 ui-float" data-vtype="money" data-vmsg="请输入正确的金额" /> 元时，执行年化率 <input type="text" class="w100 ui-interest" data-vtype="money|range" data-vmax="100" data-vmsg="请输入正确的利率|利率需在0%-100%之间" /> %                    
                </div>
            </li>
        </script>
    </ruson:Space>
</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 selectUser(obj) {
            if (obj && obj.users && obj.users.length) {
                $.ajax({
                    url: '?action=checkUserBorrow',
                    data: { typeId: '<% =Request.QueryString["typeId"] %>', userId: obj.users[0].id },
                    dataType: "json",
                    success: function (res) {
                        $.jPopupEdit.close();
                        if (res.Success) {
                            var url = utils.urlParam(location.href, 'userId', obj.users[0].id);
                            url = utils.urlParam(url, 'quota', res.Message);
                            location.href = url;
                        } else {
                            $.jError(res.Message);
                        }
                    }
                });

                return false;
            }
        };
        var btnSelectUser = $('#btnSelectUser');
        if (btnSelectUser.length) {
            btnSelectUser.trigger('click');
        };

        //借款期限
        var loanTimeTypeChange = function() {
            var chk = $('#loanTimeType :checked'), txt = chk.parent().text();
            $('#js-minLoanTime').html(chk.attr('data-min') + txt);
            $('#js-maxLoanTime').html(chk.attr('data-max') + txt);
        };
        $('#loanTimeType').change(loanTimeTypeChange);
        loanTimeTypeChange();

        //还款方式
        var repaymentChange = function () {
            var op = $('#repayment :selected');
            $('.js-mininterest').val(op.attr('data-minInterest')).text(op.attr('data-minInterest'));
            $('.js-maxinterest').val(op.attr('data-maxInterest')).text(op.attr('data-maxInterest'));
        };
        repaymentChange();
        $('#repayment').change(repaymentChange);

        //利率
        var intersetReset = function(dom) {            
            dom = $(dom);
            var val = parseFloat(dom.val()), ctr = dom.closest('span').next();            
            ctr.find('.js-ratem').html(finance.yearRateTo(val, 'm'));
            ctr.find('.js-rated').html(finance.yearRateTo(val, 'd'));
        };
        $('#interestArea .ui-interest').each(function(i, n) {
            intersetReset(n);
        }).keyup(function() {
            intersetReset(this);
        });
        
        var interestAddbtn = $('#js-btnInterestArea');
        var interestBtnToggle = function() {
            if ($('#js-interestUl li').length >= parseInt($('#interestPeriod').val()))
                interestAddbtn.hide();                
            else
                interestAddbtn.show();
        };
        $('#interestArea').on('click', '.js-areaOper', function() {
            var parent = $(this).parent();
            if (parent.is('li'))
                parent.remove();

            interestBtnToggle();
        });
        interestBtnToggle();

        function initInterestInput() {
            var obj = [];
            var interests = $('#interestArea .ui-interest'), amounts = $('#interestArea .ui-float');            
            interests.each(function(i, n) {                
                obj.push({
                    Amount: i == 0 ? 0 : parseFloat($(amounts.eq(i-1)).val().replace(/,/g, '')),  //第一个为默认
                    DayRate : parseFloat($(n).val())  //注意这里是年化率，需在服务端重新算
                });
            });
            $('#loanInterestJson').val(utils.toJsonString(obj));
        }

        //颜色
        var colorChange = function() {
            var option = $('#color :selected');
            $('#color').css({
                background: option.css('background-color'),
                color: option.css('color')
            });
        };
        colorChange();
        $('#color').change(colorChange);

        //抵押
        var mortgageId = $('#mortgageId');
        var mortgageChange = function () {
            var sel = mortgageId.find(':selected');
            var max = $('#js-maxAmount');
            mortgageId.next().find('span:first').text(finance.toMoneyString(sel.attr('data-quota')));
            mortgageId.next().find('span:last').text(finance.toMoneyString(sel.attr('data-expires')));

            max.text(finance.roundx(sel.attr('data-quota'),2) > finance.roundx(max.attr('data-maxamount'),2) ?  
                finance.toMoneyString(max.attr('data-maxamount')) :  finance.toMoneyString(sel.attr('data-quota')) );
        };
        if (mortgageId.length) {
            mortgageId.change(mortgageChange);
            mortgageChange();
        }

        //封面图片
        setTimeout(function() {
            $('#coverFile').uploadify({
                width: 120,
                height: 32,
                multi: false,
                removeTimeout: 0,
                swf: '../res/uploadify/uploadify.swf?v=<% =CryptoHelper.Random(100000,999999) %>',
                uploader: '../res/uploadify/SwfUpload.aspx?type=image&width=330&height=220',
                buttonClass:'iconfont',
                buttonText: '&#xe629; 上传封面图',
                fileTypeExts: '<% =WAP2P.Web.PC.Admin.Res.uploadify.SwfUpload.AllowImages %>',
                formData: {
                    <% =WAP2P.Web.Admin.Membership.CookieName %> : '<% =Request.Cookies[WAP2P.Web.Admin.Membership.CookieName].Value %>'
                },
                onUploadSuccess: function(res, data) {
                    eval('var d = ' + data);
                    if (d.Success) {
                        $('#cover').val(d.Message).trigger('blur');                    
                        $('#coverResult').html('<img src="' + d.Message + '" />');
                    } else {
                        $.jError(d.Message);
                    }
                }
            });
        }, 10);

        //开关切换
        function toggleRadioNext(td) {
            $(td).find(':radio').each(function(i, n) {
                var next = $(n).parent().next();
                if (next.length && next[0].tagName == 'SPAN') {
                    if (n.checked) {
                        next.show();
                        next.find(':input').attr('data-vmust', 'true');
                    }
                    else {
                        next.hide();
                        next.find(':input').attr('data-vmust', 'false');
                    }
                }
            });            
        };

        toggleRadioNext('#bidReward');
        $('#bidReward :radio').click(function() { toggleRadioNext('#bidReward') });

        toggleRadioNext('#vouchReward');
        $('#vouchReward :radio').click(function() { toggleRadioNext('#vouchReward') });
    </script>    
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>