<!--{assign var="menu_id" value="shop"}-->
<!--{include file="<!--{$oetplpath}-->block_header.tpl"}-->
<div class="oe_ntop">
  <i class="iconfont" onclick="goBack();">&#xe616;</i>
  <p>商家点评</p>
</div>
<div class="oe_shop_top">
  <dl>
    <dt><img src="<!--{$shop.logourl}-->" alt="<!--{$shop.shopname}-->" /></dt>
    <dd>
      <h1><!--{$shop.shopname}--></h1>
      <p class="p_1"> <!--{if $shop.shoprz == "1"}--><span class="span_1">认</span><!--{/if}--></p>
    </dd>
    <div class="clear"></div>
  </dl>
  <div class="oe_shop_topsc"></div>
</div>


<div class="oe_dianpingtop">
  <span class="current" data-score="0">全部</span> <span data-score="5">5分</span> <span data-score="4">4分</span> <span data-score="3">3分</span> <span data-score="2">2分</span> <span data-score="1">1分</span>
  <div class="clear"></div>
</div>
<script type="text/javascript">
$(function(){

	$(".oe_dianpingtop span").bind("click", function(){
		$(".oe_dianpingtop span").removeClass("current");
		$(this).addClass("current");
		$_score = $(this).attr("data-score");
		$("#s_score").val($_score);
		_getPageList(1);
	});
	
});
</script>

<div class="oe_shopdianping_list" id="json_data">
  <!--{if empty($dianping)}-->
  <h6>没有符合条件的信息</h6>
  <!--{else}-->
  <!--{foreach $dianping as $volist}-->
  <dl>
    <dt>
      <label class="label_1"><img src="<!--{$volist.headimgurl}-->" /></label>
      <span class="span_1"><!--{$volist.username}--></span>
      <label class="xin"><span style="width:<!--{round((doubleval($volist.cmscore)/5), 2)*100}-->%;"></span></label>
      <span class="span_2"><!--{$volist.cmscore}-->分</span>
	</dt>
    <dd>
      <p class="p_1"><!--{$volist.content|nl2br}--></p>
	  <p class="p_3">
	    <span><img src="<!--{$volist.consumeimg}-->" /></span>
		<span><img src="<!--{$volist.drawimg}-->" /></span>
        <div class="clear"></div>
      </p>
	  <p class="p_4"> <!--{$volist.cmtime|date_format:"%Y-%m-%d %H:%M"}--> </p>
	  <!--{assign var="replylist" value=vo_list("mod={dianpingreply} where={v.commid='<!--{$volist.commid}-->'}")}-->
	  <!--{if !empty($replylist)}-->
	  <!--{foreach $replylist as $val}-->
      <p class="p_2">
	    <!--{if $val.userid > 0}-->
	    <span>[追评]：</span>
		<!--{/if}-->
		<!--{if $val.shopid > 0}-->
	    <span>[回复]：</span>
		<!--{/if}-->
		<!--{$val.content|nl2br}-->
	  </p>
      <p class="p_4"> <!--{$val.replytime|date_format:"%Y-%m-%d %H:%M:%S"}--> </p>
	  <!--{/foreach}-->
	  <!--{/if}-->
    </dd>
  </dl>
  <!--{/foreach}-->
  <!--{/if}-->
</div>


<!--{if $pagecount > 1}-->
<div class="oe_page" id="page_more_btn">点击加载下一页</div>
<!--{/if}-->
<input type="hidden" name="page" id="page" value="2" />
<input type="hidden" name="reqs_url" id="reqs_url" value="<!--{$oefile}-->&c=<!--{$c}-->&a=list&shopid=<!--{$shop.shopid}-->&datatype=json" />
<input type="hidden" name="s_score" id="s_score" />

<script type="text/javascript">
$(function(){
	//加载下一页
	$("#page_more_btn").bind("click", function(){
		_oeGetListData();
	});
});
function _getPageList($first) {
	if (typeof($first) == "undefined") {
		$first = "";
	}
	$s_score = $("#s_score").val();
	$_urlitems = "s_score="+$s_score;
	$_url = "<!--{$oefile}-->&c=<!--{$c}-->&a=list&shopid=<!--{$shop.shopid}-->&datatype=json&"+$_urlitems;
	$("#reqs_url").val($_url);
	_oeGetListData($_url, $first);
}
</script>

<div class="kong"></div>
<div class="oe_add_dianpng_btn"><span>我要点评</span></div>

<div class="oe_add_dianping" style="display:none;">
  <div class="oe_topser">
    <i class="iconfont" f="but_close_dianping">&#xe616;</i>
    <p>点评商家</p>
  </div>
  <div class="ge"></div>
  <ul>
    <li class="li_1 cmscore">
	  <span>总体打分：<font color="red">*</font></span>
      <p>
	    <input type="hidden" name="cmscore" id="cmscore" value="" />
        <label id="cmscore_1" data-value="1"><i class="iconfont">&#xe636;</i></label>
        <label id="cmscore_2" data-value="2"><i class="iconfont">&#xe636;</i></label>
        <label id="cmscore_3" data-value="3"><i class="iconfont">&#xe636;</i></label>
        <label id="cmscore_4" data-value="4"><i class="iconfont">&#xe636;</i></label>
        <label id="cmscore_5" data-value="5"><i class="iconfont">&#xe636;</i></label>
        <em id="tips_score"></em>
        <div class="clear"></div>
      </p>
    </li>
	<script type="text/javascript">
	$(function(){
		$(".cmscore label").bind("click", function(){
			$(".cmscore label").removeClass("current");
			$_value = $(this).attr("data-value");
			for ($i=1; $i<=$_value; $i++) {
				$("#cmscore_"+$i).addClass("current");
			}
			$("#tips_score").html($_value+"分");
			$("#cmscore").val($_value);
		});
	});
	</script>


    <li class="li_2">
      <p>发表评论：<font color="red">*</font><span>请客观评价</span></p>
      <p>
        <textarea name="content" id="content"></textarea>
      </p>
    </li>
    <li class="li_2">
      <p>消费单据：<font color=red>*</font> <span>点击上传您的预约单或合同</span></p>
      <p class="upload">
        <label class="_uploadbtn"><input type="file" name="conimg" id="conimg" value="" /></label>
        <i class="iconfont">&#xe615;</i>
	  </p>
      <p class="p_2">
	    <span><img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="conimg_preview" /></span>
        <div class="clear"></div>
      </p>
	  <input type="hidden" id="conimg_thumb" name="conimg_thumb" value="" />
	  <input type="hidden" id="conimg_url" name="consumeimg" value="" />
    </li>

    <li class="li_2">
      <p>消费图片：<font color="red">*</font> <span>点击上传您图片</span></p>
      <p class="upload">
        <label class="_uploadbtn"><input type="file" name="img" id="img" value="" /></label>
        <i class="iconfont">&#xe615;</i>
	  </p>
      <p class="p_2">
	    <span><img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="img_preview" /></span>
        <div class="clear"></div>
      </p>
	  <input type="hidden" id="img_thumb" name="thumbimg" value="" />
	  <input type="hidden" id="img_url" name="drawimg" value="" />
    </li>

    <li class="li_3">
	  <span>消费金额：<font color="red">*</font></span>
      <input type="text" name="consumefee" id="consumefee" placeholder="填写消费金额" id="" />
    </li>
  </ul>
  <div class="oe_add_dianpng_btn" f="but_dp_post"> <span>提交点评</span> </div>
</div>
<div class="oe_img_loading" id="img_loading"> <span> </span> </div>
<div class="oe_img_loading" id="conimg_loading"> <span> </span> </div>


<script type="text/javascript">
$(function(){
	$(".oe_add_dianping").css("bottom",-WIN_HEIGHT+"px");
	
	//弹出
	$(".oe_add_dianpng_btn").bind("click", function(){
		$(".oe_add_dianping").slideDown();
	});

	//取消
	$("[f='but_close_dianping']").bind("click", function(){
		$(".oe_add_dianping").slideUp();
	});

	//上传消费凭证
	$(document).on("change", "#conimg", function(){
		oemarryUploadImg("conimg", "<!--{$oefile}-->&c=index&a=upload");
	});

	//上传消费图片
	$(document).on("change", "#img", function(){
		oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=upload&thumbfiles=1");
	});

	//提交评论
	$("[f='but_dp_post']").bind("click", function(){
		$_cmscore = $("#cmscore").val();
		$_content = $("#content").val();
		$_consumeimg = $("#conimg_url").val();
		$_thumbimg = $("#img_thumb").val();
		$_drawimg = $("#img_url").val();
		$_consumefee = $("#consumefee").val();
		
		if ($_cmscore.length == 0) {
			ToastShow("请打分");
			return false;
		}
		if ($_content.length == 0) {
			ToastShow("请填写评论");
			return false;
		}
		if ($_consumeimg.length == 0) {
			ToastShow("请上传消费凭证");
			return false;
		}
		if ($_thumbimg.length == 0) {
			ToastShow("请上传消费图片");
			return false;
		}
		if ($_consumefee.length == 0) {
			ToastShow("请填写消费金额");
			return false;
		}
		
		$_urlitems = "&shopid=<!--{$shop.shopid}-->&thumbimg="+encodeURIComponent($_thumbimg)+"&drawimg="+encodeURIComponent($_drawimg)+"&consumeimg="+encodeURIComponent($_consumeimg)+"&consumefee="+encodeURIComponent($_consumefee)+"&content="+encodeURIComponent($_content)+"&cmscore="+encodeURIComponent($_cmscore)+"";
		$_url = WAP_APPFILE + "&c=<!--{$c}-->&a=post"+$_urlitems;
		$post_json = {"url":$_url, "type":"reload", "success_text":"评论成功，请等待审核", "fail_text":"评论失败"};
		_oemarryAjaxPost($post_json);

	});
});
</script>
</body>
</html>