<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="TransferDetail.aspx.cs" Inherits="WAP2P.Web.PC.User.Loan.TransferDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-userbox m-buserbox pb20">
        <div class="m-operback">
            <a href="ReceiveList<% =PageBase.PageExt %>"><< 返回债权列表</a>
        </div>
        <ruson:Space runat="server" ID="error" Visible="false">
            <div class="mt20 ml30">
                <% =errorMsg %>
            </div>
        </ruson:Space>
        <ruson:Space runat="server" ID="ok" Visible="false">
            <dl class="m-quotalist mt20">
                <dt>借款标题：<a href="<% =WAP2P.Web.Extensions.GetBorrowUrl(receives.First().BorrowId) %>" target="_blank" class="fs14"><% =receives.First().BorrowName %></a></dt>
                <dd><span class="quotalist-title">债权总额：</span><span class="fcred-3"><% =receives.Sum(item => item.ShouldRepayPrincipal).ToMoneyString() %></span> 元</dd>
                <dd><span class="quotalist-title">预计收益：</span><span class="fcred-3"><% =receives.Sum(item => item.ShouldRepayInterest).ToMoneyString() %></span> 元</dd>
                <dd><span class="quotalist-title">历史转让：</span><span class="fcred-3"><% =transfers.Sum(item => item.BidAmountCount).ToMoneyString() %></span> 元</dd>
                <dd><span class="quotalist-title">正在转让：</span><span class="fcred-3"><% =transfers.Where(WAP2P.BorrowLoan.Transfer.GetDisplayStatusWhere(WAP2P.BorrowLoan.Transfer.TransferStatusDisplay.Transferring).Compile()).Sum(item => item.Amount - item.BidAmountCount).ToMoneyString() %></span> 元</dd>
                <dd><span class="quotalist-title">债权到期日：</span><span class="fcred-3"><% =receives.OrderByDescending(item => item.ShouldRepayAt).First().ShouldRepayAt.ToDateString() %></span></dd>
                <dd><span class="quotalist-title">最近回款日：</span><span class="fcred-3"><% =receives.OrderBy(item => item.ShouldRepayAt).First().ShouldRepayAt.ToDateString() %></span> </dd>
            </dl>
            <form class="js-auto js-vtip" method="post" action="<% =Request.RawUrl.UrlEncodeParam() %>" data-onsuccess="location.href = 'TransferList<% =PageExt %>';">
                <table class="m-jsonfrom mt20" cellpadding="0" cellspacing="0" width="100%">                    
                    <tr>
                        <th>转让总额</th>
                        <td>
                            <div class="input-big js-tip">
                                <input type="text" class="text js-slider input-moneyicon" name="amount" id="js-transferAmount" placeholder="请设置您需要转让的总额" value="<% =canTransferAmount %>" data-slider-min="<% =borrowType.TransferMinAmount %>" data-slider-max="<% =canTransferAmount %>" data-slider-step="0.01" />
                                <span class="prompt">最少<% =borrowType.TransferMinAmount.ToMoneyString() %>元，最大<% =canTransferAmount.ToMoneyString() %>元。</span>
                            </div>
                        </td>
                    </tr>
                    <ruson:Space runat="server" ID="updown" Visible="false">
                        <tr>
                            <th>转让价浮动</th>
                            <td>
                                <div class="input-big js-tip">
                                    <input type="text" class="text input-percentageicon js-slider" name="upDownRate" id="js-updown" placeholder="请设置转让浮动比例" value="0" data-slider-min="-<% =borrowType.TransferDownRate * 100 %>" data-slider-max="<% =borrowType.TransferUpRate * 100 %>" data-slider-step="0.01" />
                                    <span class="prompt">最大允许以上浮 <% =(borrowType.TransferUpRate * 100).ToInterestString() %>%，下浮 <% =(borrowType.TransferDownRate * 100).ToInterestString() %>% 的价格进行转让。</span>
                                </div>
                            </td>
                        </tr>
                    </ruson:Space>
                    <tr>
                        <th>转让价</th>
                        <td>
                            <span class="fcred-3" id="js-total"></span> 元
                        </td>
                    </tr>
                </table>
                <div class="btn-submits mt20 ml250">
                    <input type="submit" value="提 交" class="button btn-bbord fs16 c-normal w258" data-success-text="提交成功" />
                    <div class="w258"><em class="m-sumtip js-vsum"></em></div>
                </div>
            </form>        
        </ruson:Space>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        var transferAmout = $('#js-transferAmount'), upDown = $('#js-updown'), total = $('#js-total');
        var calculateTotal = function () {
            var amount = parseFloat(transferAmout.val().replace(/,/g, ''));
            var val = 0;

            if (amount) {
                if (upDown.length) {
                    var ud = parseFloat(upDown.val());
                    if (ud) amount = amount + amount * ud / 100;
                }
                val = amount;
            }
            
            total.text(finance.toMoneyString(val));
        };

        transferAmout.blur(calculateTotal);
        upDown.blur(calculateTotal);
        calculateTotal();
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>
