<%@ Page language="c#" Codebehind="ProductReviewDetail.aspx.cs" AutoEventWireup="true" Inherits="XpShop.Manage.ProductReviewDetail" %>
<!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>
		<title>查看评论详细内容</title>
		<!--#include file="inc/head.inc"-->
		<script type="text/javascript">		    
		    $(document).ready(function(){
		        $('#loadingContainer').ajaxStart(function(){$(this).show();}).ajaxStop(function(){$(this).hide();});
//		        $('#rblPass').click(function(){
		        $('input[@name=rblPass]').click(function(){
		            $.ajax({
		                url:'ProductReviewDetail.aspx?NoCopyRight=1&type=ajax&Action=UpdateReviewStatus&Status=' + $('input[@name=rblPass][@checked]').val() +'&Remark='+escape($('#txtRemark').val()) + '&PRID=<%=Request.QueryString["PRID"] %>',
		                cache:false,
		                success:function(data){
                            if(!checkLoginStatus(data)){return false;}
                            if(data==0){
		                        alert('更新审批状态成功');
		                    }
		                    else{
                                alert('更新审批状态失败');
		                    }
		                },
		                error:function(){alert('error');}
		            });
		            window.parent.isReload = true;
		        });
		        
		        $('.changestatus').click(function(){
		            var obj = $(this);
		            var status = obj.attr('status');
		            var replyid = obj.attr('replyid');
		            $.ajax({
		                url:'ProductReviewDetail.aspx?NoCopyRight=1&type=ajax&Action=UpdateReplyStatus&Status=' + status + '&RRID=' + replyid,
		                cache:false,
		                success:function(data){
		                    if(data == 1){
		                        if(status == 1){
		                            obj.text('[关闭显示]').attr('status','0');
		                        }else{
		                            obj.text('[开启显示]').attr('status','1');
		                        };
		                    };
		                },
		                error:function(){alert('error');}
		            });
		        });
		        
		        $('.deletereply').click(function(){
		            if(confirm('确定要删除此回复吗?')){
		                var replyid = $(this).attr('replyid');
		                $.ajax({
		                    url:'ProductReviewDetail.aspx?NoCopyRight=1&type=ajax&Action=DeleteReply&RRID='+replyid,
		                    cache:false,
		                    success:function(data){
		                        $('#reply_'+replyid).remove();
		                    },
		                    error:function(){alert('error');}
		                });
		            }
		        });
		        
		        if($('[@id^=reply_]').length > 0){
		            $('#tbReply').show();
		        }else{
		            $('#tbReply').hide();
		        }
		    });//end ready
            function checkLoginStatus(data){
                var result = true;
                if(data.indexOf('<!DOCTYPE') != -1){
                    result = false;
                    alert('身份已过期,请重新登陆!');
                };
                return result;
            };		    
		</script>
		<style type="text/css">
		    body{padding:0px;}
		</style>
	</head>
	<body>
	    
        <div class="frame" style="padding:0px;">
	        <div class="frame_content">
		        <form id="Form1" method="post" runat="server">
			        <table class="ptable" cellspacing="0" cellpadding="0">
			            <tr>
			                <th class="tl">评论标题：</th>
			                <td class="tr"><%=detail.Title %></td>
			            </tr>
			            <tr>
			                <th class="tl">订单号：</th>
			                <td class="tr"><%=detail.OrderNo %></td>
			            </tr>
			            <tr>
			                <th class="tl">评论人：</th>
			                <td class="tr"><%=detail.MemberName %></td>
			            </tr>
			            <tr>
			                <th class="tl">发表时间：</th>
			                <td class="tr"><%=detail.AddTime %></td>
			            </tr>
			            <tr>
			                <th class="tl">内容：</th>
			                <td class="tr"><%=detail.Body %></td>
			            </tr>
			            <tr>
			                <th class="tl">评分：</th>
			                <td class="tr"><%=detail.Score %></td>
			            </tr>
			            <tr>
			                <th class="tl">审核备注：</th>
			                <td class="tr"><asp:TextBox ID="txtRemark" TextMode="MultiLine" Text="" runat="server"></asp:TextBox></td>
			            </tr>
			            <tr>
			                <th class="tl">审批状态：</th>
			                <td class="tr">
			                    <asp:RadioButtonList id="rblPass" runat="server" RepeatDirection="Horizontal">
				                    <asp:ListItem Value="2">审批通过</asp:ListItem>
				                    <asp:ListItem Value="1">审批不通过</asp:ListItem>
			                    </asp:RadioButtonList>
			                </td>
			            </tr>
			        </table>
			        <table id="tbReply" style="width:100%; padding:0px;">
			            <tr>
			                <td>回复</td>
			                <td></td>
			            </tr>
			        <asp:Repeater id="rptReply" runat="server">
			            <ItemTemplate>
			                <tr id='reply_<%#DataBinder.Eval(Container.DataItem, "ReviewReplyID") %>'>
			                    <td style="border-bottom:1px dotted #000;">
			                        <table style="width:100%;" border="0" cellpadding="0" cellspacing="0">
			                            <tr style="background:#eeeeee;">
			                                <td style="width:33%;">会员号：<%# DataBinder.Eval(Container.DataItem, "MemberName")%></td>
			                                <td style="width:33%;">时间：<%# DataBinder.Eval(Container.DataItem, "ReplyTime")%></td>
			                                <td style="width:33%;">
			                                    <%# (int)DataBinder.Eval(Container.DataItem, "Status") != 1 ? "<span class='changestatus hand' replyid='" + DataBinder.Eval(Container.DataItem, "ReviewReplyID") + "' status='1'>[开启显示]</span>" : "<span class='changestatus hand' replyid='" + DataBinder.Eval(Container.DataItem, "ReviewReplyID") + "' status='0'>[关闭显示]</span>"%> 
			                                    <span class="deletereply hand" replyid='<%#DataBinder.Eval(Container.DataItem, "ReviewReplyID") %>'>[删除回复]</span>
			                                </td>
			                            </tr>
			                            <tr>
			                                <td colspan="3" align="left">
			                                    <%# DataBinder.Eval(Container.DataItem, "Body")%>
			                                </td>
			                            </tr>
			                        </table>
			                    </td>
			                </tr>
        			        
			            </ItemTemplate>
			        </asp:Repeater>
			        </table>
		        </form>
		     </div>
        </div>
	</body>
</html>
