 /**
  * 企业信息
  */
 (function() {

     //基本信息 hover
     $(".basic-info-block .inf-item").hover(function() {
         // $(this).addClass("active");
         var idx = $(this).index();
         $(".basic-info-block .infp-th .inf-item").eq(idx).addClass("active");
         $(".basic-info-block .infp-td .inf-item").eq(idx).addClass("active");
     }, function() {
         //$(this).removeClass("active");
         $(".basic-info-block .infp-th .inf-item,.basic-info-block .infp-td .inf-item").removeClass("active");
     });

     //tab切换（官方信息、品牌信息）
     $("#tab-menu-wrap .tab-nav").click(function() {
         var idx = $(this).index();
         if (Number(idx) == 0) {
             $(".fxdt-group").show();
             $(".sub-tab-group").hide();
         } else {
             $(".sub-tab-group").show();
             $(".fxdt-group").hide()
         };
         $(this).addClass("active").siblings().removeClass("active");
         $(".company-content .tab-cont-wrap").hide().eq(idx).show();
     });

     //品牌信息锚点定位
     $(".sub-tab-group .tab-item").click(function() {
         var type = $(this).attr("data-id");
         if (!type) return;
         $(this).addClass("active").siblings().removeClass("active");
         $("html,body").animate({ scrollTop: $(type).offset().top }, 500);
     });

     //官方信息tab
     $(".js-tab-group .inf-item").on("click", function() {
         var group = $(this).attr("data-group") || $(this).index();
         var node = $(".js-cont-group[data-group=" + group + "]");
         if (node.length == 0) return;
         $(".js-cont-group").hide();
         $(".js-cont-group[data-group=" + group + "]").show();
         // $(".js-cont-group").eq(group).show(0).siblings(".js-cont-group").hide(0);
     });

     //区域展开
     $(".basic-info-block .info-box .infp-th .inf-item").click(function() {
         var idx = $(this).index();
         $(".js-cont-group").hide().eq(idx).show();
     });
     // 锚点定位
     $(".basic-info-block .infp-td .inf-item .it-cont .tt").click(function() {
         var type = $(this).attr("data-id");
         var listNum = $(this).attr("data-list");
         if (!type) return;
         if (!listNum) return;
         $(".js-cont-group").hide().eq(listNum).show();
         $('html, body').animate({ scrollTop: $(type).offset().top - 175 }, 500);

        // tab 固定
        let tab = $(".js-tab-box");
        let top1 = $(type).offset().top - 130;
        let top2 = $(tab).offset().top;
        if (top1 > top2) {
            $(tab).addClass('active-tab');
        }
     })

     // tab监听滚动删除固定样式
     $(document).scroll(function() {
        var scroH = $(document).scrollTop();  //滚动高度
        let tab = $(".js-tab-box");
        if(scroH < 540){  //距离顶部大于100px时
            $(tab).removeClass('active-tab');
        }else {
            $(tab).addClass('active-tab');
        }
    });

    // 点击列表中详情 弹出层处理
    $(".js-click-detail").on("click", function() {
        let id = $(this).attr("data-id");
        if (!id) return;
        $(".js-popup-wrap").show(); 
        $(".popup-detail-content").hide();
        $(id).show();
    })

    // 点击弹出层的关闭
    $(".js-popup-close").on("click", function() {
        $(".js-popup-wrap").hide();
    })

 }());