$(function () { $(".recommend-list").click(function (event) { $(this).addClass('selected').siblings().removeClass('selected'); /* Act on the event */ }); //顶部商家支持下拉框 $(".com-top .top-content .business-support-but").click(function (event) { if ($(this).children('.arrow').hasClass('down-arrow')) { $(this).children('.arrow').removeClass('down-arrow').addClass('on-arrow'); $(this).addClass('on'); } else { $(this).children('.arrow').removeClass('on-arrow').addClass('down-arrow'); $(this).removeClass('on'); } $(".com-top .business-support ul:first-child").slideToggle("slow"); }); $(".com-top .business-support ul:first-child").mouseleave(function (event) { $(".com-top .top-content .business-support-but .arrow").removeClass('on-arrow').addClass('down-arrow'); $(".com-top .business-support ul:first-child").slideUp("slow"); $('.com-top .top-content .business-support-but').removeClass('on'); }); //顶部用户下拉框 $(".com-top .top-content .nav-user").click(function (event) { $(this).toggleClass('on'); $(".com-top .business-support ul:last-child").slideToggle("slow"); }); $("com-top .business-support ul:last-child").mouseleave(function (event) { $(".com-top .business-support ul:last-child").slideUp("slow"); }); //加减按钮 $(".com-add-num .addbutton").click(function () { var value = parseInt($('.input').val()) + 1; $('.input').val(value); }) $(".com-add-num .minusbutton").click(function () { var num = $(".input").val() if (num > 0) { $(".input").val(num - 1); } }) // rdcp.request("!Manage/Goods/~query/MALL_CART.GET_MALL_CART_COUNT",{}, function (data) { // var quantity = data.body.rows[0].quantity; // if(quantity ==""||quantity=="0"){ // $("#cartNum").html("0"); // }else { // $("#cartNum").html(quantity) // } // },{mask:false}); //$("#ID_searchAllGoods").click(function () { // var ID_inputBox=$("#ID_inputBox").val() // if($("#ID_inputBox").val()==""){ // ID_inputBox=$("#ID_inputBox").attr('placeholder'); // } // rdcp.go("!Front/Goods/~view/classification?title=" + encodeURI(encodeURI(ID_inputBox))) //}); $('#ID_inputBox').bind('keypress', function (event) { if (event.keyCode == "13") { var ID_inputBox=$("#ID_inputBox").val().trim(); if(ID_inputBox==""){ $("#ID_inputBox").val("森锐"); ID_inputBox="森锐"; } rdcp.go("!Front/Goods/~view/classification?title=" + encodeURI(encodeURI(ID_inputBox))) } }); //设置右侧返回顶部的按钮的位置 var windowH=$(window).height(); var returnTopIcon=windowH-100; $(".right-icon-box.slide-show").css('top',returnTopIcon+'px'); $(".right-icon-box.all-show").css('top',returnTopIcon-280+'px'); //鼠标哦放在右侧icon上,滑出文字提示 $(".right-icon-box ul li").mouseenter(function(){ $(this).find('em').css("background-color","#e64322"); $(this).find('i').css("background-color","#e64322"); $(this).find('em').stop().animate({ right:'32px' }); }); $(".right-icon-box ul li").mouseleave(function(){ $(this).find('em').css("background-color","#7a6e6e"); $(this).find('i').css("background-color","#7a6e6e"); $(this).find('em').stop().animate({ right:'-60px' }); }); //点击返回到顶部 $(".right-icon-box ul .return-top").click(function(){ $("html,body").animate({scrollTop:"0px"}); }); $(window).scroll(function(){ var topL=$(document).scrollTop(); if(topL>100){ $(".slide-show ul .return-top").fadeIn(); }else{ $(".slide-show ul .return-top").fadeOut(); } }); }); // 退出登录 function logout2() { rdcp.request("!sys/security/~java/Logout", {}, function (data) { if (data.header.code == 0) { rdcp.go("!Front/User/~view/login"); } else { //todo 异常处理 //return false; } }, {mask: false}) } // $(".backIndex").click(function(){ // rdcp.go("!Front/Index/~view/index"); // }); $(".search_logo_lk.backIndex").click(function(){ rdcp.go("!Front/Index/~view/index"); }); $("#to-login").click(function(){ rdcp.go("!Front/User/~view/login"); }); //Alert window.confirmBySr = function (title, body, btnOk) { var comfireTitle = '
' + title + '
'; var comfireHtml = '
' + body + '
'; var okBtn = '
确定 取消
' var html = '
' + comfireTitle + comfireHtml + okBtn + '
'; $("body").append(html); var isClose = false; function close() { if (!isClose) { $(".com-float").remove(); isClose = !isClose; } } $('.btn .btn-cancel,.maskTipClose').click(close); $('.btn .btn-ok').click(function () { if (btnOk && btnOk instanceof Function) { var isAjax = btnOk(btnOk, close); if (!isAjax) { close(); } } else { close(); } }); }; window.alertMsg = function (title, body,type) { type = type|| ''; var comfireTitle = '
' + title + '
'; var comfireTitleType = '
' + title + '
'; var comfireHtml = '
' + body + '
'; var okBtn = '
确定
'; var html = '
' + (type==''?comfireTitle:comfireTitleType) + comfireHtml + (type==''?okBtn:'') + '
'; $("body").append(html); }; function alertClose(){ $(".com-float").remove() } //提示 var icons = { error: '', tip: '', right: '', alError: '' }; function showTip(id,msg){ $("#"+id).siblings(".tip-text").show().html(icons.tip+msg).css("color","#1dc3f5"); } function showError(id,msg){ $("#"+id).siblings(".tip-text").show().html(icons.error+msg).css("color","#e64322"); } function alError(id,msg){ $("#"+id).siblings(".tip-text").show().html(icons.alError+msg).css("color","#e64322"); } function rightTip(id){ $("#"+id).siblings(".tip-text").html(icons.right); } function hideIt(id) { $("#"+id).siblings(".tip-text").hide() } //成功提示 window.successMsg = function (msg) { $("body").append('
'+msg+'
'); setTimeout(function(){ $("#ID_successTips").remove(); $("#oneP").remove(); },1000) }; window.falseMsg = function (msg) { $("body").append('
'+msg+'
'); setTimeout(function(){ $("#ID_falseTips").remove(); $("#oneP").remove(); },1000) }; // 商城首页:鼠标移到“全部商品”时,才展示一级菜单(黑色背景) // $(".classify").hover(function(){ // $(".menu").show(); // },function(){ // $(".menu").hide(); // } // ); $(".menu-item").mouseover(function() { menuItemHoverIndex = $(".menu li").index(this); //存储最后一次hover的菜单index $(this).addClass('selected').siblings().removeClass('selected'); $(this).children(".menu-lk").addClass('linkColor').parent().siblings().children(".menu-lk").removeClass('linkColor'); // $(".cate_pop").show(); var idx = $(this).attr("data-idx"); $("#cate_pop_" + idx).show(); // $(".menu").show();// 鼠标移到“一级菜单”时,保持展示一级菜单(黑色背景) // // 首页左侧菜单hover时切换成hover图标 // $(this).find('.tit-li .tit-icon.icon').css("display","none"); // $(this).find('.tit-li .tit-icon.hoverIcon').css("display","inline-block"); /* Act on the event */ }); $(".menu-item").mouseout(function() { $(".cate_pop").hide(); // $(".menu").hide();// 鼠标移出“一级菜单”时,隐藏一级菜单(黑色背景) // // 首页左侧菜单不是hover时切换成原来图标 // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.icon').css("display","inline-block"); // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.hoverIcon').css("display","none"); /* Act on the event */ }); $(".cate_pop").hover(function(){ $(this).show(); $('.menu li').eq(menuItemHoverIndex).addClass('bgWhite'); // $(".menu").show();// 鼠标移到“二级菜单”时,保持展示一级菜单(黑色背景) // // 首页左侧菜单的下级菜单hover时,切换成hover图标 // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.icon').css("display","none"); // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.hoverIcon').css("display","inline-block"); },function(){ $(".menu-item").removeClass('selected'); $(".menu-item").children(".menu-lk").removeClass('linkColor'); $(this).hide() $('.menu li').eq(menuItemHoverIndex).removeClass('bgWhite'); // $(".menu").hide();// 鼠标移出“二级菜单”时,隐藏一级菜单(黑色背景) // // 首页左侧菜单的下级菜单不是hover时切换成原来图标 // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.icon').css("display","inline-block"); // $('.menu li').eq(menuItemHoverIndex).find('.tit-li .tit-icon.hoverIcon').css("display","none"); } ); //列表跳转 $(function(){ var test = $(".menu").find('a[class*=menu-lk]'); var shishi = test.eq(0).html(); if(shishi!=undefined){ if( shishi.indexOf("森锐品牌")!= -1){ $("#ID_srBuy").attr("href",test.eq(0).attr("href")); }else { $("#ID_srBuy").attr("href","!Front/Goods/~view/classification") } } }); var saleText = '> 售后记录'; var saleUrl = '!Front/Personal/~view/afterSaleRecord'; var status_after_sales = getUrlParam('status_after_sales'); if(status_after_sales !== undefined){ var textArr = ['> 待审核','> 待退货','> 待验货','> 退款中']; saleText = textArr[status_after_sales]; saleUrl += '?status_after_sales='+status_after_sales; } //动态修改名称 if($('.goSaleRem')){ $('.goSaleRem').text(saleText); } //面包屑 var goWhere = [ { name:'.goServerSale', goUrl:'!Front/Personal/~view/afterSale', title:'售后服务' }, { name:'.goSaleRem', goUrl:saleUrl, title:saleText } ]; for(var i=0;i< goWhere.length;i++){ (function(i){ var goUrl = goWhere[i]['goUrl']; var name = goWhere[i]['name']; $(name).on('click',function () { rdcp.go(goUrl); }) })(i); } //修改售后记录地址 $('.operation-wrap li a').on('click',function () { console.log($(this).index()) }); //获取url参数 function getUrlParam(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r!=null) return unescape(r[2]); return null; //返回参数值 }