<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajax.aspx.cs" Inherits="WAP2P.Web.PC.Borrow.Ajax" %>
<%--借款详情--%>
<ruson:Space ID="borrowInfo" runat="server" Visible="false">
    <div class="detailbid-baseinfobox mb10 wg8 g-left">
        <div class="baseinfo-titile" style="display:<% =string.IsNullOrEmpty(borrow.UseTo) ? "none" : "block" %>">借款用途</div>
        <div class="baseinfo-detail" style="display:<% =string.IsNullOrEmpty(borrow.UseTo) ? "none" : "block" %>"><% =borrow.UseTo %></div>
        <div class="baseinfo-titile" style="display:<% =string.IsNullOrEmpty(borrow.RepaySrc) ? "none" : "block" %>">还款来源</div>
        <div class="baseinfo-detail" style="display:<% =string.IsNullOrEmpty(borrow.RepaySrc) ? "none" : "block" %>"><% =borrow.RepaySrc %></div>
        <div class="baseinfo-titile" style="display:<% =string.IsNullOrEmpty(borrow.Detail) ? "none" : "block" %>">项目说明</div>
        <div class="baseinfo-detail" style="display:<% =string.IsNullOrEmpty(borrow.Detail) ? "none" : "block" %>"><% =borrow.Detail %></div>
    </div>
    <div class="detailbid-baseinfobox mb10 wgm3 g-right m-shadow">
        <table class="baseinfo-table">
            <tr>
                <th>用户昵称</th>
                <td class="alt"><span class="js-umenu" data-uid="<% =borrow.UserId %>"><% =borrow.Nickname %></span></td>     
            </tr>
            <tr>
                <th>手机认证</th>
                <td><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.PhoneValid ? "<i class=\"iconfont\">&#xe62a;</i> 已认证" : "未认证" : string.Empty %></td>
            </tr>
            <tr>
                <th>邮箱认证</th>
                <td class="alt"><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.EmailValid ? "<i class=\"iconfont\">&#xe62a;</i> 已认证" : "未认证" : string.Empty %></td>
            </tr>
            <tr>
                <th>实名认证</th>
                <td><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.RealnameValid ? "<i class=\"iconfont\">&#xe62a;</i> 已认证" : "未认证" : string.Empty %></td>
            </tr>
            <tr>
                <th>现场认证</th>
                <td class="alt"><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.OnsiteValid ? "<i class=\"iconfont\">&#xe62a;</i> 已认证" : "未认证" : string.Empty %></td>
            </tr>
            <tr>
                <th>所在城市</th>
                <td><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.Address : string.Empty %></td>
            </tr>
            <tr>
                <th>信用等级</th>
                <td class="alt"><% =borrow.UserSnap != null && borrow.UserSnap.UserInfo != null ? borrow.UserSnap.UserInfo.Credit : string.Empty %></td>
            </tr>
        </table>
    </div>
    <div class="g-clear"></div>
    <ruson:Space ID="borrowInfoUserVisible" runat="server" Visible="false">
    <ruson:Space ID="accountInfo" runat="server" Visible="false">
        <div class="detailbid-infobox mb10">
            <div class="detailbid-infotitle">借款人资金情况</div>
            <table class="detailbid-infotable">
                <tr>
                    <th>借款时可用余额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.Account != null ? borrow.UserSnap.Account.Available.ToMoneyString() : string.Empty %> 元</td>
                    <th>借款时冻结总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.Account != null ? borrow.UserSnap.Account.Hold.ToMoneyString() : string.Empty %> 元</td>
                </tr>
            </table>
        </div>    
    </ruson:Space>
    <asp:Repeater runat="server" id="borrowInfoQuotas">
        <HeaderTemplate>
            <div class="detailbid-infobox mb10">
                <div class="detailbid-infotitle">借款人额度情况</div><table class="detailbid-infotable">
                    <tr>
        </HeaderTemplate>
        <ItemTemplate>            
            <th><%# Eval("Key") %></th>
            <td><%# ((decimal)Eval("Value")).ToMoneyString() %> 元</td>
            <%# Container.ItemIndex % 2 == 1 ? "</tr><tr>" : string.Empty %>
        </ItemTemplate>
        <FooterTemplate>
                    </tr>
                </table>
            </div>
        </FooterTemplate>
    </asp:Repeater>
    <ruson:Space ID="borrorHistory" runat="server" Visible="false">
        <div class="detailbid-infobox mb10">
            <div class="detailbid-infotitle">借款人历史借款记录</div>
            <table class="detailbid-infotable">
                <tr>
                    <th>历史借款次数</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.LoanCount.ToString() : string.Empty %> 次</td>
                    <th>历史借款总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.LoanTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
                <tr>
                    <th>成功借款次数</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.LoanSuccessCount.ToString() : string.Empty %> 次</td>
                    <th>成功借款总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.LoanSuccessTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
                <tr>
                    <th>历史已还款总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.RepaySuccessTotal.ToMoneyString() : string.Empty %> 元</td>
                    <th>当前应还款总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.RepayShouldTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
                <tr>
                    <th>历史逾期次数</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.OverdueCount.ToString() : string.Empty %> 次</td>
                    <th>历史逾期罚息</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.LoanHistory.OverdueTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
            </table>
        </div>
    </ruson:Space>
    <ruson:Space ID="bidHistory" runat="server" Visible="false">
        <div class="detailbid-infobox mb10">
            <div class="detailbid-infotitle">借款人历史投资记录</div>
            <table class="detailbid-infotable">
                <tr>
                    <th>历史投资次数</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.BidHistory.BidCount.ToString() : string.Empty %> 次</td>
                    <th>历史投资总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.BidHistory.BidTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
                <tr>
                    <th>当前待收总额</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.BidHistory.ReceiveCount.ToMoneyString() : string.Empty %> 元</td>
                    <th>当前待收本金</th>
                    <td><% =borrow.UserSnap != null && borrow.UserSnap.LoanHistory != null ? borrow.UserSnap.BidHistory.ReceivePrincipalTotal.ToMoneyString() : string.Empty %> 元</td>
                </tr>
            </table>
        </div>
    </ruson:Space>
    <asp:Repeater runat="server" id="borrowInfoBaseInfo">
        <HeaderTemplate>
            <div class="detailbid-infobox mb10">
                <div class="detailbid-infotitle">借款人基础资料</div>
                <table class="detailbid-infotable">                    
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <th colspan="4"><%# Eval("Key") %></th>
            </tr>
            <tr>
            <asp:Repeater runat="server" id="baseInfo">
                <ItemTemplate>                   
                    <th><%# Eval("Name") %></th>
                    <td><%# Eval("Value") %></td>
                    <%# Container.ItemIndex % 2 == 1 ? "</tr><tr>" : string.Empty %>        
                </ItemTemplate>
            </asp:Repeater>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
                </table>
            </div>
        </FooterTemplate>
    </asp:Repeater>
    <asp:Repeater runat="server" id="borrowInfoBorrowInfos">
        <HeaderTemplate>
            <div class="detailbid-infobox mb10">
                <div class="detailbid-infotitle">借款人借款资料</div>
                <table class="detailbid-infotable">
                    <tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <th>资料名称</th>
                <td><%# Eval("Key") %></td>
                <th>授信额度</th>
                <td><%# (decimal)Eval("Value") %> 元</td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
                </table>
            </div>
        </FooterTemplate>
    </asp:Repeater>
    </ruson:Space>
</ruson:Space>
<%--投标记录--%>
<ruson:Space ID="bid" runat="server" Visible="false">
    <table class="detailbid-table">
        <tr>
            <th width="10%">序号</th>
            <th width="20%">投标人</th>
            <th width="30%">投标金额</th>
            <th width="20%">投标方式</th>
            <th width="20%">投标时间</th>
        </tr>
        <ruson:Repater runat="server" ID="rptBorrowBid" ItemType="WAP2P.BorrowLoan.Bid">
            <ItemTemplate>
                <tr>
                    <td><%#  Container.ItemIndex + 1%></td>
                    <td><span class="js-umeun" data-uid="<%# Item.UserId %>"><%# Item.Nickname.HidePart() %></span></td>
                    <td><%# Item.Amount.ToMoneyString() %> 元<%# Item.RewardMoney > 0 ? string.Format("(红包{0}元)", Item.RewardMoney.ToMoneyString()) : string.Empty %></td>
                    <td><%# Item.AutoBidId.HasValue ? string.Format("自动({0})", Item.AutoBidIndex) : "手动" %></td>
                    <td><%# Item.CreateAt.ToDateTimeString() %></td>
                </tr>
            </ItemTemplate>
        </ruson:Repater>
    </table>
</ruson:Space>
<%--还款情况--%>
<ruson:Space ID="repay" runat="server" Visible="false">
    <table class="detailbid-table">
        <tr>
            <th width="10%">还款期数</th>
            <th width="15%">合约还款日</th>
            <th width="10%">状态</th>
            <th width="25%">应还总额</th>
            <th width="25%">应还罚息</th>
            <th width="15%">实际还款日</th>
        </tr>
        <ruson:Repater runat="server" ID="rptBorrowRepay" ItemType="WAP2P.BorrowLoan.Repay">
            <ItemTemplate>
                <tr>
                    <td>第 <%# Item.Period %> 期</td>
                    <td><%# Item.ShouldRepayAt.ToDateTimeString() %></td>
                    <td><%# Item.Status.GetDescription() %></td>
                    <td><%# (Item.ShouldRepayPrincipal + Item.ShouldRepayInterest).ToMoneyString() %> 元</td>
                    <td><%# (Item.ShouldRepayOverdue).ToMoneyString() %> 元</td>
                    <td><%# Item.Status != WAP2P.BorrowLoan.Repay.RepayStatus.WaitRepayment ? Item.ActualRepayAt.ToDateTimeString() : "---" %></td>
                </tr>
            </ItemTemplate>
            <EmptyTemplate>
                <tr>
                    <td colspan="6">暂无数据。</td>
                </tr>
            </EmptyTemplate>
        </ruson:Repater>
    </table>
</ruson:Space>
<%--债权持有--%>
<ruson:Space ID="receive" runat="server" Visible="false">
    <table class="detailbid-table">
        <tr>
            <th width="10%">序号</th>
            <th width="20%">债权持有人</th>
            <th width="35%">债权总额</th>
            <th width="35%">预计收益</th>
        </tr>
        <ruson:Repater runat="server" ID="rptBorrowReceive">
            <ItemTemplate>
                <tr>
                    <td><%# Container.ItemIndex + 1 %></td>
                    <td><span class="js-umeun" data-uid="<%# Eval("UserId") %>"><%# ((string)Eval("Nickname")).HidePart() %></span></td>
                    <td><%# ((decimal)Eval("ShouldRepayPrincipal")).ToMoneyString() %> 元</td>
                    <td><%# ((decimal)Eval("ShouldRepayInterest")).ToMoneyString() %> 元</td>
                </tr>
            </ItemTemplate>
            <EmptyTemplate>
                <tr>
                    <td colspan="4">暂无数据。</td>
                </tr>
            </EmptyTemplate>
        </ruson:Repater>
    </table>
</ruson:Space>
<%--转让记录--%>
<ruson:Space ID="transfer" runat="server" Visible="false">
    <table class="detailbid-table">
        <tr>
            <th width="20%">债权受让人</th>
            <th width="20%">债权出让人</th>
            <th width="35%">转让总额</th>
            <th width="25%">转让时间</th>
        </tr>
        <ruson:Repater runat="server" ID="rptTransferLog" ItemType="WAP2P.BorrowLoan.TransferLog">
            <ItemTemplate>
                <tr>
                    <td><span class="js-umeun" data-uid="<%# Item.ToUserId %>"><%# Item.ToNickname.HidePart() %></span></td>
                    <td><span class="js-umeun" data-uid="<%# Item.FromUserId %>"><%# Item.FromNickname.HidePart() %></span></td>
                    <td><%# Item.Amount.ToMoneyString() %> 元</td>
                    <td><%# Item.CreateAt.ToDateTimeString() %></td>
                </tr>
            </ItemTemplate>
            <EmptyTemplate>
                <tr>
                    <td colspan="4">暂无数据。</td>
                </tr>
            </EmptyTemplate>
        </ruson:Repater>
    </table>
</ruson:Space>
<%--预约记录--%>
<ruson:Space ID="reservationLog" runat="server" Visible="false">
    <table class="detailbid-table">
        <tr>
            <th width="10%">序号</th>
            <th width="30%">预约人</th>
            <th width="30%">预约金额</th>
            <th width="30%">预约时间</th>
        </tr>
        <ruson:Repater runat="server" ID="rptReservationLog" ItemType="WAP2P.BorrowLoan.ReservationLog">
            <ItemTemplate>
                <tr>
                    <td><%# Container.ItemIndex + 1%></td>
                    <td><span><%# Item.Nickname.HidePart() %></span></td>
                    <td><%# Item.Amount.ToMoneyString() %> 元</td>
                    <td><%# Item.CreateAt.ToDateTimeString() %></td>
                </tr>
            </ItemTemplate>
            <EmptyTemplate>
                <tr>
                    <td colspan="4">暂无数据。</td>
                </tr>
            </EmptyTemplate>
        </ruson:Repater>
    </table>
</ruson:Space>
<%--未登录时--%>
<ruson:Space ID="login" runat="server" Visible="false">
    <div>您需要登录后才能查看。现在<a href="/User/Login<% =PageExt %>">登录</a> 或者 <a href="/User/Register<% =PageExt %>">注册</a>。</div>
</ruson:Space>