detail.html 4.9 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_9xhwk34nlhw.css">
    <link rel="stylesheet" href="__INDEX__/css/base.css">
    <link rel="stylesheet" href="__INDEX__/css/goodinfo_detail.css">
    <link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
    <script type="text/javascript" src="__INDEX__/js/base.js" charset="utf-8"></script>
    <title>商品详情</title>
    <style>
        .swiper-container{
            height:7.5rem;
            font-size: 0.24rem;

        }
        .swiper-pagination-fraction{
            color:#fff;
            bottom:8px;
            left:3.1rem;

        }
        .swiper-pagination-current{
            color:#fff;
            font-size: 0.38rem;
        }
        .swiper-pagination-current{
            color:#fff;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="good_head">
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <volist name="data.photo" id="vo">
                <div class="swiper-slide">
                    <img src="{$vo.photo}" alt="" >
                </div>
                </volist>
            </div>
            <!--<div class="swiper-pagination"></div>-->
        </div>
    </div>
    <div class="good_info">
        <p class="good_name">
            {$data.name}
        </p>
        <p class="good_num">
            {$data.intro}
        </p>
        <div class="people">
            <p class="people_weight">
                {$data.integral}
            </p>
            <p class="people_money">
                ¥{$data.price}
            </p>
        </div>
    </div>
    <div class="line"></div>
    <div class="good_content">
        <p class="active" id="1">
            <em></em>
            图文详情
        </p>
        <p id="2">
            <em></em>
            评价
        </p>
    </div>
    <div class="goodinfodetail">

        <div class="good_detail_info">
            <p class="product">商品信息</p>
            <div class="good_info_img">
                {$data.content}
            </div>
        </div>
    </div>
    <div class="evalute"  style="display:none">
        <volist name="comment" id="vo">
        <div class="evalute_list">
            <div class="evalute_people">
                <p class="people_img">
                    <img src="{$vo.avatar}" alt="">
                </p>
                <div class="people_info">
                    <p class="people_name">{$vo.user_nickname}</p>
                    <p class="people_date">{$vo.create_time|date='Y-m-d',###}</p>
                </div>
            </div>
            <div class="evalute_text">
                {$vo.content}
            </div>
        </div>
        </volist>
    </div>
    <div class="foot">
        <div class="cartnum">
            <p class="goodcart">
                <a href="{:url('cart/ZjCart/cart')}"><img src="__INDEX__/img/goodcart.png" alt=""></a>
            <p class="num">{$total}</p>
            </p>
        </div>
        <p class="addcart">加入购物车</p>
        <p class="buynow">立即购买</p>
    </div>
</div>
<script src="__INDEX__/js/jquery.min.js"></script>
<script type="text/javascript" src="__INDEX__/js/swiper.min.js"></script>
<script>
    //轮播图
    var mySwiper = new Swiper('.swiper-container', {
        pagination: {
            el: '.swiper-pagination',
            type: 'fraction',
        },
        autoplay: true,//可选选项,自动滑动

    })

    $(".good_content p").click(function(){
        console.log($(this).html())
        $(this).addClass("active");
        $(this).siblings("p").removeClass("active");
        if($(this).attr("id")==1){
            $(".goodinfodetail").css("display","block");
            $(".evalute").css("display","none")

        }else if($(this).attr("id")==2){
            $(".evalute").css("display","block");
            $(".goodinfodetail").css("display","none");
        }
    })
    //立即购买
    $(".buynow").click(function(){
        $.ajax({
            url:"{:url('cart/Cart/purchase')}",
            data:{
                gid:'{$id}',
            },
            type:"POST",
            dataType:"JSON",

            success: function (data) {
                if(data.data === true) {
                    window.location.href=data.url;
                }
            }
        })
    })
    //加入购物车
    $(".addcart").click(function(){
        $.ajax({
            url:"{:url('cart/Cart/addCart')}",
            data:{
                gid:'{$id}',
                num:1
            },
            type:"POST",
            dataType:"JSON",

            success: function () {
                $(".num").html(parseInt($(".num").html())+1);
            }
        })
    })
</script>
</body>
</html>