
<!doctype HTML>
<html>
<head>
    <title>选品牌</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="author" content="yangzhifang_gz maiyaotang_gz" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/><!-- 手机视图 -->
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="format-detection" content="address=no" >
    <meta name="apple-mobile-web-app-capable" content="yes" />
   <link href="http://js.3conline.com/pcauto/2015/chedaiwap/css/discount.css" rel="stylesheet" type="text/css" />
    
</head>
<script>if(!window._addIvyID) document.write("<scr"+"ipt src='http://www.pconline.com.cn/_hux_/auto/default/index.js'><\/scr"+"ipt>");</script>
<body>
 <script>document.body.insertBefore(document.createElement("script"),document.body.firstChild).src="http://count.pcauto.com.cn/count.php?channel={{{@root.pageCountId}}}&screen="+screen.width+"*"+screen.height+"&refer="+encodeURIComponent(document.referrer)+"&anticache="+new Date().getTime()+"&url="+encodeURIComponent(location.href);</script>
<div class="g-doc" id="img_load">

<!--头部-->
    <script src="http://www.pcauto.com.cn/global/wap/header_js/" charset="utf-8" class=" defer"></script>
    <!--/头部-->
    <div class="header-bg">
        <a onclick="history.back(-1);" class="header-back" title=""></a>
        <div class="header-title">
            <span class="header-title-nav">
             <a href="http://{{{@root.host}}}/">首页</a>>{{#equal param.src 1}}购车小秘{{else}}{{#equal param.type 'discount'}}贴息促销{{else}}选车贷款{{/equal}}{{/equal}}</span>
        </div>
    </div>
    <ul class="boxListA">
        <li class="cur"><a href="javascript:void(0)"onclick="letterClick('HOT')">热门</a></li>
        {{#each lettersMap}}
        <li {{#equal 0 this}}class="disabled"{{/equal}}>
        <a   href="javascript:void(0)"
             {{#equal 1 this}}onclick="letterClick('{{@key}}')"{{/equal}}>{{@key}}</a></li>
        {{/each}}
    </ul>
    <div class="m-sectionA"> <span class="m-mark">热门</span> </div>
    <div class="selectB"  id="Jselect">
        {{#each list}}
        {{#getBrands brands index}}
        {{#each this}}
        <div class="con con{{../../index}}_{{@index}}">
            <div class="item-wrap" >
                {{#each brands}}
                <div  class="item item{{../pLetter}}"
                      {{#equal 'HOT' ../pLetter}}{{else}}style="display:none;"{{/equal}}
                      onclick="brandsClick('{{id}}','.con{{../pLetter}}_','{{../rowNum}}','{{@index}}','{{../brandslth}}','{{show}}')" >
                <span class="tit {{#equal show 0}}none {{/equal}}">
                    <img src="http://www1.pcauto.com.cn/images/blank.gif" #src="{{logo}}" alt="{{name}}"/>
                    <em>{{name}}</em>
                </span>
            </div>
            {{/each}}
           </div>
         </div>
        {{/each}}
        {{/getBrands}}
        {{/each}}
    </div>
    <!--尾部-->
    <script src="http://www.pcauto.com.cn/global/wap/footer_js/" charset="utf-8" class=" defer"></script>
    <!--/尾部-->
</div>
<script src="http://js.3conline.com/min2/temp/v2/plugin-lazy.js" charset="utf-8"></script>
<script src="http://js.3conline.com/wap/2013/common/js/zepto.min.js"></script>
<script type="text/javascript">
    var param={{{json param}}};
    var type=param.type=="discount"?1:0;
    var src=param.src;
    var rid=param.rid;
    var Cookie = {
        get: function(check_name) {
            check_name = encodeURIComponent(check_name);
            var a_all_cookies = document.cookie.split(';');
            var a_temp_cookie = '';
            var cookie_name = '';
            var cookie_value = '';
            var b_cookie_found = false;
            var i = '';
            var len = a_all_cookies.length;
            for (i = 0; i < len; i++) {
                a_temp_cookie = a_all_cookies[i].split('=');
                cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
                if (cookie_name == check_name) {
                    b_cookie_found = true;
                    if (a_temp_cookie.length > 1) {
                        cookie_value = unescape(decodeURI(a_temp_cookie[1]).replace(/^\s+|\s+$/g, ''));//对url进行解码再进行处理
                    }
                    return cookie_value;
                    break;
                }
                a_temp_cookie = null;
                cookie_name = '';
            }
            if (!b_cookie_found) {
                return null;
            }
        },
        set: function(name, value, expires, path, domain, secure) {
            var today = new Date();
            today.setTime(today.getTime());
            if (expires) {
                expires = expires * 1000 * 60 * 60 * 24;
            }
            var expires_date = new Date(today.getTime() + (expires));
            document.cookie = encodeURIComponent(name) + "=" + value +
                    ((expires) ? ";expires=" + expires_date.toGMTString() : "") +
                    ((path) ? ";path=" + path : "") +
                    ((domain) ? ";domain=" + domain : "") +
                    ((secure) ? ";secure" : "");
        },
        remove: function(name) {
            Cookie.set(name,null, -1, "/", "{{{@root.cookieHost}}}");
        }
    };


    if(src==1&&!Cookie.get("selectHelperBrand")){
          location.href="http://{{{@root.host}}}/";
     }
    //index eg:A字符
   function letterClick(index){
       $(".boxListA li").each(function(){
            $(this).removeClass("cur");
           if(index=="HOT"&&$(this).children("a").html()=="热门"){
               $(this).addClass("cur");
           }else if(index!="HOT"&&$(this).children("a").html()==index){
               $(this).addClass("cur");
           }
       });
       if(index=="HOT"){
           $(".m-mark").html("热门");
       }else{
           $(".m-mark").html(index);
       }
       $(".pop").hide();//其他的隐藏
       $(".item").hide();
       $(".item"+index).show();
   }

    //是否是微信端输入
    function  getWx(){
        var str="";
        if(param.browser=="wx"){
           str="wx/";
        }
        return str;
    }

    //brandId品牌Id，通过品牌Id去取车系数据
    function brandsClick(brandId,key,rowNum,indexsub,brandslth,show){//key==HOT 表哪个字母下品牌  indexsub第几个元素

        if(show=="1") {
            key = key + rowNum;
            indexsub = Number(indexsub) + 1;
            if ($(key).find(".pop-" + indexsub).css("display")=="block") {
                $(key).find(".pop-" + indexsub).hide();
            }else{
                var url = "http://{{{@root.host}}}/serials/r"+rid+"/b"+ brandId + "/t"+type+"/";
                if ($(key).children(".pop-wrap").length == 0) {
                    $(key).html($(key).html() + '<div class="pop-wrap"></div>');
                }
                if ($(key).find(".pop").length == 0) {
                    var temp = "";
                    var j = brandslth / 4;
                    var forJ = (j + 1) > rowNum ? 4 : brandslth % 4;
                    for (var i = 0; i < forJ; i++) {
                        if (indexsub == (i + 1)) {
                            temp += '<div class="pop pop-' + (i + 1) + '" style="display:block;"></div>';
                        } else {
                            temp += '<div class="pop pop-' + (i + 1) + '"></div>';
                        }
                    }
                    $(key).children(".pop-wrap").html($(key).children(".pop-wrap").html() + temp);

                } else {
                    $(key).children(".pop-" + indexsub).siblings().hide();
                    $(key).children(".pop-" + indexsub).show();
                }

                $.ajax({
                    url: url,
                    success: function (data) {//车系数据
                        data = data.list;
                        var tempStr = '';
                        data.forEach(function (e, index) {
                            tempStr += ' <div class="part-' + (index + 1) + '">' +
                                    '<div class="th">--' + e.manufacturer + '--</div>' +
                                    '<ul>';
                            e.serials.forEach(function (es) {
                                if (es.show == 1) {
                                    if(Number(src)==1) {//跳转到车型页
                                     //   location.href = "http://m.jr.pcauto.com.cn/helper/r" + param.rid + "/sg" + param.serialId + "/"
                                      //  tempStr += '<li><a href="http://{{{@root.host}}}/helper/r' + param.rid + '/sg'+ es.id +'/'+ getWx()+'" class="txt-hide" >' + es.name + '</a></li>';
                                        tempStr += '<li><a href="javascript:void(0)" class="txt-hide" onclick="serialClick(' + es.id + ')">' + es.name + '</a></li>';
                                    }else if(param.type=="discount"){//贴息信息：跳转到金融产品列表页
                                      //url： http://m.jr.pcauto.com.cn/choose/r1/sg10512/
                                        tempStr += '<li><a href="http://{{{@root.host}}}/discount/r' + param.rid + '/sg'+ es.id +'/'+ getWx()+ 'f{{{@root.flow}}}/' + '" class="txt-hide" >' + es.name + '</a></li>';
                                   }else{
                                        tempStr += '<li><a href="http://{{{@root.host}}}/choose/r' + param.rid + '/sg'+ es.id +'/'+ getWx()+ 'f{{{@root.flow}}}/' + '" class="txt-hide" >' + es.name + '</a></li>';
                                   }

                                   // tempStr += '<li><a href="javascript:void(0)" class="txt-hide" onclick="serialClick(' + es.id + ')">' + es.name + '</a></li>';
                                } else {
                                    tempStr += '<li><a href="javascript:void(0)" class="txt-hide txt-none">' + es.name + '</a></li>';
                                }

                            });
                            tempStr += "</ul></div>";
                        });
                        $(key).siblings().find(".pop").hide();//其他的隐藏
                        $(key).find('.pop-' + indexsub).siblings().hide();
                        $(key).find('.pop-' + indexsub).html(tempStr);
                        $(key).find('.pop-' + indexsub).show();
                    }
                });

            }
        }

    }
   //车系跳转，此时有2种情况，1，直接进入金融产品列表页 2。进入车型页，作中间跳转
    function serialClick(serialId){
        if(Number(src)==1){//跳转到车型页
            Cookie.set('selectSerial', serialId, 1, "/", "{{{@root.cookieHost}}}");
           location.href="http://{{{@root.host}}}/helper/r"+param.rid+"/sg"+serialId+'/'+ getWx() + 'f{{{@root.flow}}}/';
        }
    }

    var xx = Lazy.create({
        lazyId: "img_load",
        trueSrc: '#src',
        offset: 300,
        delay: 100,
        delay_tot: 5000
    });
    Lazy.init(xx);

</script>
<script>_submitIvyID();</script>
</body>
</html>