<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="BorrowListBid.aspx.cs" Inherits="WAP2P.Web.PC.Admin.BorrowLoan.BorrowListBid" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <dl class="ui-tabs">
        <dt><a href="javascript:" class="on">投标中的借款</a></dt>        
        <dd>
            <form action="?action=search" method="get" class="m-search">
                <table class="m-criteria" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th>借款筛选:</th>
                        <td>
                            <ruson:Select runat="server" ID="borrowType" TipsText="全部类型" DataValueField="Id" DataTextField="Name">
                            </ruson:Select>
                            <ruson:Select runat="server" ID="type" FillRequestValue="true">
                                <option value="业务编号">业务编号</option>
                                <option value="借款名称">借款名称</option>
                                <option value="借款人">借款人</option>
                            </ruson:Select>
                            <input type="text" size="35" name="key" value="<% =Request.QueryString["key"].HtmlEncode() %>" />
                            <span class="ml20 js-inlinesubmit"><input type="submit" class="btn-base c-priority iconfont" value="&#xe60f; 搜索" /><input type="reset" class="btn-base c-normal iconfont" value="&#xe670; 清空条件" /></span>
                        </td>
                    </tr>
                    <tr class="g-hide">
                        <th>添加时间：</th>
                        <td><input type="text" name="startAt" id="startAt" value="<% =Request.QueryString["startAt"].UrlEncode() %>" class="ui-date w150" data-maxdate="#endAt" /> 至 <input type="text" name="endAt" id="endAt" value="<% =Request.QueryString["endAt"].UrlEncode() %>" class="ui-date w150" data-mindate="#startAt" /></td>
                    </tr>
                    <tr class="g-hide">
                        <th></th>
                        <td><input type="submit" class="btn-base c-priority iconfont" value="&#xe60f; 搜索" /><input type="reset" class="btn-base c-normal iconfont" value="&#xe670; 清空条件"  /></td>
                    </tr>
                </table>  
                <a href="javascript:void(0);" id="btnSwithMoreFilter" class="iconfont"><span>&#xe661; 显示更多筛选条件</span></a>            
            </form>
            <div class="m-content">
                <table class="m-list" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <th width="5%">编号</th>
                        <th width="5%">业务编号</th>
                        <th width="8%">借款人</th>
                        <th width="8%">借款种类</th>
                        <th width="16%" class="g-fleft">借款名称</th>                        
                        <th width="8%">借款金额</th>
                        <th width="8%">算息开始日</th>
                        <th width="5%">年利率</th>
                        <th width="8%">借款周期</th>                        
                        <th width="8%">投标结束时间</th>
                        <th width="10%">操作</th>
                    </tr>
                </table>
            </div>
        </dd>
    </dl>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        function cacel(id) {
            $.jConfirm('确认撤标？', function () {
                $.ajax({
                    url: 'BorrowDetail.aspx?action=cancel',
                    data: { 'id': id },
                    dataType: 'json',
                    cache: false,
                    success: function (res) {
                        if (res.Success) {
                            //刷新列表
                            var pages = $('table.m-list .pages');
                            if (pages.length) {
                                var a = pages.next();
                                pages.append(a);    //将a放入pages内，以响应点击事件
                                a.trigger('click');
                            } else {
                                $('form.m-search').trigger('submit');
                            }
                        }
                        else
                            $.jError(res.Message);
                    }
                });
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
    <ruson:Repater runat="server" ID="rptList" ItemType="WAP2P.BorrowLoan.Borrow">
        <ItemTemplate>
            <tr id="tr<%# Item.Id %>">
                <td><%# Item.Id %></td>
                <td><%# Item.BusId %></td>
                <td class="g-fbold"><%# GetUserDisplay(Item.UserId, Item.UserName) %></td> 
                <td><%# BorrowType.LoadOrNew(Item.TypeId).Name %></td>
                <td class="g-fleft"><%# Item.Name.LeftX(15) %></td>                
                <td><%# Item.LoanAmount.ToMoneyString() %> 元</td>
                <td><%# Item.InterestStartType.GetDescription() %></td>
                <td><%# (Item.YearRate * 100).ToInterestString() %>%</td>
                <td><%# Item.LoanDate %><%# Item.LoanDateUnit.GetDescription() %></td>                
                <td><%# Item.BidEndAt.ToDateTimeString("无") %></td>
                <td>
                    <ruson:PermissionSpace runat="server" Module="借贷管理" Function="投标中的借款" Operate="修改"><a class="iconfont oper edit" href="javascript:void(0);" onclick="$.jPopupEdit('编辑投标中的借款', 'BorrowDetailBid.aspx?ID=<%# Item.Id %>');">&#xe642; 编辑</a></ruson:PermissionSpace>
                    <ruson:PermissionSpace runat="server" Module="借贷管理" Function="借款管理" Operate="撤标"><a class="iconfont oper" href="javascript:void(0);" onclick="cacel('<%# Item.Id %>');">&#xe611; 撤标</a></ruson:PermissionSpace>
                </td>
            </tr>
        </ItemTemplate>
        <EmptyTemplate>
            <tr>
                <td colspan="11" class="g-fleft">暂无数据。</td>
            </tr>
        </EmptyTemplate>
    </ruson:Repater>
    <tr class="pager">
        <td colspan="11"><ruson:Pager runat="server" ID="pages" CssClass="pages" /><a href="<% =Request.RawUrl %>" class="g-hide"></a></td>
    </tr>
</asp:Content>
