<%@ Page Title="" Language="C#" MasterPageFile="~/Master/MainMaster.master" CodeBehind="Default.aspx.cs" Inherits="WAP2P.Web.PC.Borrow.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-page">
        <form action="?action=search" class="js-filter search" method="get" id="form1" data-ajax-scroll="#form1" data-ajax-auto="false" data-ajax-fill="#js-ajaxlist" data-ajax-error="<div>加载中错误</div>">
            <div class="m-container mt20 mb20">
                <dl class="ui-tab m-select">
                    <dt><a href="/Borrow/Default<% =PageBase.PageExt %>" class="on">借款列表</a></dt>
                    <dt><a href="/Borrow/TransferList<% =PageBase.PageExt %>">债权列表</a></dt>
                    <%--<dt><a href="/Borrow/Default<% =PageBase.PageExt %>">理财列表</a></dt>--%>
                    <dd>                    
                        <ul class="select-list mt25 ml30">
                            <li>
                                <strong>借款类型</strong>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("type", string.Empty) %>" data-filter-to="#type" data-filter-value=""<% =string.IsNullOrWhiteSpace(Request.QueryString["type"]) ? "class=\"on\"" : string.Empty %>>全 部</a>
                                <asp:Repeater runat="server" ID="rptBorrowType" ItemType="WAP2P.Sys.BorrowType">
                                    <ItemTemplate>
                                        <a href="<%# Request.RawUrl.UrlEncodeParam().SetUrlParam("type", Item.Id.ToString()) %>" data-filter-to="#type" data-filter-value="<%# Item.Id %>"<%# Request.QueryString["type"] == Item.Id.ToString() ? "class=\"on\"" : string.Empty %>><%# Item.Name %></a>
                                    </ItemTemplate>
                                </asp:Repeater>                                
                                <input type="hidden" name="type" id="type" value="<% =Request.QueryString["type"].UrlEncode() %>" />
                            </li>
                            <li>
                                <strong>年化利率</strong>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("rate", string.Empty) %>" data-filter-to="#rate" data-filter-value=""<% =string.IsNullOrWhiteSpace(Request.QueryString["rate"]) ? "class=\"on\"" : string.Empty %>>全 部</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("rate", "-12") %>" data-filter-to="#rate" data-filter-value="-12"<% =Request.QueryString["rate"] == "-12" ? "class=\"on\"" : string.Empty %>>12%以下</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("rate", "12-14") %>" data-filter-to="#rate" data-filter-value="12-14"<% =Request.QueryString["rate"] == "12-14" ? "class=\"on\"" : string.Empty %>>12%-14%</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("rate", "15-17") %>" data-filter-to="#rate" data-filter-value="15-17"<% =Request.QueryString["rate"] == "15-17" ? "class=\"on\"" : string.Empty %>>15%-17%</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("rate", "18-") %>" data-filter-to="#rate" data-filter-value="18-"<% =Request.QueryString["rate"] == "18-" ? "class=\"on\"" : string.Empty %>>18%以上</a>                                
                                <input type="hidden" name="rate" id="rate" value="<% =Request.QueryString["rate"].UrlEncode() %>" />
                            </li>
                            <li>
                                <strong>借款期限</strong>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("month", string.Empty) %>" data-filter-to="#month" data-filter-value=""<% =string.IsNullOrWhiteSpace(Request.QueryString["month"]) ? "class=\"on\"" : string.Empty %>>全 部</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("month", "-1") %>" data-filter-to="#month" data-filter-value="-1"<% =Request.QueryString["month"] == "-1" ? "class=\"on\"" : string.Empty %>>一个月以内</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("month", "1-3") %>" data-filter-to="#month" data-filter-value="1-3"<% =Request.QueryString["month"] == "1-3" ? "class=\"on\"" : string.Empty %>>1-3个月</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("month", "3-6") %>" data-filter-to="#month" data-filter-value="3-6"<% =Request.QueryString["month"] == "3-6" ? "class=\"on\"" : string.Empty %>>3-6个月</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("month", "6-") %>" data-filter-to="#month" data-filter-value="6-"<% =Request.QueryString["month"] == "6-" ? "class=\"on\"" : string.Empty %>>6个月以上</a>                                
                                <input type="hidden" name="month" id="month" value="<% =Request.QueryString["month"].UrlEncode() %>" />
                            </li>
                            <li>
                                <strong>借款金额</strong>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("money", string.Empty) %>" data-filter-to="#money" data-filter-value=""<% =string.IsNullOrWhiteSpace(Request.QueryString["money"]) ? "class=\"on\"" : string.Empty %>>全 部</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("money", "-5") %>" data-filter-to="#money" data-filter-value="-5"<% =Request.QueryString["money"] == "-5" ? "class=\"on\"" : string.Empty %>>5万以下</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("money", "5-10") %>" data-filter-to="#money" data-filter-value="5-10"<% =Request.QueryString["money"] == "5-10" ? "class=\"on\"" : string.Empty %>>5-10万</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("money", "10-15") %>" data-filter-to="#money" data-filter-value="10-15"<% =Request.QueryString["money"] == "10-15" ? "class=\"on\"" : string.Empty %>>10-15万</a>
                                <a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("money", "15-") %>" data-filter-to="#money" data-filter-value="15-"<% =Request.QueryString["money"] == "15-" ? "class=\"on\"" : string.Empty %>>15万以上</a>                                
                                <input type="hidden" name="money" id="money" value="<% =Request.QueryString["money"].UrlEncode() %>" />
                            </li>
                        </ul>
                    </dd>
                </dl>
                <input type="hidden" name="order" id="order" value="<% =Request.QueryString["order"].UrlEncode() %>" />
                <dl class="m-bidlist mt10">
                    <dt><a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("order", string.IsNullOrEmpty(Request.QueryString["order"]) ? "_asc" : string.Empty) %>" data-filter-to="#order|#order" data-filter-value="|_desc"<% =string.IsNullOrWhiteSpace(Request.QueryString["order"]) || Request.QueryString["order"] == "_asc" ? "class=\"on\"" : string.Empty %>>按时间排序</a></dt>
                    <dt><a href="<% =Request.RawUrl.UrlEncodeParam().SetUrlParam("order", Request.QueryString["order"] == "money" ? "money_desc" : "money") %>" data-filter-to="#order|#order" data-filter-value="money|money_desc"<% =Request.QueryString["order"] != null && Request.QueryString["order"].StartsWith("money") ? "class=\"on\"" : string.Empty %>>按金额排序</a></dt>                    
                    <dd id="js-ajaxlist" class="js-ajaxlist">
                        <ruson:Space runat="server" ID="list" Visible="false">
                            <ruson:Repater runat="server" ID="rptList" ItemType="WAP2P.BorrowLoan.Borrow">
                                <ItemTemplate>
                                    <div class="m-bidbox" id="tr<%# Item.Id %>">
                                        <div class="bidbox-title">
                                            <h5 class="g-left">
                                                <a href="<%# WAP2P.Web.Extensions.GetBorrowUrl(Item.Id) %>"><img src="<%# WAP2P.Sys.BorrowType.LoadOrNew(Item.TypeId).Icon %>" style="width:60px; height:18px; margin-top:2px;" class="g-left" /></a>
                                                <a class="g-left fs16 ml10 g-valign" style="color:<%# Item.Color == "" ? "#1b1b1b":Item.Color %>" href="<%# WAP2P.Web.Extensions.GetBorrowUrl(Item.Id) %>"><%# Item.Name %></a>
                                                <%# Item.WebSafeType != WAP2P.BorrowLoan.Borrow.WebSafe.None ? string.Format("<i class=\"iconfont fs20 fcblue-3 ml15\" title=\"{0}\">&#xe648;</i>", Item.WebSafeType.GetDescription()) : string.Empty %>                                                
                                                <%# Item.VouchCompanyId.HasValue ? string.Format("<i title=\"由{0}提供担保\" class=\"iconfont fs20 fcgreen-3 ml5\">&#xe649;</i>", Item.VouchCompanyName) : string.Empty %>
                                                <%# Item.BidRewardType != WAP2P.BorrowLoan.Borrow.BidReward.None ? "<i class=\"iconfont fs20 fcred-3\" title=\"投标奖励\">&#xe647;</i>" : string.Empty %>
                                            </h5>
                                            <div class="bidbox-time g-right js-time"></div>
                                        </div>
                                        <ul>
                                            <li class="wg3">
                                                <label class="fcblue-3 g-fbold fs26"><%# Item.LoanAmount.ToMoneyString() %></label> 元 
                                            </li>
                                            <li class="border"></li>
                                            <li class="wg2">
                                                <label><%# (Item.YearRate * 100).ToInterestString() %>%<%# Item.BidRewardType == WAP2P.BorrowLoan.Borrow.BidReward.BidAmountRatio && Item.BidRewardRatio.HasValue ? string.Format(" + {0}%", (Item.BidRewardRatio.Value * 100).ToInterestString()) : string.Empty %></label>
                                                <span>年化率</span>
                                            </li>
                                            <li class="border"></li>
                                            <li class="wg2">
                                                <label><%# Item.LoanDate %></label><%# Item.LoanDateUnit.GetDescription() %>
                                                <span>借款期限</span>
                                            </li>
                                            <li class="wg3">
                                                <div class="ui-bidspeed g-fleft"><span class="js-stepw" style="width:0%"></span></div>
                                                <div class="ui-percent"><span class="js-stepl" style="left:0%;">0%</span></div>
                                            </li>
                                            <li>                                                
                                                <a href="<%# WAP2P.Web.Extensions.GetBorrowUrl(Item.Id) %>" class="w100 btn-nobord g-block js-btn"></a>
                                            </li>
                                        </ul>
                                    </div>
                                </ItemTemplate>
                                <EmptyTemplate>
                                    <span class="bidlist-empty">没有找到更多的数据。</span>
                                </EmptyTemplate>
                            </ruson:Repater>
                            <div class="ui-pages g-fright">
                                <ruson:Pager runat="server" ID="pages" CssClass="pages" ShowPageSizeSelect="false" />
                                <a href="<% =Request.RawUrl.UrlEncodeParam() %>" class="g-hide"></a>
                            </div>
                            <script type="text/html" class="js-run">
                                $.ajax({
                                    dataType: 'json',
                                    cache: false,
                                    url: 'ajax<% =PageExt %>',
                                    data: { action: 'borrowsInfo', ids: '<% =ids %>'},
                                    success: function(res) {                              
                                        if (res.length) {
                                            $.each(res, function(i, n) {
                                                var tr = $('#tr' + n.id);                                
                                                tr.find('.js-stepw').css('width', n.data.step);
                                                tr.find('.js-stepl').css('left', n.data.step).html(n.data.step);
                                                tr.find('.js-btn').html(n.data.btnTxt).addClass(n.data.btnHigh ? 'bidbtn' : 'bid-finish');
                                                commonUi.timedown(tr.find('.js-time'), n.data.time);
                                            });
                                        }
                                    }
                                });
                            </script>
                        </ruson:Space>
                    </dd>
                </dl>
            </div>
        </form>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        eval($('script.js-run')[0].innerHTML);
    </script>
</asp:Content>
