<%@ Page Title="" Language="C#" MasterPageFile="~/Master/MainMaster.master" CodeBehind="Detail.aspx.cs" Inherits="WAP2P.Web.PC.Borrow.Detail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-page">
        <div class="m-container g-ohide mt10">
            <div class="m-crumbs">
                <ul class="g-left">
                    <li><a href="/"><i class="iconfont">&#xe630;</i> 首页</a> &nbsp;>&nbsp;</li>
                    <li><a href="/Borrow/">投资列表</a> &nbsp;>&nbsp;</li>
                    <li><% =borrow.Name %></li>
                </ul>                
            </div>
        </div>

        <div class="m-container m-globalbox g-ohide m-detailbid mt10">
            <h5 class="darailbid-title g-ohide m-boborder pt15 pb15 pl10">
                <img src="<% =WAP2P.Sys.BorrowType.LoadOrNew(borrow.TypeId).Icon %>" style="width: 60px; height: 18px;" class="g-left mr10" />
                <span class="fs18 g-left"><% =borrow.Name %></span>
                <span class="g-right title-time js-time mr10"></span>
            </h5>
            <div class="g-left wg9 g-ohide m-rightborder">
                <ul class="darailbid-baselist">
                    <li class="wgm4 g-noneborder">
                        <span class="t-tl108 fs72 fcblue-3"><% =((long)(borrow.YearRate * 100)).ToString("0") %></span>
                        <span class="t-tt175 fs30 fcblue-3"><% =(borrow.YearRate * 100 % 1).ToString(".00") %> <span class="fs14">%</span></span>
                        <span class="t-tl185 fs30 fcblue-3"><% =borrow.BidRewardType == WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio && borrow.BidRewardRatio.HasValue ? string.Format(" + {0} <span class=\"fs14\">%</span>", (borrow.BidRewardRatio.Value * 100).ToInterestString()) : string.Empty %></span>
                        <div class="t-tl175 js-stuedown">
                            <i class="iconfont m-cursor fs16 fcblue-2">&#xe646;</i> 基础年化收益<% =borrow.BidRewardType == WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio && borrow.BidRewardRatio.HasValue ? " + 投资奖励" : string.Empty %>
                            <asp:Repeater runat="server" ID="rptInterest" ItemType="WAP2P.BorrowLoan.Borrow.LoanInterestInfo">
                                <HeaderTemplate><dl class="darailbid-ratelist m-shadow"></HeaderTemplate>
                                <ItemTemplate><dd>投资 <%# Item.Amount.ToMoneyString() %> 元以上，年化率 <%# (FinanceHelper.DayRateTo(Item.DayRate, BorrowType.LoanTimeUnit.Year, borrow.InterestType, borrow.CreateAt.Year, borrow.CreateAt.Month) * 100).RoundX().ToInterestString() %>%。</dd></ItemTemplate>
                                <FooterTemplate></dl></FooterTemplate>
                            </asp:Repeater>                            
                            </dl>
                        </div>
                    </li>
                    <li class="wg2">
                        <span class="g-block mt30">借款期限</span>
                        <span class="fs30"><% =borrow.LoanDate %></span>
                        <span><% =borrow.LoanDateUnit.GetDescription() %></span>
                    </li>
                    <li class="wg3">
                        <span class="g-block mt30">借款金额</span>
                        <span class="fs24"><% =borrow.LoanAmount.ToMoneyString() %></span>
                        <span>元</span>
                    </li>
                </ul>
                <div class="g-clear pa15 g-ohide fcblack-1">
                    <div class="ui-bidspeed g-left wg3 mt5"><span style="width: 0;" class="g-block js-stepw"></span></div>
                    <div class="g-right g-fleft wgm6 pl5">
                        当前已完成 <span class="js-stepl"></span> ，共有 <span class="js-binUserCount"></span> 人投资，剩余可投资金额 <% =(borrow.LoanAmount - borrow.BidAmountCount).ToMoneyString() %> 元。
                    </div>
                </div>
                <div class="darailbid-box">
                    <div class="detailbid-photo g-left">
                        <img src="<% =borrow.GetCover() %>" height="158" />
                    </div>
                    <ul class="darailbid-list g-right">
                        <li>项目编号：<% =borrow.BusId %></li>
                        <li>借款协议：《<a href="<% =string.Format("/Agreement/?id={0}&type=borrow", borrow.Id) %>" target="_blank"><% =SiteName %>借款协议</a>》</li>
                        <li>还款方式：<% =WAP2P.Web.Extensions.GetRepaymentName(borrow.Repayment) %></li>
                        <li>起 息 日：<% =borrow.InterestStartType.GetDescription().Substring(0, borrow.InterestStartType.GetDescription().IndexOf("，")) %></li>
                        <li>开标时间：<% =borrow.BidAt.ToDateTimeString() %></li>
                        <li>结束时间：<% =borrow.BidEndAt.ToDateTimeString() %></li>
                        <li class="m-bidOther">
                            <% =borrow.VouchCompanyId.HasValue ? string.Format("<span><i class=\"iconfont fs20 fcgreen-3\">&#xe649;</i> {0}</span>", borrow.VouchCompanyName) : string.Empty %>
                            <% =borrow.WebSafeType != WAP2P.BorrowLoan.Borrow.WebSafe.None ? string.Format("<span><i class=\"iconfont fs20 fcblue-3\">&#xe648;</i> {0}</span>", borrow.WebSafeType.GetDescription()) : string.Empty %>
                            <% =borrow.BidRewardType != WAP2P.BorrowLoan.Borrow.BidReward.None ? "<span><i class=\"iconfont fs20 fcred-3\">&#xe647;</i>  投标奖励</span>" : string.Empty %>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="g-right wg3 g-ohide">
                <form class="js-auto js-vtip" method="post" id="stateform" action="ajax<% =PageExt %>?action=success" data-onsuccess="member.pay('<% =(int)actionType %>', '<% =string.Format("amount=' + $('#amount').val()+'&vamount=false&bid={0}", id) %>', function () { common.pageTip('<% =PageBase.TipType.Success %>', '恭喜投标成功！', '/User/Loan/BidList' + gconfig.pageExt, '我的投标记录'); });">
                    <%--未登录--%>
                    <ruson:Space ID="userLogin" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <a href="javascript:void(0);" onclick="member.miniLogin(function(){location.href = '<% =string.Format("/Borrow/Detail{0}?id={1}",PageBase.PageExt,id) %>'});return false;">登录</a> 后即可见
                        </div>
                        <input type="text" class="detailbid-userbidinput ml5 w200 disable" placeholder="请在登录后输入投资金额" disabled="disabled" />
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-important w218 mt20 pt5 pb5" target="_blank" href="/User/Register<% =PageBase.PageExt %>">还没有账号？立刻注册</a>
                    </ruson:Space>
                    <%--实名认证或手机号码认证--%>
                    <ruson:Space ID="authentication" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <input type="text" class="detailbid-userbidinput w218 disable" placeholder="请完成认证后输入投资金额" disabled="disabled" />
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <%= CurrentUser.RealNameValid != WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess ? string.Format("<a class=\"g-block btn-nobord c-important w218 mt10\" href=\"/User/Info/RealName{0}\">立刻完成实名认证</a>", PageExt) : string.Empty %>
                        <%= CurrentUser.PhoneValid != WAP2P.Member.User.BaseInfoValidStatus.ValidSuccess ? string.Format("<a class=\"g-block btn-nobord c-important w218 mt5\" href=\"/User/Info/Phone{0}\"> 立刻绑定手机号码</a>", PageExt) : string.Empty %>
                    </ruson:Space>
                    <%--自己发的标--%>
                    <ruson:Space ID="own" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcred-3 g-fbold">
                            <span runat="server" id="ownborrowState"></span>
                        </div>
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--还款完成--%>
                    <ruson:Space ID="completed" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcgery-3 g-fbold">
                            还款已完成，项目结束
                        </div>
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--还款中--%>
                    <ruson:Space ID="repayment" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcblueAsh-1 g-fbold">
                            目前正在还款中
                        </div>
                        <ul class="detailbid-userbidlist mt20">
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--满标审核未通过--%>
                    <ruson:Space ID="fullPass" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcred-1 g-fbold">
                            满标审核不通过
                        </div>
                        <ul class="detailbid-userbidlist mt10">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--满标审核中--%>
                    <ruson:Space ID="fullAudit" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcred-1 g-fbold">
                            等待满标审核中
                        </div>
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--按金额投标或预约投标--%>
                    <ruson:Space ID="amountBid" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24" id="js-avaliable"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <input type="text"
                            class="detailbid-userbidinput ml5 w200 input-moneyicon"
                            <% =actionType == WAP2P.Account.AccountActionType.预约用户投标 ? "disabled=\"disabled\"" : string.Empty %> value="<% =reservationLog != null ? reservationLog.Amount.ToString() : string.Empty%>" placeholder="请输入您需<%= actionType.GetDescription() %>的金额"
                            id="amount" autocomplete="off" maxlength="10"
                            data-vmin="<% =borrow.LoanAmount - borrow.BidAmountCount >= borrow.BidMinAmount ? borrow.BidMinAmount.ToJsString() : (borrow.LoanAmount - borrow.BidAmountCount).ToJsString() %>"
                            data-vmax="<% = Math.Min(borrow.BidMaxAmount.HasValue ? borrow.BidMaxAmount.Value - (WAP2P.BorrowLoan.Bid.FindByBorrow(borrow.Id).Where(item => item.UserId == CurrentUser.Id).Sum(o => (decimal?)o.Amount) ?? 0) : 9999999, borrow.LoanAmount - borrow.BidAmountCount).ToJsString() %>"
                            data-vtype="money|range|fun|ajax"
                            data-vmsg="请输入正确的投资金额|最低 <% =borrow.LoanAmount - borrow.BidAmountCount >= borrow.BidMinAmount ? borrow.BidMinAmount.ToMoneyString() : (borrow.LoanAmount - borrow.BidAmountCount).ToMoneyString() %> 元 最高<% = Math.Min(borrow.BidMaxAmount.HasValue ? borrow.BidMaxAmount.Value : 9999999, borrow.LoanAmount - borrow.BidAmountCount).ToMoneyString() %>元|请输入 <% =borrow.StepAmount.ToMoneyString() %> 的整数倍|可用余额不足"
                            data-vfun="checkStep"
                            data-vurl="?action=amountCheck&id=<% =id %>" />
                        <ul class="detailbid-userbidlist">
                            <li>预计收益：<span id="js-expectedInterest">0.00</span> 元</li>
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                            <li class="ui-vcheckbox js-tip">
                                <label><input type="checkbox" name="protocol1" checked="checked" value="1" data-vtype="group" data-vmin="1" data-vmsg="您需要同意用户协议。" />同意《<a target="_blank" href="/Agreement/?type=entrustbid"><% =SiteName %>投资协议</a>》</label>
                            </li>
                        </ul>

                        <div class="btn-submits mt10">
                            <input type="submit" class="btn-bbord fs16 c-normal w252" value="立刻投标" data-success-text="投标中" />
                            <div class="w252"><em class="m-sumtip js-vsum"></em></div>
                        </div>
                    </ruson:Space>
                    <%--流标--%>
                    <ruson:Space ID="overdue" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcred-1 g-fbold">
                            已到投标周期，自动结束
                        </div>
                        <ul class="detailbid-userbidlist mt20">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--撤标--%>
                    <ruson:Space ID="cancel" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs18 fcred-1 g-fbold">
                            已主动撤标
                        </div>
                        <ul class="detailbid-userbidlist mt10">                            
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--未开标--%>
                    <ruson:Space ID="forward" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs16 fcred-1 g-fbold">
                            敬请关注开标时间
                        </div>
                        <ul class="detailbid-userbidlist mt20">
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                    <%--其它状态--%>
                    <ruson:Space ID="otherState" runat="server" Visible="false">
                        <div class="detailbid-usermoenytext">
                            <span class="g-left fs16">可用余额：</span>
                            <a class="g-right btn-bordsmall c-normal" href="/User/Account/OnlineRecharge<% =PageBase.PageExt %>">充 值</a>
                        </div>
                        <div class="detailbid-usermoeny">
                            <span class="fs24"><% =(avaliableSum + redMoney).ToMoneyString() %></span> 元
                            <span class="fs12 ff-songTi"><% =redMoney > 0 ? "(含红包)" : string.Empty %></span>
                        </div>
                        <div class="detailbid-usermoeny fs16 fcred-1 g-fbold">
                            <% =borrow.Status.GetDescription() %>
                        </div>
                        <ul class="detailbid-userbidlist mt20">
                            <li>起投金额：<% = borrow.BidMinAmount.ToMoneyString() %> 元</li>
                            <li>最大可投金额： <% =borrow.BidMaxAmount == null ? "不限" : borrow.BidMaxAmount.ToMoneyString() + " 元" %></li>
                        </ul>
                        <a class="g-block btn-nobord c-normal w218 mt20 pt5 pb5" href="/Borrow/">看看别的项目</a>
                    </ruson:Space>
                </form>
                <a class="detailbid-userhelpline" target="_blank" href="/Help/ServiceList<% =PageBase.PageExt %>">操作遇到了问题？联系客服</a>
            </div>
        </div>

        <div class="m-container g-ohide mt20 mb20">
            <dl class="ui-tab detailbid-borrowtab">
                <dt><a href="#borrowdetail" class="on">借款详情</a></dt>
                <dt><a href="#borrowrecord">投标记录</a></dt>
                <dt><a href="#borrowrepay">还款情况</a></dt>
                <dt><a href="#borrowhold">债权持有</a></dt>
                <dt><a href="#borrowtransfer">转让记录</a></dt>
                <dd class="pa20" id="borrowdetail" data-content-ajax="ajax<% =PageExt %>?action=borrowInfo&borrowId=<% =id %>"></dd>
                <dd class="pa20 g-hide" id="borrowrecord" data-content-ajax="ajax<% =PageExt %>?action=bid&borrowId=<% =id %>"></dd>
                <dd class="pa20 g-hide" id="borrowrepay" data-content-ajax="ajax<% =PageExt %>?action=repay&borrowId=<% =id %>"></dd>
                <dd class="pa20 g-hide" id="borrowhold" data-content-ajax="ajax<% =PageExt %>?action=receive&borrowId=<% =id %>"></dd>
                <dd class="pa20 g-hide" id="borrowtransfer" data-content-ajax="ajax<% =PageExt %>?action=transfer&borrowId=<% =id %>"></dd>
            </dl>
        </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        commonUi.downMenu('.js-stuedown','dl');

        function getBorrowsInfo(id) {
            $.ajax({
                dataType: 'json',
                cache: false,
                url: 'ajax<% =PageExt %>',
                data: { action: 'borrowsInfo', ids: id },
                success: function (res) {
                    if (res.length) {
                        $.each(res, function (i, n) {
                            $('.js-stepw').css('width', n.data.step);
                            $('.js-stepl').html(n.data.step);
                            $('.js-binUserCount').html(n.data.bidUserCount);
                            commonUi.timedown($('.js-time'), n.data.time);
                        });
                    }
                }
            });
        }

        function getInterest(amount) {            
            var res = 0;
            var val = parseFloat(amount.replace(/,/g, ''));
            if (!isNaN(val)) {
                $.each(<% =borrow.LoanInterest.ToJson() %>, function(i, n) {
                    if (val >= n.Amount) {
                        res = val * n.DayRate * <% =dayCount %>;
                    }
                });
            }
            return finance.toMoneyString(finance.roundx(res, 2));
        };

        function checkStep(val) {
            if (<% =borrow.ByStep ? "false" : "true" %>) return true;

            val = parseFloat(val.replace(/,/ig, ''));
            if (isNaN(val)) return false;

            return val % <% =borrow.StepAmount.ToJsString() %> == 0;
        }

        
        $(function () {
            getBorrowsInfo(<% =borrow.Id %>);
            var amountChange = function() {
                var val = $('#amount').val();
                if (val) $('#js-expectedInterest').html(getInterest(val));
            };
            $('#amount').keyup(amountChange);            

            var amount = $('#amount'), avaliable = $('#js-avaliable');            
            if (avaliable.length && amount.length && !amount[0].disabled) {
                var canBid = Math.min(parseFloat(avaliable.text().replace(/,/ig, '')), parseFloat(amount.attr('data-vmax').replace(/,/ig, '') || '9999999'))
                var step = Math.max(1, <% =borrow.StepAmount.ToJsString() %>);
                amount.val(finance.toMoneyString(Math.floor(canBid/step)*step));
                amountChange();
            }
        });
    </script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>
