<{import file="index/header.html" title="产品评价"}> 
<link href="<{$__PUBLIC__}>plug/raty/jquery.raty.css" rel="stylesheet" type="text/css">
<style type="text/css">
table.list_table thead tr th{ padding:0; margin:0;}
table.list_table tbody tr td{ padding:0px 0;}

.shop_score{ width:1030px; padding:10px 0 0 0; float:left;}
.shop_score .name{ width:230px; padding:20px 0 6px 0; float:left;}
.shop_score .name span{ width:230px; text-align:center; font-size:14px; padding:0; float: left;} 
.shop_score .con{ width:750px; padding:10px 0 30px 0; float:left;} 
.shop_score .con dl{ width:250px; padding:6px 0 6px 0; float:left;} 
.shop_score .con dl dt{ width:80px; text-align:right; padding:5px 5px 0 0; color:#666666; float: left;} 
.shop_score .con dl dd{ padding:2px 0 0 0; float:left;} 
.shop_score .con dl dd img{ margin-right:3px;}

.gbox{ width:1028px; border:1px solid #f2f2f2; border-left:none; border-right:none; margin-top:-1px; float: left; }
.showbox{ width:250px; border-right:1px solid #ddd; margin:20px 0 20px 0; float:left;}
.showbox .gimg{ width:250px; text-align:center; float:left;}
.showbox .gimg a{ width:60px; }
.showbox .gimg a img{}
.showbox .ttl{ width:220px; padding:10px 10px 0; float:left; }
.showbox .ttl span{ width:200px; padding:0 15px; color:#666; text-align:center; float:left; } 
.showbox .gpf{ padding:0; margin:22px 50px 0 0; float:right;}
.showbox .gpf a{ float:left;}

.upload_box{ float:left; }
.upload_box .img{ width:50px; height:50px; margin-right:10px; border:1px solid #efefef; overflow:hidden; float:left; }
.upload_box .img img{ max-width:50px; height:50px; position:absolute; float:left;}
.upload_box .img i{ width:50px; height:50px; display:none; float:left; z-index:2; font-style:inherit; text-align:center; line-height:50px; color:#FFFFFF; background-color:rgba(0,0,0,0.4); cursor:pointer; position: relative; left:0; top:0; }
.upload_box .img:hover i{ display:block; }
.upload_button{ float:left; }

.showsub{ width:700px; padding:8px 0; margin-top:-1px; float:left;}
.showsub dl{ width:700px; padding:10px 0; float:left;}
.showsub dl dt{ width:150px; padding:3px 26px 0 0; text-align:right; color:#666; float:left;}
.showsub dl dd{ width:500px; float:left;}
.showsub dl dd img{ margin-right:3px;}

.sub{ width:100%; text-align:center; padding:15px 0 0 0; float:left;}
.sub input{ float:none; padding:8px 20px; background:#5CBB72; font-size:16px; color:#FFFFFF; border-radius:2px; }
</style> 
<{uqcms m="order" v="data" c="get_comment:smarty.get.oid"}>
<div class="lbox">
<form id="form" action="#" method="post"> 
	<input type="hidden" name="oid" value="<{$data.order_row.order_no}>"/>
	<div class="shop_score">
		<div class="name"><span>店铺动态评分</span></div>
		<div class="con">
			<{if !$shop_score.status}>
				<dl>
					<dt>产品满意度：</dt>
					<dd>
						<div class="shop_pf" data-score="<{$data.shop_score.service}>"></div> 
						<input type="hidden" id="sps_goods" class="sps_val" name="shop_goods_score"/>
					</dd>
				</dl>
				<dl>
					<dt>服务满意度：</dt>
					<dd>
						<div class="shop_pf" data-score="<{$data.shop_score.service}>"></div>
						<input type="hidden" id="sps_service" class="sps_val" name="shop_service_score"/>
					</dd>
				</dl>
				<dl>
					<dt>物流满意度： </dt>
					<dd>
						<div class="shop_pf" data-score="<{$data.shop_score.logistics}>"></div>
						<input type="hidden" id="sps_logistics" class="sps_val" name="shop_logistics_score"/>
					</dd>
				</dl>
			<{/if}> 
		</div>
	</div> 
	<div class="glist">
		<{foreach item=i from=$data.goods_info}>
			<div class="gbox">
				<div class="showbox">
					<div class="gimg"><a href="<{$__URI__}>index.php?m=goods&a=detail&id=<{$i.gid}>" target="_blank"><img src="<{$__IMG__}><{$i.images|img_size:120x120}>" width="120"></a></div>
					<div class="ttl"><span><{$i.title}></span></div>
				</div> 
				<div class="showsub">
					<{if $i.comment_status}><!--已经评论-->		
						<dl>	
							<dt>产品满意度：</dt>
							<dd><div class="starpl" data-score="<{$i.comment_score}>"></div></dd>
						</dl>
						<dl>	
							<dt>使用评价：</dt>
							<dd style="line-height:22px;"><{$i.comment_content}></dd>
						</dl>
						<{if $i.comment_img}>
							<dl>	
								<dt>收货晒图：</dt>
								<dd>
									<{foreach item=ci from=$i.comment_img}>
										<img src="<{$__IMG__}><{$ci.images|img_size:80x80}>" width="60" height="60"/>
									<{/foreach}>
								</dd>
							</dl>
						<{/if}>
					<{else}>
						<input type="hidden" name="goods_id[<{$i.id}>]" value="<{$i.gid}>"/>
						<dl>
							<dt>商品满意度</dt>
							<dd>
								<div class="starpl"></div>
								<div class="pfen"><input type="hidden" name="goods_score[<{$i.id}>]" class="pf_score" value=""/></div>
							</dd>
						</dl>
						<dl>
							<dt>评价晒单</dt>
							<dd><textarea class="pf_con" name="goods_content[<{$i.id}>]" cols="75" rows="4"></textarea></dd>
						</dl>
						<dl>	
							<dt>&nbsp;</dt>
							<dd>
								<div class="upload_box upload_box_<{$i.id}>"></div>
								<div class="upload_button" data-gid="<{$i.id}>"> 
									<a class="file" href="javascript:;">选择文件<input type="file" name="imgFile" class="img_file" id="imgFile<{$i.id}>"/></a>									
								</div>
							</dd>
						</dl>
						
					<{/if}>
				</div>
			</div>
		<{/foreach}>
	</div>
	<{if $data.order_row.order_status != '5'}>
		<div class="sub"><input type="submit" name="" value="提交"/></div>
	<{/if}>
</form>	
</div>	
<{include file="index/footer.html"}> 
<script type="text/javascript" src="<{$__PUBLIC__}>js/ajaxfileupload.js"></script>
<script type="text/javascript" src="<{$__PUBLIC__}>plug/raty/jquery.raty.js"></script>  
<script type="text/javascript">
$(function(){ 
	$("form").submit(function(){
		var params = $("#form").serialize();
		$.post('member.php?m=buy&a=comment_save', params, function(result){
			var data = jQuery.parseJSON(result); 
			if(data.error == '0'){
				alert('发布成功');
				location.reload();
			}else{
				alert(data.msg);
			}
		});
		return false;
	}); 
	// 店铺打分
	$('.shop_pf').raty({
		click: function(score, evt) { 
			$(this).next('.sps_val').val(score);  
		},
		starOff: '<{$__PUBLIC__}>images/star-off.png',
  		starOn : '<{$__PUBLIC__}>images/star-on.png',
		score: function() {
			return $(this).attr('data-score');
		}
	}); 
	// 给商品评分打分
	$('.starpl').raty({
		click: function(score, evt){ 
			$(this).next('.pfen').children(".pf_score").val(score); 
		},
		starOff: '<{$__PUBLIC__}>images/star-off.png',
  		starOn : '<{$__PUBLIC__}>images/star-on.png',
		score: function() {
			return $(this).attr('data-score');
		} 
	}); 
	$(document).on('click','.upload_box .img i',function(){
		$(this).parent('.img').remove();
	})
 
	$(document).on('change','.upload_button',function(){ 
		var $this=$(this);
		$("#upload_msg").ajaxStart(function(){ 
			$(this).show(); 
		});
		var gid = $this.attr('data-gid'); 
		img_num = $('.upload_box_'+gid+' .img').length;
		if(img_num < 5){
			id = "imgFile"+gid;
			$.ajaxFileUpload({ 
				url:'?m=album&a=upload&path=comment',
				secureuri:false, 
				fileElementId:id,
				dataType: 'json',	//text json
				success: function(data){ 
					if(data.error == '0'){
						html_con = '<div class="img"><img src="'+data.url+'"><i>删除</i><input type="hidden" name="goods_comment_img['+gid+'][]" value="'+data.name+'"/></div>';
						if(img_num == 0){
							$('.upload_box_'+gid).html(html_con);
						}else{
							$('.upload_box_'+gid+' .img:last').after(html_con); 
						}
					}else{
						alert(data.msg);
					}
				}
			});	
		}else{
			alert('最多能上传5张图片');
		} 
	});
});
</script>