<!--{include file="<!--{$shoptplpath}--><!--{$shop.skin}-->/block_header.tpl"}-->
<!--{include file="<!--{$shoptplpath}--><!--{$shop.skin}-->/block_top.tpl"}-->
<div class="oe_shopmain">

  <div class="oe_dianping_layer">

    <h1>店铺点评 <span>带<b>*</b>为必填</span></h1>
    <div class="oe_dianping_lt">
		
	  
	  <form id="myform" action="<!--{$oefile}-->?c=dianping" method="post" />
	  <input type="hidden" name="a" id="a" value="post" />
	  <input type="hidden" name="shopid" id="shopid" value="<!--{$shop.shopid}-->"  />
	  <div class="oe_dianping_addto">
		<dl>
		  <dt><span>*</span>总体打分：</dt>
		  <dd>
		    <input type="hidden" name="cmscore" id="cmscore" value="" />
			<em class="_star_gray" id="star_1"></em><em class="_star_gray" id="star_2"></em><em class="_star_gray" id="star_3"></em><em class="_star_gray" id="star_4"></em><em class="_star_gray" id="star_5"></em>
			&#12288;请点击星星，为店铺打分
			<p>
			点评和打分都将是其他网友的参考依据，并影响店铺的口碑。
			</p>
		  </dd>
		</dl>
		<dl>
		  <dt><span>*</span>发表评论：</dt>
		  <dd>
		    <textarea style="width:500px;height:100px;" id="content" name="content"></textarea>
			<p>请认真并客观的评价,因为这为了帮助其他新人，同时督促商家更好的为大家服务。</p>
			<p id="tips_count" class="_tips">（500个字以内）<span id="content_count">0</span>/500</p>
		  </dd>
		</dl>
		<dl>
		  <dt><span>*</span>消费单据：</dt>
		  <dd>
		    <h5>
			  <label class="_uploadbtn">点击上传<input type="file" name="conimg" id="conimg" value="" /></label>
			  <label class="_uploading" id="conimg_loading">
			    <img src="<!--{$urlpath}-->tpl/static/images/loading.gif" />
			  </label>
			  <input type="hidden" id="conimg_thumb" name="conimg_thumb" />
			  <input type="hidden" id="conimg_url" name="consumeimg" value="" />
		    </h5>
			<p>
			  上传您的预约单或合同(单据上的姓名、手机号请处理后再上传)，图片不超过<!--{$config.uploadmaxsize}-->M，支持png,jpg。
			</p>
		    <h4>
		      <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="conimg_preview" style="display:none;" />
		    </h4>
			<script type="text/javascript">
			$(function(){
			  $("#conimg").live("change", function(){
				oemarryUploadImg("conimg", "<!--{$urlpath}-->index.php?m=user&c=index&a=uploadimg&module=upload");
			  });
			});
			</script>
		  </dd>
		</dl>
		<dl>
		  <dt><span>*</span>上传图片：</dt>
		  <dd>
		    <h5>
			  <label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
			  <label class="_uploading" id="img_loading">
			    <img src="<!--{$urlpath}-->tpl/static/images/loading.gif" />
			  </label>
			  <input type="hidden" id="img_thumb" name="thumbimg" value="" />
			  <input type="hidden" id="img_url" name="drawimg" value="" />
		    </h5>
			<p>
			  图片尽量与该店铺相关，单张图片不超过<!--{$config.uploadmaxsize}-->M，支持png,jpg。
			</p>
		    <h4>
		      <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" id="img_preview" style="display:none;" />
		    </h4>
			<script type="text/javascript">
			$(function(){
			  $("#img").live("change", function(){
				oemarryUploadImg("img", "<!--{$urlpath}-->index.php?m=user&c=index&a=uploadimg&module=upload&thumbfiles=1");
			  });
			});
			</script>
		  </dd>
		</dl>
		<dl>
		  <dt><span></span>消费金额：</dt>
		  <dd>
		    <input type="text" name="consumefee" id="consumefee" style="width:100px;" /> 元
		  </dd>
		</dl>
		<!--{if $config.commentcode == '1'}-->
	    <dl>
		  <dt><span>*</span>验证码：</dt>
		  <dd>
		    <input type="text" id="dianping_checkcode" name="checkcode" style="width:80px" />
		    <img class="_checkcode" style="cursor:pointer;vertical-align:middle;" title="点击换一个" id="dianping_img_checkcode" src="<!--{$urlpath}-->source/include/imagecode.php?act=verifycode" />
		  </dd>
	    </dl>
	    <!--{/if}-->
		<dl>
		  <dt>&nbsp;</dt>
		  <dd><input type="button" class="oem_dp_button" value="提交评价" f="post"></dd>
		</dl>
	  </div>
	  <!--//oe_dianping_addto End-->
	  </form>

    </div>
	<!--//oe_dianping_lt End-->


    <div class="oe_dianping_rt">
      <h3><!--{$shop.shopname}--></h3>
	  <div class="oe_dianping_info">
		<dl class="_dp_rc_1">

		  <dt>人气：</dt>

		  <dd><!--{$shop.hits}--></dd>

		</dl>
		<dl class="_dp_rc_2">
		  <dt>口碑：</dt>
		  <dd><!--{$shop.score}--> 分</dd>
		</dl>
		<dl class="_dp_rc_3">
		  <dt>点评：</dt>
		  <dd><!--{$shop.comments}--></dd>
		</dl>
	  </div>

    </div>
    <div class="clear"></div>
	<!--//oe_dianping_rt End-->


  </div>
  <!--//oe_dianping_layer End-->

</div>
<!--{include file="<!--{$shoptplpath}--><!--{$shop.skin}-->/block_footer.tpl"}-->

<script type="text/javascript">
$(function(){
	
	//打分
	$star_obj = $(".oe_dianping_addto dd em");
	$star_obj.bind("click", function(){
		$star_index =  $star_obj.index(this);
		$star_obj.removeClass("_star_red");
		$star_obj.addClass("_star_gray");
		for (var $i=0; $i<=$star_index; $i++) {
			$("#star_"+($i+1)).removeClass("_star_gray");
			$("#star_"+($i+1)).addClass("_star_red");
		}
		$("#cmscore").val(($star_index+1));
	});

	$("#content").bind("keydown", function(){
		$len = $(this).val().length;
		$("#content_count").html($len);
	});

	$("#content").bind("keyup", function(){
		$len = $(this).val().length;
		$("#content_count").html($len);
	});


	$("input[f='post']").bind("click", function(){
		
		if ($("#cmscore").val().length == 0) {
			ToastShow("请给店铺打分");
			return false;
		}
		
		if ($("#content").val().length == 0) {
			ToastShow("请填写评价内容，500个字以内");
			return false;
		}
		else {
			if ($("#content").val().length > 500) {
				ToastShow("评价内容500个字以内");
				return false;
			}
		}

		if ($("input[name='consumeimg']").val().length == 0) {
			ToastShow("请上传消费单据");
			return false;
		}

		if ($("input[name='drawimg']").val().length == 0) {
			ToastShow("请上传图片");
			return false;
		}

		<!--{if $config.commentcode == '1'}-->
		if ($("input[name='checkcode']").val().length == 0) {
			ToastShow("请填写验证码");
			return false;
		}
		<!--{/if}-->

		$("#myform").submit();

	});

	<!--{if $config.commentcode == '1'}-->
	$("#dianping_img_checkcode").bind("click", function(){
		$(this).attr("src", _ROOT_PATH+"source/include/imagecode.php?act=verifycode&"+Math.random());
	});
	<!--{/if}-->

});
</script>