<!--{include file="<!--{$mpath}-->block_header.tpl"}-->
<!--loading页开始-->
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
<header class="mui-bar mui-bar-nav report-header box-s" id="header">
    <a href="javascript:history.go(-1)"><i class="iconfont icon-fanhui fl"></i></a>
    <p>商品详情</p>
</header>
<div style="padding-bottom: 53px;">
    <div class="banner swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><a href="javascript:void(0)"><img class="swiper-lazy" data-src="<!--{$product.uploadfiles}-->" alt=""></a></div>
            <!--{if !empty($product.gallery) }-->
            <!--{foreach $product.gallery as $v}-->
            <div class="swiper-slide"><a href="javascript:void(0)"><img class="swiper-lazy" data-src="<!--{$v.imgthumb}-->"  alt=""></a></div>
            <!--{/foreach}-->
            <!--{/if}-->
        </div>
        <div class="swiper-pagination"></div>
    </div>
    <div class="inte-top clearfloat box-s">
        <div class="left clearfloat fl">
            <p class="tit"><!--{$product.productname}--></p>
            <p class="price">所需积分：<span><!--{$product.bprice}--></span></p>
        </div>
        <!--<div class="right clearfloat fr">
            <i class="iconfont icon-shoucang"></i>
            <p class="">收藏</p>
        </div>-->
    </div>
    <div class="addj clearfloat">
        <ul>
            <li class="num">商品数量</li>
            <li class="fuhao" id="decrease"><i class="iconfont icon-jian"></i></li>
            <li><input type="text" name="inputNum" id="inputNum"  value="1" style="width: 20px;height: 13px;font-size: 17px;text-align: center; margin-left: 7%;"/></li>
            <li class="fuhao" id="increase"><i class="iconfont icon-jia-copy"></i></li>
            <li class="last" id="stock" stock="<!--{$product.stock}-->">库存<!--{$product.stock}-->件</li>
        </ul>
        <script>
            $(function(){
                //点击减少
                $('#decrease').click(function(){
                    var inputNum = parseInt($('#inputNum').val());
                    if(inputNum <= 1){
                        alert('请正确填写商品数');
                        return false;
                    }
                    inputNum = inputNum-1;
                    $('#inputNum').val(inputNum);
                });
                //点击增加
                $('#increase').click(function(){
                    var inputNum = parseInt($('#inputNum').val());
                    var sum = parseInt($('#stock').attr('stock'));
                    if(inputNum>=sum){
                        alert('库存仅'+sum);
                        return false;
                    }
                    inputNum = inputNum+1;
                    $('#inputNum').val(inputNum);
                });
            });
        </script>
    </div>
    <article class="detail-article">
        <nav>
            <ul class="article">
                <li id="talkbox1" class="article-active">商品详情</li>
                <li id="talkbox2">商品评价(暂无)</li>
            </ul>
        </nav>

        <section class="talkbox1">
            <!--{$product.content}-->
        </section>

        <section class="talkbox2" style="display: none;">
            <ul class="talk">

                <li>
                    还未开放
                    <!--<figure><img src="<!--{$mpath}-->upload/detail-tou.png"/></figure>
                    <dl>
                        <dt>
                            <p>瑾晨</p>
                            <time>2015.11.17</time>
                            <div class="star">
                                <span><img src="<!--{$mpath}-->img/detail-iocn01.png"/></span>
                                <span><img src="<!--{$mpath}-->img/detail-iocn01.png"/></span>
                                <span><img src="<!--{$mpath}-->img/detail-iocn01.png"/></span>
                                <span><img src="<!--{$mpath}-->img/detail-iocn001.png"/></span>
                                <span><img src="<!--{$mpath}-->img/detail-iocn001.png"/></span>
                            </div>
                        </dt>
                        <dd>哎哟不错哦，很性感哦！</dd>
                        <small>颜色：豹纹凯特</small>
                        <div class="picbox">
                            <img src="<!--{$mpath}-->upload/2.jpg"/>
                            <img src="<!--{$mpath}-->upload/2.jpg"/>
                        </div>
                    </dl>-->
                </li>


            </ul>
        </section>

    </article>
</div>

<footer class="page-footer fixed-footer" id="footer">
    <!--  <div>
      <a href="index.php" class="ljdhuanimg">
            <img src="<!--{$mpath}-->img/footer001.png" style="width: 60px;height: 60px;"/>
    <p>首页</p>
    </a></div>-->

    <a href="javascript:void(0);" class="ljdhuan fl" id="buy" skuids="<!--{$product.productid}-->" username="<!--{$username}-->">
        立即兑换
    </a>
</footer>
</body>
<script type="text/javascript" src="<!--{$mpath}-->js/jquery-1.8.3.min.js" ></script>
<script src="<!--{$mpath}-->layer_mobile/layer.js"></script>
<script src="<!--{$mpath}-->js/fastclick.js"></script>
<script src="<!--{$mpath}-->js/mui.min.js"></script>
<script type="text/javascript" src="<!--{$mpath}-->js/hmt.js" ></script>
<!--插件-->
<link rel="stylesheet" href="<!--{$mpath}-->css/swiper.min.css">
<script src="<!--{$mpath}-->js/swiper.jquery.min.js"></script>
<!--插件-->
<script src="<!--{$mpath}-->js/global.js"></script>
<script >
    $(function () {
        var banner = new Swiper('.banner',{
            autoplay: 5000,
            pagination : '.swiper-pagination',
            paginationClickable: true,
            lazyLoading : true,
            loop:true
        });

        mui('.pop-schwrap .sch-input').input();
        var deceleration = mui.os.ios?0.003:0.0009;
        mui('.pop-schwrap .scroll-wrap').scroll({
            bounce: true,
            indicators: true,
            deceleration:deceleration
        });
        $('.top-sch-box .fdj,.top-sch-box .sch-txt,.pop-schwrap .btn-back').on('click',function () {
            $('html,body').toggleClass('holding');
            $('.pop-schwrap').toggleClass('on');
            if($('.pop-schwrap').hasClass('on')) {
                $('.pop-schwrap .sch-input').focus();
            }
        });

        $('.article li').click(function(){

            $(this).addClass('article-active').siblings().removeClass('article-active');
            if($(this).attr("id")=="talkbox1"){
                $('.talkbox1').show();
                $('.talkbox2').hide();
            }else{
                $('.talkbox2').show();
                $('.talkbox1').hide();
            }

        });
        $('#buy').click(function(){
            var goodsid=$(this).attr('skuids');
            var num=$("#inputNum").val();
            var userid=$(this).attr('username');
            if(userid == ""){
                window.location = 'index.php?c=user&a=login';
                return false;
            }
            $.post("<!--{$urlpath}-->index.php?c=integral&a=shopping", {
                goodsid: goodsid,
                buynum: num,
            }, function (data) {
                if (data.response == '1') {
                    window.location.href = data.jumpurl;
                } else {
                    layer.open({
                        content: data.result
                        ,skin: 'msg'
                        ,time: 2 //2秒后自动关闭
                    });
                }
            }, "json");
        });
    });
</script>
</html>
