{include file="page_header.htm"}
{insert_scripts files="../js/utils.js"}
<form name="review_form" action="review.php" method="post" id="review_form">
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="table_form1">

{if $product}
<tr>
<td class="label" width="120">产品:</td>
<td>{$product.name}</td>
</tr>
{/if}

{if $information}
<tr>
<td class="label" width="120">文章:</td>
<td>{$information.name}</td>
</tr>
{/if}

{if $order}
<tr>
<td class="label" width="120">订单号:</td>
<td>{$order.order_sn}</td>
</tr>
{/if}

<tr>
<td class="label" width="120">内容:</td>
<td>{$review.content}</td>
</tr>

<tr>
<td class="label" width="120">评分:</td>
<td>{$review.rating} 分</td>
</tr>

<tr>
<td class="label" width="120">日期:</td>
<td>{$review.date_added}</td>
</tr>	

{if $customer}
<tr>
<td class="label" width="120">用户名:</td>
<td>{$customer.user_name}</td>
</tr>	
{/if}				


<tr><td class="label">回复内容:</td>


<td>

<table width="100%"  border="0" cellspacing="0" cellpadding="0" >
<tr><td style="border:none;">
<ul id="reply_list">
{if $reply}
{foreach from=$reply item=list}
<li style="border-bottom:1px solid #CACBC7;padding-top:3px; padding-bottom:8px;">
{$list.content}<br />{$list.date_added}<br />{$list.author} <br />
<a href="javascript:void(0);" onclick="delete_reply(this,{$list.review_id})">[删除]</a>
</li>
{/foreach}
{/if}
</ul>
</td></tr>


</table>


</td></tr>


<tr><td class="label" width="120">回复:</td><td>
<textarea name="content" id="content" cols="50" rows="5"  class="FormSmall"></textarea>
</td></tr>

<tr>
<td style="border:none;" class="label">&nbsp;</td>
<td style="border:none;">
	<input class="bginput" OnClick="javascript:reply();" type="button" name="btn_reply" value="回复" /> 
	<input type="checkbox" name="checkboxes[]" value="{$review.review_id}" style="display:none;" checked="checked" />
	<input type="hidden" name="act" value="batch" />
	<input type="hidden" name="type" value="drop" id="type" />
	<input type="button"  OnClick="javascript:history.go(-1);" value="返回" class="bginput" />
	<input class="bginput" OnClick="javascript:delete_review();" type="button" name="delbutton" value="删除" /> 
</td>
</tr> 	
</table>
</form>
<script type="text/javascript">
{literal}
function delete_review(){
	if(confirm("确定删除?")==true){
		$('#review_form').submit();
	}
}

function delete_reply(obj,id){
	if(confirm("确认删除?")){
		$.ajax({
				url:"review.php",
				type:"post",
				dataType:"json",
				data:{"act":"delete_reply","id":id,"is_ajax":1},
				success:function(result){
					if (result.error == 0){
						$(obj).parent('li').remove();
					}
				}
		});		
	}
}

function reply(){
	var content = $('#content').val();
	if(content == ''){
		alert('请输入评价内容。');
	}
	$.ajax({
			url:"review.php",
			type:"post",
			dataType:"json",
			data:{"act":"reply","id":{/literal}{$review.review_id}{literal},"content":content,"is_ajax":1},
			beforeSend:function(){
				$("#loading").fadeIn("fast");
			},
			complete:function(){
				$("#loading").stop();
				$("#loading").fadeOut("fast");
			},
			success:function(result){
				if (result.error == 0){
					$("#reply_list").append(result.content);
				}
			}
	});
}
{/literal}
</script>
{insert_scripts files="tab.js,validator.js"}
{include file="page_footer.htm"}