<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Course.Admin_Course_CosOrderReturn"  codeBehind="KS.CosOrderReturn.aspx.cs" %>

<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
    <style>
        .border {border: 0px;}
		.border .wait, .border .wff, .border .wfk, .border .wxf {color: red;}
		.border .yff, .border .yfq, .border .yqs, .border .confirm {color: green;}
		.border .wx {color: #999;}
		.border .jq {color: #888;}
		.border .tf {color: brown;}
		.border .tk {color: Purple;}
		.border .ddff {color: brown;}
		.border .list_link {line-height: 22px;border-left: 1px solid #efefef;padding: 5px;}
		.border .img img {border: 1px solid #ccc;padding: 1px;}
    </style>
    <asp:Panel ID="ListPannel" runat="server">
        <div class="content-area mt20">
            <div class="myTitle">
                <input type="button" class="fr mr20 button" value="打印本页" onclick="PrintPage('PrintBox')" />
                退款管理
            </div>
            <div class="quickSearch clearfix">
            	
                <div class="SearchBox fl">
                    <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                        <asp:ListItem Value="1">订单号</asp:ListItem>
                        <asp:ListItem Value="2">用户ID</asp:ListItem>
                        <asp:ListItem Value="3">用户名</asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox ID="TxtKey" CssClass="textbox" runat="server" Width="180px"></asp:TextBox>
                    <asp:Button ID="Button1" runat="server" Text="开始搜索" CssClass="button" OnClick="Button1_Click" /> 
                </div>
                <div class="property">
                    <div class="name button ml15">筛选</div>
                    <div class="propertyBox">
                        <ul class="clearfix">
                            <span class="screen fl">查看记录：</span>
                            <li<%=Utils.StrToInt(KSCMS.S("status"))==0?" class='active'":string.Empty %>><a href="KS.CosOrderReturn.aspx"><span>所有记录</span></a></li>
                    		<li<%=Utils.StrToInt(KSCMS.S("status"))==1?" class='active'":string.Empty %>><a href="KS.CosOrderReturn.aspx?status=1"><span>待审核</span></a></li>
                    		<li<%=Utils.StrToInt(KSCMS.S("status"))==2?" class='active'":string.Empty %>><a href="KS.CosOrderReturn.aspx?status=2"><span>已退款</span></a></li>
                        </ul>
                    </div>
                </div>
                 <div class="fr allPrice l_height36">
					
                        <span class="f14 grayFont">所有退款合计：</span>
                        <span class="f16 redFont">¥<%=TotalPrice() %></span>
                        <span class="f14 grayFont ml30">已退款：</span>
                        <span class="f16 redFont">¥<%=TotalPrice(1) %></span>
                        <span class="f14 grayFont ml30">待退款：</span>
                        <span class="f16 redFont">¥<%=TotalPrice(2) %></span>
              
                        
                </div>
            </div>
            <div class="border">
                <div id="PrintBox">
                    <KS:KSGV ID="LogReturnView" CssClass="CTable" runat="server" AutoGenerateColumns="False" DataKeyNames="FieldID" GridLines="None" OnRowDataBound="LogReturnView_RowDataBound" Width="99%" EnableTheming="True" EmptyDataText="没有找到任何申请退款记录!">
                        <Columns>
                            <asp:TemplateField HeaderText="订单号">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%# Eval("OrderID").ToString() %>
                                </ItemTemplate>
                            </asp:TemplateField>
                              <asp:TemplateField HeaderText="支付方式">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                   <%#Utils.StrToInt(Eval("PaymentPlatId").ToString())==0?"余额支付": MyCache.GetPayMentPlatName(Utils.StrToInt(Eval("PaymentPlatId").ToString())) %>
                                </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="商户单号">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%# Eval("courseorder") %>
                                </ItemTemplate>
                            </asp:TemplateField>

                             <asp:TemplateField HeaderText="申请退款时间">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                 <%# Eval("AddDate") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="UserID" HeaderText="用户ID">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>

                            <asp:BoundField DataField="UserName" HeaderText="用户名">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>

                            <asp:TemplateField HeaderText="退款金额">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%# MyCache.GetCurrencySymbol + Utils.StrToFloat(Eval("Money")).ToString("f2") %>元
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="退款方式">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%#GetType(Utils.StrToInt(Eval("MoneyType"))) %>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="状态">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%#GetStatus(Utils.StrToInt(Eval("Status"))) %>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="操作">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%#Utils.StrToInt(Eval("Status")) == 0?("<a href=\"javascript:void(0)\" onclick=\"parent.openWin('处理退款申请','" + "Course/KS.CosOrderReturn.aspx?action=verify&id=" + Utils.StrToInt(Eval("ID")) + "',true,800, 490)\" title=\"处理退款申请\">处理</a>"):
                                    ("<a href=\"javascript:void(0)\" onclick=\"parent.openWin('查看退款申请','" + "Course/KS.CosOrderReturn.aspx?action=scan&id=" + Utils.StrToInt(Eval("ID")) + "',true,800, 490)\" title=\"查看退款申请\">查看</a>") %>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="查看订单">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <a href="KS.CsOrderShow.aspx?orderid=<%#Eval("OrderID") %>"><span class="plicon"></span></a>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle CssClass="CTitle" />
                        <EmptyDataRowStyle CssClass="emptycss" />
                    </KS:KSGV>
                </div>
                <KS:Page ID="Page1" runat="server" />
                <script type="text/javascript">
                    showtips('<span class="state"><strong>说明：</strong><br /></span>为便于查看退款订单记录,此记录不提供删除功能!');
                </script>
            </div>
    </asp:Panel>

    <asp:Panel ID="showPannel" runat="server" Visible="false">
        <script>
            $(document).ready(function () {
                ShowBank();
            });
            function ShowBank() {
                var checkrad = jQuery("#<%=this.MoneyType.ClientID %> :radio[checked]").val();
                if (checkrad == '2') {
                    jQuery(".bank").show();
                }
                else {
                    jQuery(".bank").hide();
                }
            }
        </script>
        <table class="CTable" cellspacing="1" cellpadding="1" width="99%" border="0">
            <tr class="tdbg">
                <td align="right" width="15%"><strong>订单号：</strong></td>
                <td><%=dr["OrderID"].ToString() %></td>
            </tr>
            <tr class="tdbg">
                <td align="right" width="15%"><strong>用户名：</strong></td>
                <td><%=dr["UserName"].ToString()%> </td>
            </tr>
             <tr class="tdbg">
                <td align="right" width="15%"><strong>退款金额：</strong></td>
                <td><%=MyCache.GetCurrencySymbol %>
                    <asp:TextBox ID="TxtMoney" runat="server" Text="0" Width="60" />元
                </td>
            </tr>
            <tr class="tdbg">
                <td align="right" width="15%"><strong>退款方式：</strong></td>
                
                    <%if (action == "verify"){%>
                    <td><asp:RadioButtonList ID="MoneyType" runat="server" RepeatDirection="Horizontal" OnClick="ShowBank()">
                        <asp:ListItem Value="1" Selected="True">账户余额</asp:ListItem>
                        <asp:ListItem Value="2">银行账户</asp:ListItem>
                        <asp:ListItem Value="3">原路退回</asp:ListItem>
                        <asp:ListItem Value="4">已和客户妥协订单恢复正常</asp:ListItem>
                    </asp:RadioButtonList></td>
                    <%}else{%>
                    <td ><%=GetType(Utils.StrToInt(dr["MoneyType"]))%></td>
                    <%} %>
                
            </tr>
            <tr class="bank" style="display: none">
                <td align="right" width="15%"><strong>银行名称：</strong></td>
                <td>
                    <asp:TextBox ID="BankName" runat="server" Text="" /></td>
            </tr>
            <tr class="bank" style="display: none">
                <td align="right" width="15%"><strong>银行卡号：</strong></td>
                <td>
                    <asp:TextBox ID="BankCard" runat="server" Text="" /></td>
            </tr>
            <tr class="bank" style="display: none">
                <td align="right" width="15%"><strong>银行户名：</strong></td>
                <td>
                    <asp:TextBox ID="CardName" runat="server" Text="" /></td>
            </tr>
            <tr class="tdbg">
                <td align="right" width="15%"><strong>经手人：</strong></td>
                <td>
                    <asp:TextBox ID="HandlerName" runat="server" Text="" />
                </td>
            </tr>
            <tr class="tdbg">
                <td align="right" width="15%"><strong>退款原因：</strong></td>
                <td>
                    <textarea id="Reason" style="width: 100%; height: 100px;" readonly><%=dr["Remark"].ToString().Split('|')[0] %></textarea>
                    <%Kesion.APPCode.EditorAPI.EchoHead(); %>
                    <%Kesion.APPCode.EditorAPI.EchoEditor("editor", "Reason", "Basic", 0, false, true, true, false);%>
                </td>
            </tr>

            <tr class="tdbg">
                <td align="right" width="15%"><strong>备注：</strong></td>
                <td>
                    <asp:TextBox ID="TxtRemark" TextMode="MultiLine" Width="100%" Height="100px" runat="server"></asp:TextBox>
                    <% Kesion.APPCode.EditorAPI.EchoEditor("editor", this.TxtRemark.ClientID, "Basic");%>
                </td>
            </tr>
            <tr class="tdbg">
                <td align="right" width="15%">通知会员：</td>
                <td>
                    <asp:CheckBox ID="SendMessageToUser" runat="server" Checked="true" Text="同时使用站内短信通知会员已经发货" /><br />
                    <asp:CheckBox ID="SendMailToUser" runat="server" Checked="true" Text="同时发送邮件通知会员已经发货" />
                    <%if (MyCache.GetCacheConfig(32) == "1")
                      {  %><br />
                    <asp:CheckBox ID="SendMobileToUser" runat="server" Checked="true" Text="同时发送手机短信通知会员已经发货" /><%} %>
                </td>
            </tr>

            <tr class="tdbg" align="middle">
                <td colspan="2" height="30">
                    <%if (action == "verify")
                      { %><asp:Button ID="BtnSubmit" runat="server" CssClass="button" Text="确认保存" OnClick="BtnSubmit_Click" /><%} %>
                        &nbsp;<input class="button" onclick="parent.isreload = false; parent.box.close();" type="button" value="取消返回" name="Submit">
                </td>
            </tr>
        </table>
    </asp:Panel>

</asp:Content>
