<!--{assign var="menu_id" value="cp"}-->
<!--{include file="<!--{$oetplpath}-->block_header.tpl"}-->
<div class="oe_ntop">
  <i class="iconfont" onclick="goBack();">&#xe616;</i>
  <p>店铺点评</p>
</div>
<div class="oe_shopcomment" id="json_data"> 
  <!--{if empty($comment)}-->
  <h6>没有找到符合条件的信息</h6>
  <!--{else}--> 
  <!--{foreach $comment as $volist}-->
  <dl>
    <dt>
	  <span class="headimg"><img src="<!--{$volist.logourl}-->" /></span>
      <h3><!--{$volist.shopname}--></h3>
      <p class="ico_xin">
	    <em>您打了</em>
	    <label><!--{$volist.cmscore}-->分</label>
      </p>
      <p class="p_2">
	    <i class="iconfont">&#xe611;</i>
		<span f="but_addtocomm" data-id="<!--{$volist.commid}-->">追加评论</span> 
        <!--{if $volist.flag == '1'}--> 
        <font color="green">通过</font> 
        <!--{else}--> 
        <font color="gray">待审核</font> 
        <!--{/if}--> 
      </p>
      <div class="clear"></div>
    </dt>

    <dd>
      <p class="p_1">
	    <span><!--{$volist.cmtime|date_format:"%Y-%m-%d %H:%M:%S"}--></span>
		<!--{$volist.content}--> 
      </p>
      <!--{assign var="replylist" value=vo_list("mod={dianpingreply} where={v.commid='<!--{$volist.commid}-->' AND v.userid='<!--{$login.user.userid}-->'}")}--> 
      <!--{if !empty($replylist)}--> 
      <!--{foreach $replylist as $val}-->
      <p class="p_2" id="reply_<!--{$val.replyid}-->">
	    <span><!--{$val.replytime|date_format:"%Y-%m-%d %H:%M:%S"}--></span> 
        <b style="font-weight:normal;"><!--{$val.content|nl2br}--></b>
        <label>
          <em class="em_1" f="but_editreply" data-id="<!--{$val.replyid}-->"><i class="iconfont">&#xe62c;</i>编辑</em>
          <em class="em_2" f="but_del_one" data-type="shopcomment" data-a="delto" data-id="<!--{$val.replyid}-->" data-mod="reply" style="cursor:pointer;"><i class="iconfont">&#xe62b;</i>删除</em>
        </label>
      </p>
      <!--{/foreach}--> 
      <!--{/if}--> 
    </dd>
  </dl>
  <div class="ge"></div>
  <!--{/foreach}--> 
  <!--{/if}--> 
</div>

<input type="hidden" name="page" id="page" value="2" />
<!--{if $pagecount > 1}-->
<div class="oe_page" f="but_loadmore_page" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=list&datatype=json" data-box="json_data">点击加载下一页</div>
<!--{/if}-->

<div class="bottom_box" id="var_addto_comment" style="display:none;">
  <div class="bottom_clickbox" style="cursor:pointer;"></div>
  <input type="hidden" name="commid" id="commid" value="" />
  <div class="bottom_boxcn">
    <dl class="textarea">
      <dt>追评内容(500个字以内)</dt>
      <dd>
        <textarea style="width:90%;height:100px;" id="cmcontent" name="cmcontent"></textarea>
      </dd>
    </dl>
    <div class="bottom_btn">
      <p id="tips_comment"></p>
      <span class="span_1" f="but_comment" style="cursor:pointer;">确定追评</span>
	</div>
  </div>
</div>

<div class="bottom_box" id="var_edit_comment" style="display:none;">
  <div class="bottom_clickbox edit_clickbox" style="cursor:pointer;"></div>
  <input type="hidden" name="replyid" id="replyid" value="" />
  <div class="bottom_boxcn">
    <dl class="textarea">
      <dt>编辑追评（500个字以内）</dt>
      <dd>
        <textarea style="width:90%;height:100px;" id="replycontent" name="replycontent"></textarea>
      </dd>
    </dl>
    <div class="bottom_btn">
      <p id="tips_edit"></p>
      <span class="span_1" f="but_edit" style="cursor:pointer;">确定编辑</span>
	</div>
  </div>
</div>


<script type="text/javascript">
$(function(){
	
	//弹出追评框
	$(document).on("click", "[f='but_addtocomm']", function(){
		$_commid = $(this).attr("data-id");
		$("#commid").val($_commid);
		$("#var_addto_comment").slideDown("fast");
	});

	//取消追评
	$(document).on("click", ".bottom_clickbox", function(){
		$("#commid").val("");
		$("#cmcontent").val("");
		$("#var_addto_comment").slideUp("fast");
	});
	
	//提交追评
	$(document).on("click", "[f='but_comment']", function(){
		$tips_obj = $("#tips_comment");
		$tips_obj.html("");
		$_commid = $("#commid").val();
		$_content = $("#cmcontent").val();
		if ($_commid.length == 0) {
			$tips_obj.html("<font color='red'>请选择要追评的评论</font>");
			return false;
		}
		if ($_content.length == 0) {
			$tips_obj.html("<font color='red'>请输入追评内容</font>");
			return false;
		}
		$_urlitems = "&commid="+encodeURIComponent($_commid)+"&content="+encodeURIComponent($_content);
		$_url = WAP_APPFILE + "&c=<!--{$c}-->&a=saveaddto"+$_urlitems;
		$post_json = {"url":$_url, "type":"reload", "tips_box":"tips_comment", "success_text":"追评成功", "fail_text":"追评失败"};
		_oemarryAjaxPost($post_json);
	});


	//弹出编辑框
	$(document).on("click", "[f='but_editreply']", function(){
		$_replyid = $(this).attr("data-id");
		$("#replyid").val($_replyid);
		$("#replycontent").val($("#reply_"+$_replyid+" b").text());
		$("#var_edit_comment").slideDown("fast");
	});

	//取消追评
	$(document).on("click", ".edit_clickbox", function(){
		$("#replyid").val("");
		$("#replycontent").val("");
		$("#var_edit_comment").slideUp("fast");
	});
	
	//提交修改
	$(document).on("click", "[f='but_edit']", function(){
		$tips_obj = $("#tips_edit");
		$tips_obj.html("");
		$_replyid = $("#replyid").val();
		$_content = $("#replycontent").val();
		if ($_replyid.length == 0) {
			$tips_obj.html("<font color='red'>请选择要编辑的评论</font>");
			return false;
		}
		if ($_content.length == 0) {
			$tips_obj.html("<font color='red'>请输入评论内容</font>");
			return false;
		}
		$_urlitems = "&id="+encodeURIComponent($_replyid)+"&content="+encodeURIComponent($_content);
		$_url = WAP_APPFILE + "&c=<!--{$c}-->&a=saveeditto"+$_urlitems;
		$post_json = {"url":$_url, "type":"reload", "tips_box":"tips_edit", "success_text":"编辑成功", "fail_text":"编辑失败"};
		_oemarryAjaxPost($post_json);
	});
	

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