classify.html 11.2 KB
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学考无忧-分类</title>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
</head>

<body>
<div class="classification_box">
    <!-- 顶部 -->
    <div class="cl_top">
        <!--  分类 -->
        <!--<div class="cl_title">-->
            <!--&lt;!&ndash;<h1>分类</h1>&ndash;&gt;-->
            <!--<div class="cl_titleImg">-->

            <!--</div>-->
        <!--</div>-->
        <!-- 导航 -->
        <div class="cl_nav">
            <ul>
                <volist name="data_classify" id="vo">
                    <li onclick="classify_goods({$vo.id})" class="<eq name='$vo.id' value='$class'>cl_navActive</eq>" data-id="{$vo.id}">{$vo.name}</li>
                </volist>
            </ul>
        </div>
        <!-- 分类2 -->
        <div class="cl_list2">
            <ul>
                <volist name="data_label" id="vo">
                    <li onclick="lable_goods({$vo.id})" data-id="{$vo.id}">{$vo.name}</li>
                </volist>
            </ul>
        </div>
    </div>
    <!-- 搜索导航 -->
    <div class="se_nav">
        <ul>
            <li class="synthesize se_navactvie" onclick="classify_synthesis()">综合</li>
            <li class="sales" onclick="classify_sales()">销量
                <img src="__TMPL__/public/assets/images/s1.png" alt="">
            </li>
            <li class="price" onclick="classify_price()">价格
                <img src="__TMPL__/public/assets/images/s1.png" alt="">
            </li>
        </ul>
    </div>
    <!-- 搜索内容 -->
    <div class="in_hot_shop se_con">
        <volist name="data_goods" id="vo">
                <div class="in_hotLi">
                    <a href="{:url('Goodsdetails/Goods_details',array('goods_id'=>$vo.id))}">
                    <div class="in_hotImg">
                        <img src="{:cmf_get_image_url($vo.show_img)}" alt="">
                    </div>
                    <div class="in_hotText">
                        <div class="in_hotName txt-cut"><span>{$vo.grade}</span>{$vo.book_name}</div>
                        <div class="in_cam_shopPrice">
                            <div class="in_hotPrice1"><span>{$vo.price0}</span>.{$vo.price01}</div>
                            <div class="in_cam_shopY">¥{$vo.pricing}</div>
                        </div>
                    </div>
                    </a>
                </div>
        </volist>
    </div>
    <!-- 底部更多 -->
    <div class="in_what">—— 已经到底了哦 ——</div>
    <!-- 底部一级导航 -->
    <div class="in_bottom">
        <ul>
            <a href="{:url('Index/index')}">
                <li>
                    <img src="__TMPL__/public/assets/images/22.png" alt="">
                    <p>首页</p>
                </li>
            </a>
            <li>
                <img src="__TMPL__/public/assets/images/21.png" alt="">
                <p style="color:#FF7700;">分类</p>
            </li>
            <a href="{:url('Shopcart/shop_cart')}">
                <li>
                    <img src="__TMPL__/public/assets/images/17.png" alt="">
                    <p>购物车</p>
                </li>
            </a>
            <a href="{:url('Personalcenter/Personal_center')}">
                <li>
                    <img src="__TMPL__/public/assets/images/18.png" alt="">
                    <p>我的</p>
                </li>
            </a>
        </ul>
    </div>
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
    /**
     *分类下的商品
     */
    function classify_goods(id){
        $('.sales').removeClass('se_navactvie');
        $('.price').removeClass('se_navactvie');
        $('.synthesize').addClass('se_navactvie');
        $('.se_nav ul li').children('img').attr('src', '__TMPL__/public/assets/images/s1.png');
        $('.cl_list2 ul li').removeClass('cl_Active2');
        $.post("{:url('Classify/classify_goods')}",{classify_id:id},function(data){
            $('.in_hotLi').remove();
            data_arr = JSON.parse(data);
            for(var i=0;i<data_arr.length;i++){
                show_img = data_arr[i].show_img;
                url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
            }
        });
    }

    /**
     *分类标签下的商品
     */
    function lable_goods(id){
        classify_id = $('.cl_navActive').attr('data-id');
        $.post("{:url('Classify/classify_lable_goods')}",{label_id:id,classify_id:classify_id},function(data){
            $('.in_hotLi').remove();
            data_arr = JSON.parse(data);
            for(var i=0;i<data_arr.length;i++){
                show_img = data_arr[i].show_img;
                url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
            }
        });
    }

    /**
     *销量排序
     */
    function classify_sales(){
        classify_id = $('.cl_navActive').attr('data-id');
        lable_id = $('.cl_Active2').attr('data-id');
        $.post("{:url('Classify/classify_sales')}",{classify_id:classify_id,lable_id:lable_id},function(data){
            $('.in_hotLi').remove();
            data_arr = JSON.parse(data);
            for(var i=0;i<data_arr.length;i++){
                show_img = data_arr[i].show_img;
                url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
            }
        });
    }

    /**
     *价格排序
     */
    function classify_price(){
        classify_id = $('.cl_navActive').attr('data-id');
        lable_id = $('.cl_Active2').attr('data-id');
        $.post("{:url('Classify/classify_price')}",{classify_id:classify_id,lable_id:lable_id},function(data){
            $('.in_hotLi').remove();
            data_arr = JSON.parse(data);
            for(var i=0;i<data_arr.length;i++){
                show_img = data_arr[i].show_img;
                url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
            }
        });
    }

    /**
     *综合
     */
    function classify_synthesis(){
        classify_id = $('.cl_navActive').attr('data-id');
        lable_id = $('.cl_Active2').attr('data-id');
        if(lable_id){
            $.post("{:url('Classify/classify_lable_goods')}",{label_id:lable_id,classify_id:classify_id},function(data){
                $('.in_hotLi').remove();
                data_arr = JSON.parse(data);
                for(var i=0;i<data_arr.length;i++){
                    show_img = data_arr[i].show_img;
                    url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                    $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
                }
            });
        }else{
            $.post("{:url('Classify/classify_goods')}",{classify_id:classify_id},function(data){
                $('.in_hotLi').remove();
                data_arr = JSON.parse(data);
                for(var i=0;i<data_arr.length;i++){
                    show_img = data_arr[i].show_img;
                    url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
                    $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span>"+data_arr[i].grade+"</span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price01+"</div><div class='in_cam_shopY'>¥"+data_arr[i].pricing+"</div></div></div></a></div>");
                }
            });
        }
    }
</script>
<script>
    $('.cl_nav ul li').click(function() {
        $(this).addClass('cl_navActive').siblings().removeClass('cl_navActive');
    });

    $('.se_nav ul li').click(function() {
        $(this).addClass('se_navactvie').siblings().removeClass('se_navactvie');
        $(this).addClass('se_navactvie').siblings().children('img').attr('src', '__TMPL__/public/assets/images/s1.png')
        if ($(this).children('img').attr('src') == "__TMPL__/public/assets/images/s1.png") {
            $(this).children('img').attr('src', '__TMPL__/public/assets/images/s2.png')
        } else {
            $(this).children('img').attr('src', '__TMPL__/public/assets/images/s1.png')
        }
    });
//    分类tab
    $('.cl_list2 ul li').each(function () {
        $(this).click(function () {
            $('.sales').removeClass('se_navactvie');
            $('.price').removeClass('se_navactvie');
            $('.synthesize').addClass('se_navactvie');
            $('.se_nav ul li').children('img').attr('src', '__TMPL__/public/assets/images/s1.png');
            $('.cl_list2 ul li').removeClass('cl_Active2');
            $(this).addClass('cl_Active2').siblings().removeClass('cl_Active2');
        })
    })

</script>
</body>

</html>