if($('.dqprice')){$('.dqprice').html(($(obj).attr('price')));} } function timer(opj){ $(opj).find('ul').animate({ marginTop : "-70px" },500,function(){ $(this).css({marginTop : "0px"}).find("li:first").appendTo(this); }) } layui.use('layer', function(){ var $ = layui.jquery, layer = layui.layer; var mit=setInterval('timer(".wffahuo")',3000);//停顿滚动 $('.cart_sum').html("0"); $(".addcart").on('click',function(){ if($('.pro_taocan').length>0&&$("#i").val()==-1){ layer.msg('请选择规格!'); return false; } singleaddcart(); }); function singleaddcart(){ var index = layer.load(1, { shade: [0.1,'#fff'] //0.1透明度的白色背景 }); $.ajax({ type:'post', //传送的方式,get/post url:'https://zbqfjx.com/index.php?s=Home/Singleshopcart/addItem.html', //发送数据的地址 data:$("#buyform").serializeArray(), dataType: "json", success:function(json) { if (json.status==1) { layer.close(index); layer.msg("已加入购物车!") $("#cancel").click(); $('.cart_sum').html(json.sum); }else{ layer.close(index); layer.msg(json.info) } return false; }, error:function (XMLHttpRequest, ajaxOptions, thrownError) { layer.close(index); layer.alert(XMLHttpRequest+thrownError); } }); } $(".five").on('click',".buy_now",function(){ if($('.pro_taocan').length>0&&$("#i").val()==-1){ layer.msg("请选择规格!"); return false; } singlebuynow(); }); function singlebuynow(){ var index = layer.load(1, { shade: [0.1,'#fff'] //0.1透明度的白色背景 }); $.ajax({ type:'post', //传送的方式,get/post url:'https://zbqfjx.com/index.php?s=Home/Singleshopcart/addItem/now/1.html', //发送数据的地址 data:$("#buyform").serializeArray(), dataType: "json", success:function(json) { if (json.status==1) { window.location.href =json.url; }else{ layer.close(index); layer.msg(json.info); } return false; }, error:function (XMLHttpRequest, ajaxOptions, thrownError) { layer.close(index); layer.alert(XMLHttpRequest+thrownError); } }); } $('.pinlunshow').click(function(){ if($(this).attr('attr_show')==0){ var index = layer.load(1, { shade: [0.1,'#fff'] //0.1透明度的白色背景 }); var html=''; $.ajax({ type:'post', //传送的方式,get/post url:'https://zbqfjx.com/index.php?s=Home/Singlelist/getcommnet.html', //发送数据的地址 data:{"sg_id":$("#id").val()}, dataType: "json", success:function(json) { layer.close(index); if (json.status==1) { if(json.data!=''){ $.each(json.data,function(i,v){ html+='
  • \
    \ \ '+v['user_name']+'\ \
    \ \ \

    '+v['create_date']+'@'+v['user_name']+'

    \ '+v['content']+'\
    \
    \
  • '; }); }else{ html+='
  • 暂无评论

  • '; } $("#allpinlun").html(html); $(".pinlunshow").attr('attr_show',1).remove(); }else{ layer.msg(json.msg); } return false; }, error:function (XMLHttpRequest, ajaxOptions, thrownError) { layer.close(index); layer.alert(XMLHttpRequest+thrownError); } }); } }) if($('.pro_taocan').length>1&&$("#i").val()!=-1){ $('.pro_taocan').eq($("#i").val()).click(); }else if($('.pro_taocan').length==1){ $('.pro_taocan').click(); } // 购买数量加减 $('#pro_up,#pro_down').click(function () { var numObj = $("#buy_number"), num = parseInt(numObj.val()), max_buy = numObj.attr('max-buy'), min_buy = numObj.attr('min-buy'), _this = $(this); if (_this.attr('data-operator') == '+') { // 加 if (num < max_buy) { num += 1; } else { return; } } else if (_this.attr('data-operator') == '-') { // 减 if ((num > min_buy && min_buy > 0) || (num > 1 && min_buy == 0)) { num -= 1; } else { return; } } numObj.val(num); $("#num").val(num); }); $("#buy_number").keyup(function () { var max_buy = parseInt($(this).attr("max-buy").toString()); var min_buy = parseInt($(this).attr("min-buy").toString()); var v = $(this).val(); if (min_buy > 0 && v < min_buy) { $(this).val(min_buy); return; } if (max_buy > 0 && v > max_buy) { $(this).val(max_buy); } $("#num").val($(this).val()); }); }); function WFDDURL(){ var WFDDURL=null; WFDDURL=document.referrer; if(WFDDURL.indexOf('shopcart') == -1){ console.log(1); Cookies.set('WFDDURL', WFDDURL); } } WFDDURL(); /*(function(m, ei, q, i, a, j, s) { m[i] = m[i] || function() { (m[i].a = m[i].a || []).push(arguments) }; j = ei.createElement(q), s = ei.getElementsByTagName(q)[0]; j.async = true; j.charset = 'UTF-8'; j.src = 'https://static.meiqia.com/dist/meiqia.js?_=t'; s.parentNode.insertBefore(j, s); })(window, document, 'script', '_MEIQIA'); _MEIQIA('entId', );*/ //点击轮播 jQuery("#good_other_info").slide({trigger:'click',titCell:"#pro_fr_title li",targetCell:"#goodattrinfo .dh"}); // man_info $(document).ready(function(){ $(".goodnav").click(function(){ var index = $(this).parent().index(); $("#pro_fr_title li").eq(index).click(); $("html,body").animate({scrollTop:$("#good_other_info").offset().top},500); }); $(".pro_a_a").slide({ mainCell: ".bd ul", autoPlay: true }); $(window).on('scroll', function() { if (document.documentElement.scrollTop + document.body.scrollTop > $('#pro_fr_title').offset().top && document.documentElement.scrollTop + document.body.scrollTop < $('#pro_fr_comment').offset().top-300) { $('#pro_fr_nav').addClass('pro_fr_nav_fixed'); } else { $('#pro_fr_nav').removeClass('pro_fr_nav_fixed'); } var s1= document.documentElement.scrollTop + document.body.scrollTop ; var s2= document.documentElement.clientHeight + document.body.clientHeight ; var s3= document.documentElement.scrollHeight + document.body.scrollHeight ; var s4= $('#aboutpro').offset().top+$('#aboutpro').height(); var s5= $('#goodattrinfo').offset().top+$('#goodattrinfo').height(); var s6= s4+$('#recommendpro').height(); if ( document.documentElement.scrollTop + document.body.scrollTop-2000 > s4 && s5>s6) { $('#recommendpro').css({"background-color":"#FFFFFF","position": "absolute","bottom":300+"px", "top":"auto","width":"240px"}); } else { $('#recommendpro').css({"position": "relative","bottom":"auto","top":"auto","width":"auto"}); } }); });