<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AppRefundModify.aspx.cs" Inherits="XpShop.Manage.AppRefundModify" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	    <!--#include file="inc/head.inc"-->
		<title>退款管理</title>
		<link type="text/css" rel="stylesheet" href="style/multi_popup.css" />
        <link type="text/css" rel="stylesheet" href="style/ui.datepicker.css" />
	    <script src="inc/jquery.validate.js" type="text/javascript"></script>
	    <script src="inc/messages_cn.js" type="text/javascript"></script>
<%--		<link rel="stylesheet" type="text/css" href="style/cmxform.css" />
--%>		<style type="text/css">
           table.thinBorder {border-collapse:collapse;border:solid #999;border-width:1px 0 0 1px;}
            table.thinBorder caption {font-size:14px;font-weight:bolder;}
            table.thinBorder th,table.thinBorder td {border:solid #999;border-width:0 1px 1px 0;padding:2px;}
            table.thinBorder tfoot td {text-align:center;}
            .tdborder {BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid}
            /*弹出窗口*/
            .popupWindow{position: absolute; z-index: 100;display: none;background-color:#FFFFFF;border:solid 1px #ccc;width: 550px;}
            .popupHead{}
            .popupTitle{}
            .popupClose{}
            .popupContent{padding:0px;width: 100%;height:350px ; max-height:350px;overflow:auto;}
            .tips{font-size:14px;height:30px;padding-left:15px;padding-top:10px}
            .item{font-size:12px;padding-left:15px}
            .popupFooter{width:100%;text-align:center;margin:10px 0 10px 0}
            .btn{height:20px;}
             #maskLayer{background-color:#e3e3e3; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}
 	        .save{z-index:1;text-align:center;}
 	        
        </style>
        
        <script type="text/javascript">
        $(document).ready(function(){
            var pageH = $(document.body).height();
            var pageW = $(document.body).width();
            var winH = $(window).height();
            var maxH = Math.max(winH, pageH);
            settab();         
//	        //审核申请
//            $('#doApplyConfirm').click(function(){
//	            $('#ApplyConfirmDiv').css("left",($('.sub_container_content').width()-$('#ApplyConfirmDiv').width())/2);
//	            $('#ApplyConfirmDiv').css("top",$('.sub_container_content').scrollTop()+50);
//	            $('#ApplyConfirmDiv').show();
//                $('#maskLayer').show().width(pageW).height(maxH);         
//	        })
//            $('#closeApplyConfirm').click(function(){
//	            $('#ApplyConfirmDiv').hide();
//	            $('#maskLayer').hide();
//	        });

            //提交退款单
            $('#doRefund').click(function(){
	            $('#RefundDiv').css("left",($('.sub_container_content').width()-$('#RefundDiv').width())/2);
	            $('#RefundDiv').css("top",$('.sub_container_content').scrollTop()+50);
	            $('#RefundDiv').show();
                $('#maskLayer').show().width(pageW).height(maxH);         
	        })
            $('#closeRefund').click(function(){
	            $('#RefundDiv').hide();
	            $('#maskLayer').hide();
	        });
	        
	        $('[@name=rblPayMethod]').attr("readonly","true");
//	        退款到会员账户，就不需要银行信息
            if($('[@name=rblPayMethod][@value=1]').is(":checked")){
                $('#txtRefundPayBank').parents("tr").hide();
                $('#txtRefundPayerName').parents("tr").hide();
                $('#txtRefundBank').parents("tr").hide();
                $('#txtRefundAccountName').parents("tr").hide();
                $('#txtRefundOutTradeNo').parents("tr").hide();
            }     
        
	        //显示隐藏银行卡相关信息
	        if($('[@name=rblRepaireType][@value=1]').is(":checked")||$('[@name=rblRepaireType][@value=4]').is(":checked")){
                $('.refundType').show();
                if($('[@name=rblRefundType][@value=2]').is(":checked")){
                    $('.bankInfo').show();
                }
            }
	        if($('[@name=rblRepaireType][@value=2]').is(":checked")||$('[@name=rblRepaireType][@value=3]').is(":checked")){
                $('.refundType').hide();
                if($('[@name=rblRefundType]').is(":checked")){
                   $('[@name=rblRefundType]').removeAttr("checked");
                }
                HideBankInfo();
            }
            
            if($('[@name=rblRefundType][@value=2]').is(":checked")){
                $('.bankInfo').show();
            }
            if($('[@name=rblRefundType][@value!=2]').is(":checked")){
                HideBankInfo();
            }	        
           
            $("#Form1").validate({
	            event: "keyup",
	            rules: {
	                //验证提交退款单
	                txtRefundPayBank: {
		                required:function(){
                            if($('#txtRefundPayBank').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			             maxlength:50
                    },
                    txtRefundPayBankAccount: {
		                required:function(){
                            if($('#txtRefundPayBankAccount').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            maxlength:50
                    },
                    txtRefundBank: {
		                required:function(){
                            if($('#txtRefundBank').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            maxlength:50
                    },
                    txtRefundBankAccount: {
		                required:function(){
                            if($('#txtRefundBankAccount').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            maxlength:50
                    },
		            txtRefundPayerName: {
		                required:function(){
                            if($('#txtRefundPayerName').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            maxlength:50
                    },
                    txtRefundMoney: {
		                required:function(){
                            if($('#txtRefundMoney').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            number:true
                    },
                    txtRefundOutTradeNo: {
		                required:function(){
                            if($('#txtRefundOutTradeNo').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            maxlength:50
                    },
                    txtRefundPayTime: {
		                required:function(){
                            if($('#txtRefundPayTime').parents(":hidden").size()>0)
                            return false
                            else
                            return true
			             },
			            dateISO:true
                    },
                    txtRefundRemark:{
			            maxlength:200
			        }
	            },		
	            messages: {
		            txtRefundPayBank: {
			            required: "退款银行名称必填",
			            maxlength: "最大长度只能在(50个字符)以内"
			            
		            },
		            txtRefundPayBankAccount: {
			            required: "退款银行账号必填",
			            maxlength: "最大长度只能在(50个字符)以内"
			            
		            },
		            txtRefundPayerName: {
                        required: "付款人必填",
			            maxlength: "最大长度只能在(50个字符)以内"
		            },
		            txtRefundBank: {
                        required: "收款银行名称必填",
			            maxlength: "最大长度只能在(50个字符)以内"
		            },
		            txtRefundBankAccount: {
                        required: "收款银行账号必填",
			            maxlength: "最大长度只能在(50个字符)以内"
		            },
		            txtRefundMoney: {
                        required: "退款金额必填",
			            number: "退款金额必须是数字"
		            },
		            txtRefundOutTradeNo: {
                        required: "外部交易号必填",
			            maxlength: "最大长度只能在(20个字符)以内"
		            },
		            txtRefundPayTime: {
                        required: "退款日期必填",
			            dateISO: "日期格式不正确"
		            },		            
		            txtRefundRemark: {
			            maxlength: "最大长度只能在(200个字符)以内"
		            }
		            
	            },
	            debug:"false",
	            submitHandler:function(form){
		            form.submit();
	            }
            });
	        })
	        
            function HideBankInfo(){
                $('.bankInfo').hide();
                $('#txtBankName').val('');
                $('#txtBankAccount').val('');
                $('#txtAccountName').val('');
            }
               	        
	        function settab(){
                var items = $('li.menuitem').length;
                $('li.menuitem').each(function(index){
                    $(this).click(function(){
                        $(this).addClass('tabon').removeClass('tabout').siblings('.menuitem').removeClass('tabon').addClass('tabout');
                        if(index != 0){
                            $('div.tab').hide();
                            $('div.tab').eq(index - 1).show();
                        }else{
                            $('div.tab').show();
				            if($('[@id^=pproductno-]').length > 0)
				            {
					            $(".frame").eq(3).hide();
				            }
                        }
                    });
                });
            };
        </script>
	</head>
	<body>
	    <!-- 遮罩层 -->
	    <div id=maskLayer></div>
	    <div class="container">
		<div class="sub_container">
		<form id="Form1" method="post" runat="server">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height="9px" width="8px" align="absmiddle" />退款管理</div>
		<div class="sub_container_tabs">
			<div class="tabmenu">
			    <ul>
			        <li class="menuitem tabon">全部信息</li>
			        <li class="menuitem tabout">操作日志</li>
                    <li class="menuitem tabout">申请表信息</li>
			        <li class="menuitem tabout">退换货/返修商品信息</li>
			        <li class="menuitem tabout">物流信息</li>
                    <li class="menuitem tabout">退款信息</li>                    
			    </ul>
			</div>
		</div>
		<div class="sub_container_content"style="position:relative;z-index:1">
            <div class="frame tab">
		        <div class="frame_title">操作日志</div>
		        <div class="frame_content" style="text-align:left">
			        <div class="order_operator">
                        <div>
                            <table width="100%" cellspacing="0" cellpadding="0">
                                <tbody>
                                    <tr>
                                        <th style="text-align:left"width="20%">操作角色</th>
                                        <th width="30%">操作时间</th>
                                        <th width="50%">操作</th>
                                    </tr>
                                    <asp:repeater id="rptAppOpLog" Runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OpRule")%></td>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OPTime")%></td>
                                                <td><%# DataBinder.Eval(Container.DataItem, "OPDesc")%></td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:repeater>
                                    <tr>
                                        <%if (appRefundDetail.IsConfirm == 0){%>
                                                <td>管理员</td>
                                                <td>------</td>
                                                <td>
                                                <a id="doApplyConfirm" style="cursor:pointer;color:blue">审核退款申请</a><br />
                                                </td>
                                        <%}
                                          else if (appRefundDetail.IsConfirm == 1 && appRefundDetail.IsRefunded == false)
                                          {%>
                                                <td>管理员</td>
                                                <td>------</td>
                                                <td>
                                                <a id="doRefund" style="cursor:pointer;color:blue">确认退款</a><br />
                                                </td>
                                        <%}%>
                                    </tr>    
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
	        </div>
		    <div class="frame tab">
		        <div class="frame_title">申请表信息</div>
		        <div class="frame_content">
                    <table class="ptable">
                        <tr>
                            <th class="tl">期待处理方式：</th>
                            <td class="tr">
                                <asp:RadioButtonList id="rblRepaireType" runat="server" RepeatDirection="Horizontal" RepeatLayout="flow">
		                            <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>
                        </tr>
                        <tr>
                            <th class="tl" >问题描述：</th>
                            <td  class="tr"><asp:TextBox id="txtReason" runat="server" Columns="80" Rows="5" TextMode="multiLine"></asp:TextBox></td>
                        </tr>
                        <tr class="refundType"  >
                            <th class="tl">退款方式：</th>
                            <td class="tr">
                                <asp:RadioButtonList id="rblRefundType" runat="server" RepeatDirection="vertical" RepeatLayout="flow">
		                            <asp:ListItem Value="1" Selected="True">退款至账户余额（推荐，不会收取手续费） </asp:ListItem>
		                            <asp:ListItem Value="2">退款至银行卡（跨行退款需要扣除一定积分用以支付银行手续费）</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr class="bankInfo" >
                            <th class="tl">开 户 行：</th>
                            <td><asp:TextBox id="txtBankName" runat="server" ></asp:TextBox></td>
                        </tr>
                        <tr class="bankInfo">
                            <th class="tl">收款账户：</th>
                            <td class="tr"><asp:TextBox id="txtBankAccount" runat="server" ></asp:TextBox></td>
                        </tr>
                        <tr class="bankInfo">
                            <th class="tl">收款账户名：</th>
                            <td class="tr"><asp:TextBox id="txtAccountName" runat="server"  ></asp:TextBox></td>
                        </tr>	
                        <tr>
                            <th class="tl">收货地址：</th>
                            <td class="tr"><asp:TextBox id="txtReceiverAddress" runat="server"  Columns="80" ></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th class="tl">联 系 人：</th>
                            <td class="tr"><asp:TextBox id="txtReceiverName" runat="server" ></asp:TextBox></td>
                        </tr>
                        <tr>
                            <th class="tl">手机号码：</th>
                            <td class="tr"><asp:TextBox id="txtMobile" runat="server"></asp:TextBox></td>
                        </tr>		                        
                        <tr>
                            <th class="tl">申请时间：</th>
                            <td class="tr"><asp:TextBox id="txtAddTime" runat="server"></asp:TextBox>
                            
                            </td>
                        </tr>	
                </table>
                    <input type=hidden name=aid value=<%=appFormDetail.AID %> />
                    <%--<input type=hidden name=type value=<%=appFormDetail.Type %> />--%>
                    <%--<input type=hidden name=orderid value=<%=appFormDetail.OrderID %> />--%>
                    <input type=hidden name=orderno value=<%=appFormDetail.OrderNo %> />
                    <%--<input type=hidden name=membername value=<%=appFormDetail.Applicant %> />--%>
                </div>
	        </div>
	        
		    <div class="frame tab">
		        <div class="frame_title">退换货/返修商品信息</div>
		        <div class="frame_content">
                    <table id="tbPdts" width="95%" class="thinBorder">
				        <tbody>
					        <tr>
						        <td>商品编号</td>
						        <td>商品名称</td>
						        <td>数量</td>
						        <td>价格</td>
						        <td>优惠信息</td>
						        <td>赠品信息</td>
					        </tr>
					        <asp:repeater id="rptAppPdt" Runat="server">
						        <ItemTemplate>
							        <tr>
								        <td><%# DataBinder.Eval(Container.DataItem, "ProductNo") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "ProductName") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "Quantity") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "Price") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "PmtInfo") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "GiftInfo") %></td>
							        </tr>
						        </ItemTemplate>
					        </asp:repeater>
				        </tbody>
			        </table>
		        </div>
	        </div>
		    <div class="frame tab">
		        <div class="frame_title">物流信息</div>
		        <div class="frame_content">
                    <table id="Table1" width="95%" class="thinBorder">
				        <tbody>
					        <tr>
					        <th>物流公司</th>
					        <th>物流单号</th>
					        <th>配送方式</th>
					        <th>配送价格</th>
                            <th>发货人姓名</th>
					        <th>发货人电话</th>
					        <th>发货时间</th>
					        </tr>
					        <asp:repeater id="rptAppShipping" Runat="server">
						        <ItemTemplate>
							        <tr>
								        <td ><%# DataBinder.Eval(Container.DataItem, "ShippName") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "ShippNo") %><br>
								        <td><%# DataBinder.Eval(Container.DataItem, "ShipType") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "ShippPrice")%></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "SenderName") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "SenderPhone") %></td>
								        <td><%# DataBinder.Eval(Container.DataItem, "ShippTime") %></td>
							        </tr>
						        </ItemTemplate>
					        </asp:repeater>
				        </tbody>
			        </table>
		        </div>
	        </div>
	
	        <div class="frame tab">
	            <div class="frame_title">退款信息</div>
	            <div class="frame_content">
                    <table id="Table2" width="95%" class="thinBorder">
				        <tbody>
					        <tr>
					        <th>订单编号</th>
					        <th>退款金额</th>
					        <th>会员ID</th>
					        <th>真实姓名</th>
					        <th>联系电话</th>
					        <th>是否审核通过</th>
                            <th>审核通过的时间</th>
					        <th>是否已退款</th>
					        <th>退款时间</th>
					        </tr>
					        <asp:repeater id="rptAppRefund" Runat="server">
						        <ItemTemplate>
							        <tr>
								        <td ><%# DataBinder.Eval(Container.DataItem, "OrderNo") %></td>
								        <td align="left"><%# DataBinder.Eval(Container.DataItem, "Money") %><br>
								        <td align="left"><%# DataBinder.Eval(Container.DataItem, "MemberID") %></td>
								        <td align="center"><%# DataBinder.Eval(Container.DataItem, "Realname")%></td>
								        <td align="left"><%# DataBinder.Eval(Container.DataItem, "Mobile") %></td>
							            <td align="left"><%# DataBinder.Eval(Container.DataItem, "IsConfirm") %></td>
                                        <td align="center"><%# DataBinder.Eval(Container.DataItem, "ConfirmTime") %></td>
								        <td align="left"><%# DataBinder.Eval(Container.DataItem, "IsRefunded") %></td>
								        <td align="center"><%# DataBinder.Eval(Container.DataItem, "RefundTime") %></td>
                                    </tr>
						        </ItemTemplate>
					        </asp:repeater>
				        </tbody>
			        </table>
                </div>
	        </div>
		</div>


        <%--弹出层--%>
        <div id="ApplyConfirmDiv" class="popupWindow" >
        <div class="popupHead">
        <div class="popupTitle">审核退款申请</div>
        <div class="popupClose" id="closeApplyConfirm"><span id="Span3">×</span></div>
        <div class="clear" ></div>
        </div>
        <div class="popupContent">
            <table style="width:100%;" class="thinBorder">
                    <tr>
                        <td>操作：</td>
                        <td colspan="3">
                            <input type="radio" id=comfirm1 name="confirm" value="1"  checked="checked"/><label for="comfirm1">同意此申请</label>
                            <input type="radio" id=confirm2 name="confirm" value="2"  /><label for="comfirm2">拒绝此申请</label>
                        </td>
                    </tr>
                    <tr>
                    <td>操作备注：</td>
                    <td colspan="3">
                    <asp:TextBox ID="txtConfirmRemark"  TextMode=MultiLine Rows="4" Columns="40" runat=server></asp:TextBox>最多200字符</td>
                </tr>
            </table>
        </div>
        <div class="popupFooter">
            <asp:button text="提交" class="btn " id="btnConfirm"  runat=server  OnClick="btnConfirm_Click"/>
        </div>
        </div>        
        
<%--        提交退款信息--%> 
        <div id="RefundDiv" class="popupWindow">
            <div class="popupHead">
                <div class="popupTitle">退款</div>
                <div class="popupClose" id="closeRefund"><span>×</span></div>
                <div class="clear" ></div>
            </div>
            <div class="popupContent">
                <table style="width:100%;" class="thinBorder">
                    <tr>
                        <td style="width:15%;">订单号：</td>
                        <td style="width:35%;"><%=appRefundDetail.OrderNo%></td>
                        <td style="width:15%">申请时间：</td>
                        <td style="width:35%;"><%=appRefundDetail.AddTime%></td>
                    </tr>
                    <tr>
                        <td>退款至：</td>
                        <td colspan="3">
                            <asp:RadioButtonList id="rblPayMethod"  runat="server" RepeatDirection="Horizontal" RepeatLayout="flow">
	                            <asp:ListItem Value="1">客户电子账号</asp:ListItem>
	                            <asp:ListItem Value="2">客户银行卡</asp:ListItem>
                            </asp:RadioButtonList></td>
                    </tr>
                    <tr>
                        <td>付款银行：</td>
                        <td ><asp:TextBox ID=txtRefundPayBank runat=server></asp:TextBox><em>*</em></td>
                        <td>付款账号：</td>
                        <td ><asp:TextBox ID=txtRefundPayBankAccount runat=server></asp:TextBox><em>*</em></td>
                    </tr>
                    <tr>
                        <td>付款人：</td>
                        <td colspan=3><asp:TextBox ID=txtRefundPayerName runat=server></asp:TextBox><em>*</em></td>
                    </tr>                    
                    <tr>
                        <td>收款银行：</td>
                        <td ><asp:TextBox ID=txtRefundBank runat=server></asp:TextBox><em>*</em></td>
                        <td>收款账号：</td>
                        <td ><asp:TextBox ID=txtRefundBankAccount runat=server></asp:TextBox><em>*</em></td>
                    </tr>
                    <tr>
                        <td>收款人账户名：</td>
                        <td colspan=3><asp:TextBox ID=txtRefundAccountName runat=server></asp:TextBox><em>*</em></td>
                    </tr>
                    <tr>
                        <td>退款金额：</td>
                        <td colspan=3><asp:TextBox ID=txtRefundMoney runat=server></asp:TextBox><em>*</em></td>
                    </tr> 
                    <tr>
                        <td>外部交易号：</td>
                        <td ><asp:TextBox ID=txtRefundOutTradeNo runat=server></asp:TextBox><em>*</em></td>
                        <td>退款时间：</td>
                        <td ><asp:TextBox ID=txtRefundPayTime runat=server></asp:TextBox><em>*</em></td>
                    </tr> 
                    <tr>
                        <td>备注：</td>
                        <td colspan=3 ><asp:TextBox ID=txtRefundRemark runat=server Columns=50 Rows=5 TextMode="multiLine"></asp:TextBox>最多200个字符</td>
                    </tr>
                </table>
            </div>
            <div class="popupFooter">
                    <asp:button text="提交退款信息" class="btn" id="btnRefund" runat=server onclick="btnRefund_Click" />
                    
            </div>
        </div>
		</form>
		</div>
	</div>
	</body>
</html>
