<!--{assign var="menu_id" value="goods"}-->
<!--{include file="<!--{$oetplpath}-->block_header.tpl"}-->
<div class="oe_goods_img">
  <div class="oe_topback">
    <span  onclick="goBack();">
      <i class="iconfont">&#xe616;</i>
    </span>
  </div>
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide"><img src="<!--{$goods.thumbimg}-->"/></div>
      <!--{foreach $goods.gallerylist as $val}-->
      <div class="swiper-slide"><img src="<!--{$val.imgurl}-->"/></div>
      <!--{/foreach}--> 
    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>
  </div>
  <script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true
    });
    </script> 
</div>
<div class="oe_goods_title">
  <h1><!--{$goods.goodsname}--></h1>
  <p class="p_1"> <span>￥<!--{doubleval($goods.price)}--></span> <s>原价：￥<!--{doubleval($goods.oldprice)}--></s> </p>
  <p class="p_2"> <span>销量：<i>2</i></span>
    <label>已经预约：<i><!--{$goods.bespokes}--></i></label>
  </p>
</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_goods_content">
  <div class="hd"> <span>图文详情</span> </div>
  <div class="ge"></div>
  <div class="bd"> 
    <!--{$goods.content}--> 
  </div>
</div>
<div class="kong"></div>
<div class="goods_bar">
  <span class="span_1">
    <em class="em_1" onclick="goUrl('<!--{$oefile}-->&c=shop&a=detail&id=<!--{$shop.shopid}-->');">
	  <i class="iconfont">&#xe60e;</i> 店铺
	</em>
	<em class="em_2"  f="collectgoods" data-id="<!--{$goods.goodsid}-->">
	  <i class="iconfont">&#xe610;</i> 收藏
	</em>
    <div class="clear"></div>
  </span>
  <span class="span_2" f="buy-goods">立即购买</span>
  <div class="clear"></div>
</div>


<div class="bottom_box" style="display:none;" f="buy-cart-back">
  <div class="bottom_clickbox"></div>
  <div class="oe_goods_box" f="buy-cart">
    <div class="oe_goods_boxcn">
      <div class="oe_goods_btop">
        <dl>
        	<dt><img src="<!--{$goods.thumbimg}-->" alt="" /></dt>
        	<dd>
            <h3 f='goods_price'>￥<!--{number_format($goods.price, 2)}--></h3>
            <p class="p_1" style="    text-decoration: line-through;">￥<!--{number_format($goods.oldprice, 2)}--></p>
            <p class="p_1">&nbsp;</p>
          </dd>
        </dl>
      </div>
      <div class="oe_goods_tao">
        <h3><!--{$goods.pricename}--></h3>
          <input type="hidden" name="oe_priceid" class="oe_priceid" value="0" f="oe_priceid" />
          <!--{if !empty($goods.pricelist)}-->
              <!--{foreach $goods.pricelist as $val}-->
              <span f="oe_pricelist" gid="<!--{$val.priceid}-->" price="<!--{$val.price}-->"><!--{$val.name}--></span>
              <!--{/foreach}-->
              <script type="text/javascript">
                  $("[f='oe_pricelist']").live("click",function(){
                      $price = $(this).attr('price');
                      $gid = $(this).attr('gid');
                      $("[f='oe_priceid']").val($gid);
                      $("[f='oe_pricelist']").removeClass("current");
                      $(this).addClass("current");
                      $("[f='goods_price']").html("￥"+$price);
                  });
              </script>
          <!--{/if}-->
        <div class="clear"></div>
      </div>
      <div class="oe_goods_buynum">
        购买数量
        <p>
          <span class="span_1" f="oe_update_num" act="-">-</span>
          <input type="text" class="oe_prd_nm" name="oe_prd_nm" value="1" f="oe_prd_nm" readonly />
          <span class="span_1" f="oe_update_num" act="+">+</span>
        </p>
      </div>
    </div>
    <div class="oe_goods_boxbtn" f='oe_add_cart'>
      <span>加入购物车</span>
    </div>
  </div>
</div>

<script>
    $(document).on("click", "[f='oe_update_num']" ,function(){
        $num = parseInt($("[f='oe_prd_nm']").val());
        if($(this).attr("act")=='+'){
            $("[f='oe_prd_nm']").val($num+1);
        }else{
            if($num>1)
                $("[f='oe_prd_nm']").val($num-1);
        }
    });

    $(".oe_goods_box").css("bottom",-WIN_HEIGHT+"px");
    //弹出
    $('[f="buy-goods"]').bind("click", function(){
        $('[f="buy-cart-back"]').show();
        $('.oe_goods_box').animate({bottom: '0px'}, '50');
    });
    //取消
    $(".bottom_clickbox").bind("click", function(){
        $('.oe_goods_box').animate({bottom: -WIN_HEIGHT+'px' }, '300', function(){
            $('[f="buy-cart-back"]').hide();
        });
    });

    $(document).on("click", "[f='oe_add_cart']", function(){
        <!--{if $login.status == '0'}-->
        location.href = "<!--{$oefile}-->&c=profile&a=login}-->";
        return false;
        <!--{/if}-->
        $priceid = $("[f='oe_priceid']").val();
        $goodsid = $("[f='collectgoods']").attr("data-id");
        $goodsnum = $("[f='oe_prd_nm']").val();
        $shopid = <!--{$goods.shopid}-->;
        <!--{if !empty($goods.pricelist)}-->
        if($priceid==0){
            ToastShow("请选择好商品属性！");
            return false;
        }
        <!--{/if}-->
        $.ajax({
            type: "POST",
            url: "<!--{$oefile}-->",
            cache: false,
            data: {c:"cart", a:"add", goodsid:$goodsid, priceid:$priceid, shopid:$shopid, nums:$goodsnum},
            dataType: "json",
            success: function($data){
                $json = eval($data);
                $response = $json.response;
                $result = $json.result;
                if ($response == "1") { //成功
                    $('.oe_goods_box').animate({bottom: -WIN_HEIGHT+'px' }, '300', function(){
                        $('[f="buy-cart-back"]').hide();
                    });
                    ToastShow("添加成功");
                    $(".oe_toolcart").find("font").html("<em></em>");
                }
                else {
                    if ($result.length > 0) {
                        ToastShow($result)
                    }
                    else {
                        ToastShow("添加失败");
                    }
                }
            },
            error: function(){
                ToastShow("添加失败，请检查网络！");
            }
        });
    });

    $(document).on("click","[f='collectgoods']", function(){ //收藏商品
        $goods_id = $(this).attr("data-id");
        $.ajax({
            type: "POST",
            url: "<!--{$oefile}-->",
            cache: false,
            data: {c:"collect", a:"collectgoods", id:$goods_id, r:get_rndnum(8)},
            dataType: "json",
            success: function($data) {
                $json = eval($data);
                $response = $json.response;
                $result = $json.result;
                if ($response == "1") { //成功
                    ToastShow("收藏成功");
                }
                else {
                    if ($result.length > 0) {
                        ToastShow($result)
                    }
                    else {
                        ToastShow("收藏失败");
                    }
                }
            },
            error: function() {
                ToastShow("收藏失败，请检查网络！");
            }
        });
    });

</script>
</body></html>