<%@ Page language="c#" Codebehind="ProductReview.aspx.cs" AutoEventWireup="true" Inherits="XpShop.WebUI.ProductReview" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="LeftNavTop2Level" Src="Modules/LeftNavTop2Level.ascx" %>
<!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/encoding.inc"-->
		<!--#include file="../../inc/show_head.inc"-->
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/PageBar.css" rel="stylesheet" type="text/css"/>
		<script src="<%=webSite %>Template/<%=config.TemplateFolder%>/inc/PageBar.js" type="text/javascript"></script>
		<script src="<%=webSite %>Template/<%=config.TemplateFolder%>/inc/ProductReview.js" type="text/javascript"></script>
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/show.css" type="text/css" rel="stylesheet" />
		<link href="<%=webSite %>Template/<%=config.TemplateFolder%>/style/tabs.css" rel="stylesheet" />
		<script type="text/javascript">
		    var baseUrl="<%=webSite %>";
			var shopFolder="<%=webSite %>";
		    var returnUrl='<%=Request.Url.AbsoluteUri %>';
		    var productID = '<%=Request.QueryString["PID"] %>';
	        var Specs = "<%=product.Spec %>";
		    var SpecDesc = "<%=product.SpecDesc %>";
		    var SkuMap=<%=product.SkuMap=="" ? "{}" : product.SkuMap%>;
		    var PageSize = 10;
            var CurrentPage = 1;
            var showpage = true;
			var reviewType = '<%=Request.QueryString["ReviewType"]%>';
            var reviewvotewords = '这条评论对您：<span class="vote_y">有用</span>(<a class="yesnum">{0}</a>)  <span class="vote_n">无用</span>(<a class="notnum">{1}</a>)';
		</script>
	</head>
	<body>
		<uc1:Header id="Header1" runat="server"></uc1:Header>
		<div class="xp-w clear">
		    <!--位置导航开始-->
		    <div class="path"><a href="<%=webSite %><%if(config.html==""){%>default.aspx<%}else{%>Index.<%=config.html%><%}%>"><%=GetResourceString("Home")%></a>&nbsp;&gt;&nbsp;商品评论</div>
		    <!--位置导航结束-->
			<div id="content_left">
		        <!--商品信息开始-->
		        <div class="lframe">
			        <div class="tl"></div>
			        <div class="tr"></div>
			        <div class="tm">
				        商品信息
			        </div>
			        <div class="ml"></div>
			        <div class="mr"></div>
			        <div class="mm clearfix" style="padding:5px;">
				        <ul style="width: 190px;">
					        <li style="line-height: 20px; overflow: hidden; text-align: center;"><img id="thumbnail_img" src="<%=webSite %>upload/ProductImg/<%=product.ImgFolder%><%=product.ThumbnailImg%>"/></li>
					        <li style="line-height: 20px; overflow: hidden;"><b><%=product.ProductName %></b></li>
					        <li style="line-height: 20px; overflow: hidden;">市场价：<%=product.MarketPrice %></li>
					        <li style="line-height: 20px; overflow: hidden;">会员价：<%=product.MemberPrice %></li>
					        <li style="line-height: 20px; overflow: hidden;">
						        <table>
							        <tbody><tr>
								        <td>商品评分：</td>
										<td><div class="pingfen<%=Convert.ToInt32(product.PingFen)==0 ? 5 : Convert.ToInt32(product.PingFen)%>"></div></td>
							        </tr>
						        </tbody></table>
					        </li>
					        <li style="line-height: 20px; overflow: hidden;">评论数：<%=product.Reviews %></li>
					        <li>					    
                            <form action='<%=webSite %>mycart.aspx' method="post" target="_blank">
						        <div id="product" style="margin-top: 5px; text-align: center;">
							        <input type="hidden" id="pid" name="pid" value=<%=product.ProductID %> />
							        <input type="hidden" id="gid" name="gid" value=0 />
                                    <input type="hidden" name="ptype" value=1 />
                                    <input type="hidden" name="qty" value='<%=product.MiniBuyNum %>' />
						            <script language="javascript" type="text/javascript">
                                        if(Specs == "" && SpecDesc == ""){
                                            $('#gid').val(SkuMap["0:0;0:0"]["skuId"]);
                                        }
                                        else//多规格的商品，取第一个货品
                                        {
                                            for(property in SkuMap)
                                            {
                                                var gid=(SkuMap[property]["skuId"]);
                                                break;
                                            }
                                            $('#gid').val(gid);
                                        }
					                </script>
                                    <input type="submit" value="" id="btnBuy" class="buy">
						        </div>
						        </form>
					        </li><li>
				        </li>
				        </ul>
			        </div>
			        <div class="bl"></div>
			        <div class="br"></div>
			        <div class="bm"></div>
		        </div>
		        <!--商品信息结束-->
			</div>
			<div id="content_right">
			    <!--商品评论Tab开始-->
                <div id="tabContainer" class="clear" style="margin-top:0px;">
		            <!--Tab菜单结束-->
		            <div id="commentTab" class="clear">
                        <ul class="menuconainer"> 
	                        <li class="menuitem tabon">全部(<%=product.Reviews %>)</li> 
	                        <li class="space">&nbsp;</li>
	                        <li class="menuitem tabout">很好(<%=Convert.ToInt32(product.PJ1) %>)</li>  
	                        <li class="space">&nbsp;</li>
	                        <li class="menuitem tabout">较好(<%=Convert.ToInt32(product.PJ2) %>)</li> 
	                        <li class="space">&nbsp;</li>
	                        <li class="menuitem tabout">一般(<%=Convert.ToInt32(product.PJ3) %>)</li> 
	                        <li class="space">&nbsp;</li>
	                        <li class="menuitem tabout">较差(<%=Convert.ToInt32(product.PJ4) %>)</li> 
	                        <li class="space">&nbsp;</li>
	                        <li class="menuitem tabout">很差(<%=Convert.ToInt32(product.PJ5) %>)</li> 
                        </ul>
						
						<div class="itemcontainer">	
						    <div id="itemplate2" class="hide">
							<!--用户评论模板开始-->
							    <div class="item clear" id="reviewtemplate">
								    <div class="rev">
									    <div class="revinfo">
									        <div class="userinfo">
                                                <div class="icon" ><img src='#' alt=''/></div>
										        <div class="username">admin</div>   
                                                <div class="groupname">钻石会员</div>                                             
										        <%--<div class="ordertime">购买日期</div>--%>
									        </div>
										    <div class="revhead">
											    <div class="revtitle">标题</div>
											    <div class="star"></div>
											    <div class="revtime">时间</div>
										    </div>
                                            <div class="revbody">评论内容</div>
                                            <div class="btns">
                                                <div class="revvote"><div class="ques">这条评价对您有用吗?</div><div class="vote_y hand">有用(<span class="yesnum">1</span>)</div><div class="vote_n hand">没用(<span class="notnum">1</span>)</div></div>
                                                <div style="float:right;">
                                                <div class="btnreply btnbg hand">我要回复</div>
                                                <div class="btnviewrep btnbg hand">关闭回复</div>
                                                </div>
											    <div class="separateline"></div>
                                            </div>	
                                            <div class="reply" style="display:block">
										        <div id="reptemplate" class="reptemplate" style="display:none;">
											        <div class="repname">wolanda：</div>
											        <div class="repbody">回复内容</div>
											        <div class="reptime">回复时间</div>
											        <div class="separateline"></div>
										        </div>
									        </div>

    <%--												<div class="btns">
											    <div class="btnreply btnbg hand">我要回复</div>
										    </div>--%>
									    </div>
								    </div>
								    <!--用户评论模板结束-->
							    </div>
							    <!--回复框开始-->
							    <div id="ReplySumbit" style="padding-left:130px;display:none;width:840px ;float:left;">
								    <form id="frmReply" action="">
									    <textarea id="txtReply" name="txtReply" cols="50" rows="5"></textarea>
									    <input type="hidden" id="hidden_reviewID" name="hidden_reviewID" value="0" /><br>
									    <input type="button" id="btnReply" name="btnSubmit" value="提交">　<input type="button" id="btnCancel" value="取消">
								    </form>
							    </div>
							    <!--回复框结束-->                                            
							    <!--用户评论结束-->
						    </div>	   
							<div class="tabitem">
								<div id="review-0" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-0"></div>
							</div>
							<div class="tabitem">
								<div id="review-1" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-1"></div>
							</div>
							<div class="tabitem">
								<div id="review-2" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-2"></div>
							</div>
							<div class="tabitem">
								<div id="review-3" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-3"></div>
							</div>
							<div class="tabitem">
								<div id="review-4" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-4"></div>
							</div>
							<div class="tabitem">
								<div id="review-5" class="ReviewContent"></div>
								<div class="sub_container_page clear" id="revew-pager-5"></div>
							</div>

                        </div>
					</div>
<%--					<%if(product.Reviews==0){%>
					<div class="ReviewContent-btn clear">
                        <div style="color:#fe6601; float:left; line-height:25px;">注：只有购买过该商品的用户才能发表评价。</div>
                        <div class="ReviewContent-viewpl"><a href='<%=webSite %>Review-<%=product.ProductID%>-1.<%=config.html %>' target="_blank">查看所有评论</a></div>
                        <div class="ReviewContent-fbpl"><a href='<%=webSite %>Review-<%=product.ProductID%>-1-1.<%=config.html %>' target="_blank">发表评论</a></div>
                        
                    </div>
					<%}%> --%>                                  
					<!--商品评论Tab结束-->
		        </div>			                        
			   <script type="text/javascript">
					var PageSize=10;
					var CurrentPage=1;
					var ReviewID=0;
					var showpage=true;
					var reviewType=1;
					var thisUrl = 'ProductReview.aspx';
					var votewords = '您对我们的回复：<span class="vote_y">满意</span>(<a class="yesnum">{0}</a>)  <span class="vote_n">不满意</span>(<a class="notnum">{1}</a>)';
					var reviewvotewords = '这条评论对您：<span class="vote_y">有用</span>(<a class="yesnum">{0}</a>)  <span class="vote_n">无用</span>(<a class="notnum">{1}</a>)';
				</script>
				<script src="<%=webSite %>Template/<%=config.TemplateFolder%>/inc/ShowFunc.js" type="text/javascript"></script>
				<script type="text/javascript">
					SetTab('tabContainer',true,false);
					SetTab('commentTab',false,true);
				</script>
				<!--Tab菜单结束-->  
			
			    <div class="mframe">
					<div class="tl"></div>
					<div class="tr"></div>
					<div class="tm">
					    发表评论
					</div>
					<div class="ml"></div>
					<div class="mr"></div>
					<div class="mm">
				        <%if(CurrentUser != null && CurrentUser.Name != "anonymous") {%>
				            <% if(canReview){%>
				            <form id="Form1" method="post" runat="server">
		                        <table>
		                            <tr>
		                                <td>评论标题</td>
		                                <td><asp:TextBox runat="server" ID="txtTitle" Columns="80"></asp:TextBox></td>
		                            </tr>
		                            <tr>
		                                <td valign="top">评论内容</td>
		                                <td><asp:TextBox id="txtContent" runat="server" TextMode="MultiLine" Columns="80" Rows="5"></asp:TextBox></td>
		                            </tr>
		                            <tr>
		                                <td>评分</td>
		                                <td>
		                                    <asp:RadioButtonList id="rblScore" runat="server" RepeatDirection="Horizontal">
			                                    <asp:ListItem Value="5" Selected="true">5分 </asp:ListItem>
			                                    <asp:ListItem Value="4">4分 </asp:ListItem>
			                                    <asp:ListItem Value="3">3分 </asp:ListItem>
			                                    <asp:ListItem Value="2">2分 </asp:ListItem>
			                                    <asp:ListItem Value="1">1分 </asp:ListItem>
		                                    </asp:RadioButtonList>
		                                </td>
		                            </tr>
		                            <tr>
		                                <td></td>
		                                <td>
		                                    <asp:Button id="btnSubmit" onclick="btnSubmit_Click" runat="server" Text="提交"></asp:Button>
		                                </td>
		                            </tr>
		                        </table>
	                        </form>
	                        <%}  %>
	                        <%else
                            {%>
                            <h2>您暂不能对该商品进行评价，可能有以下原因：</h2>
                            1.您可能没有购买过该商品；<br />
                            2.购买时间已经超过半年；<br />
                            3.您已经评价过该商品。 <br />
                            <%
                            }%>
	                    <%} else {%>
	                        <div class="clear">只有购买过此商品的用户才可以评论  <a href='Login.aspx?ReturnUrl=/<%=ShopFolder %>Review-<%=Request.QueryString["PID"] %>-<%=Request.QueryString["ReviewType"] %>.<%=config.html %>'>请先登录</a></div>
	                    <%} %>
				    </div>
				<div class="bl"></div>
				<div class="br"></div>
				<div class="bm"></div>
			</div>
			    
			</div>
			<div style="clear:both;"></div>
		</div>
		<uc1:Helper id="Helper1" runat="server"></uc1:Helper>
		<uc1:Footer id="Footer1" runat="server"></uc1:Footer>			
	</body>
</html>