<!--{assign var="menu_id" value="activity"}-->
<!--{include file="<!--{$oetplpath}-->block_header.tpl"}-->
<div class="oe_ntop">
  <i class="iconfont" onclick="goBack();">&#xe616;</i>
  <p>活动详情</p>
</div>
<div class="oe_activity_detail" style="margin-top:10px;">
  <dl>
    <dt><img src="<!--{$activity.drawimg}-->" /></dt>
    <dd>
      <h1><!--{$activity.title}--></h1>
      <ul>
        <li>
		  <span>价&#12288;&#12288;格：</span>
          <label>￥<i><!--{$activity.price}--></i></label>&#12288;
		  <s>原价：￥<i><!--{$activity.oldprice}--></i></s>
		</li>
        <li><span>活动时间：</span> <i><!--{$activity.acttime}--> &#12288;</i></li>
        <li><span>已经预约：</span> <i><!--{$activity.bespokes}--></i> 人</li>
        <li class="li_3"><span>活动地址：</span> <i><!--{$activity.actaddress}--> &#12288;</i></li>
      </ul>
    </dd>
  </dl>
</div>
<div class="ge"></div>
<div class="oe_shopdes">
  <dl onclick="goUrl('<!--{$oefile}-->&c=shop&a=detail&id=<!--{$shop.shopid}-->');">
    <dt><img src="<!--{$shop.logourl}-->" /></dt>
    <dd>
      <h3><!--{$shop.shopname}--></h3>
      <p class="p_1">
	    <span>商家地址：</span><!--{area type='text' value=$shop.area1}--> <!--{area type='text' value=$shop.area2}--> <!--{$shop.address}-->
	  </p>
      <i class="iconfont">&#xe615;</i> </dd>
    <div class="clear"></div>
  </dl>
  <ul>
    <li> <!--{$shop.score}--> 分 <span>综合评分</span> </li>
    <li class="border"> <!--{$shop.hits}--> <span>店铺人气</span> </li>
    <li> <!--{$shop.comments}-->条 <span>商家点评</span> </li>
  </ul>
  <div class="clear"></div>
</div>

<div class="ge"></div>
<div class="oe_activity_content">
  <div class="hd"><span>活动详情</span></div>
  <div class="ge"></div>
  <div class="bd"> 
    <!--{$activity.content}--> 
  </div>
</div>
<div class="kong"></div>

<div class="activity_bar">
  <span class="span_1" onclick="goUrl('<!--{$oefile}-->&c=words&a=list&shopid=<!--{$activity.shopid}-->');"><i class="iconfont">&#xe611;</i> 店铺留言</span> 
  <!--{if $activity.canbespoke == "1"}--> 
  <!--{if $activity.endbespoke > $time}--> 
  <span class="span_2" f="but_open_bespoke">立即免费预约</span> 
  <!--{else}--> 
  <span class="span_3">截止预约日期结束了</span> 
  <!--{/if}--> 
  <!--{/if}-->
  <div class="clear"></div>
</div>


<div id="var_bespoke_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="activity_contname" placeholder="请输入联系人" value="<!--{$login.user.realname}-->" />
      </dd>
    </dl>
	<dl class="input">
      <dt>手机号</dt>
      <dd>
        <input type="text" id="activity_mobile" placeholder="请输入手机号" value="<!--{$login.user.mobile}-->" />
      </dd>
    </dl>
    <dl class="textarea">
      <dt>预约留言（填写其他预约说明）</dt>
      <dd>
        <textarea id="activity_words" style="width:93%;height:90px;"></textarea>
      </dd>
    </dl>
    <div class="bottom_btn">
      <p id="tips_bespoke"></p>
      <span class="span_1" f="but_save_bespoke">确定预约</span> </div>
  </div>
</div>

<script type="text/javascript">
$(function(){

	$(".bottom_boxcn").css("bottom",-WIN_HEIGHT+"px");
	//弹出
	$("[f='but_open_bespoke']").bind("click", function(){
		$("#var_bespoke_box").show();
		$('.bottom_boxcn').animate({bottom: '0px'}, '50');
	});
	//取消
	$(".bottom_clickbox").bind("click", function(){
		$('.bottom_boxcn').animate({bottom: -WIN_HEIGHT+'px' }, '300', function(){
			$("#var_bespoke_box").hide();
		});
	});
	
	$(document).on("click", "[f='but_save_bespoke']", function(){
		$tips_obj = $("#tips_bespoke");
		$tips_obj.html("");

		$contname = $("#activity_contname").val();
		$mobile = $("#activity_mobile").val();
		$words = $("#activity_words").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;
		}
		else {
			if (!isMobile($mobile)) {
				$tips_obj.html("<font color='red'>手机号码格式不正确</font>");
				return false;
			}
		}

		$.ajax({
			type: "POST",
			url: "<!--{$oefile}-->&c=<!--{$c}-->",
			cache: false,
			data: {a:"savebespoke", contname:$contname, mobile:$mobile, words:$words, actid:"<!--{$activity.actid}-->", shopid:"<!--{$shop.shopid}-->", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					$("#activity_words").val("");
					$tips_obj.html("<font color='green'>预约成功，请等待商家回复。</font>");
					setTimeout(function(){
						$('.bottom_boxcn').animate({bottom: -WIN_HEIGHT+'px' }, '300', function(){
							$("#var_bespoke_box").hide();
						});
					}, 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>