<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__ROOT__/Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
   </head>
   <script>
   function del(id){
	   Plugins.confirm({title:'信息提示',content:'您确定要删除该商品评价吗?',okText:'确定',cancelText:'取消',okFun:function(){
		   Plugins.closeWindow();
		   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
		   $.post("{:U('Admin/GoodsAppraises/del')}",{id:id},function(data,textStatus){
					var json = WST.toJson(data);
					if(json.status=='1'){
						Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
						location.reload();
						}});
					}else{
						Plugins.closeWindow();
						Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
					}
				});
	   }});
   }
   function getAreaList(objId,parentId,t,id){
	   var params = {};
	   params.parentId = parentId;
	   $('#'+objId).empty();
	   if(t<1){
		   $('#areaId3').empty();
		   $('#areaId3').html('<option value="">请选择</option>');
	   }
	   var html = [];
	   $.post("{:U('Admin/Areas/queryByList')}",params,function(data,textStatus){
		    html.push('<option value="">请选择</option>');
			var json = WST.toJson(data);
			if(json.status=='1' && json.list.length>0){
				var opts = null;
				for(var i=0;i<json.list.length;i++){
					opts = json.list[i];
					html.push('<option value="'+opts.areaId+'" '+((id==opts.areaId)?'selected':'')+'>'+opts.areaName+'</option>');
				}
			}
			$('#'+objId).html(html.join(''));
	   });
   }
   $(function(){
	   <notempty name='areaId1'>
	   getAreaList("areaId2",'{$areaId1}',0,'{$areaId2}');
	   </notempty>
   })
   </script>
   <body class='wst-page'>
     <form method='post' action="{:U('Admin/GoodsAppraises/index')}">
       <div class='wst-tbar' style='height:25px;'>
   地区：<select id='areaId1' name='areaId1' onchange='javascript:getAreaList("areaId2",this.value,0)'>
               <option value=''>请选择</option>
               <volist name="areaList" id="vo">
               <option value='{$vo['areaId']}' <if condition="$areaId1 == $vo['areaId'] ">selected</if>>{$vo['areaName']}</option>
               </volist>
             </select>
             <select id='areaId2' name='areaId2'>
               <option value=''>请选择</option>
             </select>
        所属店铺：<input type='text' name='shopName' id='shopName' value='{$shopName}'/>
        商品：<input type='text' name='goodsName' id='goodsName' value='{$goodsName}'/>
      <button type='submit' class='btn btn-primary glyphicon glyphicon-search'>查询</button>
       </div>
       </form>
       <div class="wst-body"> 
        <table class="table table-hover table-striped table-bordered wst-list">
           <thead>
             <tr>
               <th width='40'>序号</th>
               <th colspan='2'>商品</th>
               <th width='60'>状态</th>
               <th>商品评分</th>
               <th>时效评分</th>
               <th>服务评分</th>
               <th width='150'>操作</th>
             </tr>
           </thead>
           <tbody>
            <?php $c=1;?>
            <volist name="Page['root']" id="vo" key='i'>
             <tr>
               <td rowspan='2'>{$i}</td>
               <td rowspan='2' width='50' style='border-right:0px;'>
               <img src='__ROOT__/{$vo['goodsThums']}' width='50'/>
               </td>
               <td rowspan='2' width='140' style='border-left:0px;'>
               <span style='font-weight:bold;'>{$vo['goodsName']}</span><br/>订单：{$vo['orderNo']}</td>
               <td >
               <if condition="$vo['isShow'] == 1 ">
               <span class='label label-success'>显示</span>
               <else/>
               <span class='label label-warning'>隐藏</span>
               </if>
               </td>
               <td>
               <div>
               	<for start="0" end="$vo['goodsScore']">
					<img src="__ROOT__/Apps/Home/View/default/images/icon_score_yes.png"/>
				</for>&nbsp;{$vo['goodsScore']} 分
				</div>
				</td>
				<td>
				<div>
               	<for start="0" end="$vo['timeScore']">
					<img src="__ROOT__/Apps/Home/View/default/images/icon_score_yes.png"/>
				</for>&nbsp;{$vo['timeScore']} 分
				</div>
                </td>
                <td>
              	<div>
               	<for start="0" end="$vo['serviceScore']">
					<img src="__ROOT__/Apps/Home/View/default/images/icon_score_yes.png"/>
				</for>&nbsp;{$vo['serviceScore']} 分
				</div>
               </td>
               <td rowspan='2'>
               <php>if(in_array('sppl_04',$WST_STAFF['grant'])){</php>
               <a class="btn btn-default glyphicon glyphicon-pencil" href="{:U('Admin/GoodsAppraises/toEdit',array('id'=>$vo['id']))}"">修改</a>&nbsp;
               <php>}</php>
               <php>if(in_array('sppl_03',$WST_STAFF['grant'])){</php>
               <button type="button" class="btn btn-default glyphicon glyphicon-trash" onclick="javascript:del({$vo['id']})"">刪除</button>
               <php>}</php>
               </td>
             </tr>

             <tr>
               <td colspan='4' style='word-break:break-all;'>评价[{$vo['loginName']}]：{$vo['content']}

                <div id="layer-photos-appraise{$c}"  style="margin-bottom:10px"> 
                <?php foreach($vo['appraisesAnnex'] as $q=>$v):?>
                <img  layer-src="__ROOT__/<?php echo $v;?>" width="50" src="__ROOT__/<?php echo str_replace('.','_thumb.',$v);?>" alt="{$vo['content']}">
                <?php endforeach;?>
                </div>


               </td>
             </tr>

             <?php ++$c;?>
             </volist>
             <tr>
                <td colspan='8' align='center'>{$Page['pager']}</td>
             </tr>
           </tbody>
        </table>
       </div>
   </body>
</html>
<script>
  <?php for($i=1;$i<$c;++$i) {?>
      layer.photos({
          photos: '#layer-photos-appraise'+<?php echo $i;?>
        });
  <?php }?>
</script>