<!--{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="ge"></div>


<div class="oe_words_list" id="json_data">
  <!--{if empty($words)}-->
  <h6>没有符合条件的信息</h6>
  <!--{else}-->
  <!--{foreach $words as $volist}-->
  <dl>
    <dt>
	  <span>问</span>
      <p style="font-weight:normal;"><!--{$volist.words|nl2br}--></p>
	  <p style="font-weight:normal;color:#999;text-align:right;font-size:12px"><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></p>
    </dt>
	<!--{if !empty($volist.reply)}-->
    <dd>
	  <span>答</span>
      <p class="p_1" style="color:#cda969;"><!--{$volist.reply|nl2br}--></p>
      <p class="p_2"><!--{$volist.replytime|date_format:"%Y-%m-%d %H:%M:%S"}--></p>
    </dd>
	<!--{/if}-->
  </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&shopid=<!--{$shop.shopid}-->" data-box="json_data">点击加载下一页</div>
<!--{/if}-->

<div class="kong"></div>
<div class="oe_add_words_btn" f="but_open_words"> <span>我要留言咨询</span> </div>

<div id="var_words_box" class="bottom_box" style="display:none;">
  <div class="bottom_clickbox"></div>
  <div class="bottom_boxcn">
    <dl class="input">
      <dt>联系人：</dt>
      <dd>
        <input type="text" id="words_contname" placeholder="请输入联系人" value="<!--{$login.user.realname}-->" />
      </dd>
    </dl>
	<dl class="input">
      <dt>联系电话：</dt>
      <dd>
        <input type="text" id="words_mobile" placeholder="请输入手机号" value="<!--{$login.user.mobile}-->" />
      </dd>
    </dl>
    <dl class="textarea">
      <dt>咨询内容：</dt>
      <dd>
        <textarea id="words_content" style="width:93%;height:90px;"></textarea>
      </dd>
    </dl>
    <div class="bottom_btn">
      <p id="tips_words"></p>
	  <span class="span_1" f="but_save_words">确定提交</span> 
	</div>
  </div>
</div>


<script type="text/javascript">
$(function(){
	
	$(".bottom_boxcn").css("bottom",-WIN_HEIGHT+"px");
	//弹出
	$("[f='but_open_words']").bind("click", function(){
		$("#var_words_box").show();
		$(".bottom_boxcn").animate({bottom: "0px"}, "50");
	});
	//取消
	$(".bottom_clickbox").bind("click", function(){
		$(".bottom_boxcn").animate({bottom: -WIN_HEIGHT+"px" }, "300", function(){
			$("#var_words_box").hide();
		});
	});


	$(document).on("click", "[f='but_save_words']", function(){
		$tips_obj = $("#tips_words");
		$tips_obj.html("");

		$contname = $("#words_contname").val();
		$mobile = $("#words_mobile").val();
		$words = $("#words_content").val();
		if ($contname.length == 0) {
			$tips_obj.html("<font color='red'>请填写联系人</font>");
			return false;
		}
		if ($mobile.length == 0) {
			$tips_obj.html("<font color='red'>请填写联系电话</font>");
			return false;
		}
		if ($words.length == 0) {
			$tips_obj.html("<font color='red'>请填写咨询内容</font>");
			return false;
		}

		$.ajax({
			type: "POST",
			url: "<!--{$oefile}-->&c=<!--{$c}-->",
			cache: false,
			data: {a:"post", contname:$contname, contmobile:$mobile, words:$words, shopid:"<!--{$shop.shopid}-->", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					$("#words_content").val("");
					$tips_obj.html("<font color='green'>留言成功，请等待审核</font>");
					setTimeout(function(){
						$('.bottom_boxcn').animate({bottom: -WIN_HEIGHT+'px' }, '300', function(){
							$("#var_words_box").hide();
							window.location.reload();
						});
					}, 500);
				}
				else {
					if ($result.length > 0) {
						$tips_obj.html("<font color='red'>"+$result+"</font>");
					}
					else {
						$tips_obj.html("<font color='red'>留言失败</font>");
					}
				}

			},
			error: function() {
				$tips_obj.html("<font color='red'>系统繁忙，请稍后再试</font>");
			}
		});

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