$(function(){ var imgwh =1920-$('.ztcon').width(); if(imgwh >0){ $('.ztcon img').attr('style','margin-left:-'+imgwh/2+'px'); } }) var product_array = Array(); product_array["94"] = Array("94","植物源性花青素固体饮料","580","20袋","32","http://up.yiqiaitao.com/pinpai/vense/images/2024121911481212121.png","http://up.yiqiaitao.com/pinpai/vense/images/2024121911481212121.png","清除自由基小能手","ANTHOCYAN","清除自由基小能手"); product_array["125"] = Array("125","唯恩诗多效修护冻干絮精华液","498","(60mg+6ml)*5","16","http://up.yiqiaitao.com/pinpai/vense/images/202503121424178995.jpg","http://up.yiqiaitao.com/pinpai/vense/images/202503121424178995.jpg","红敏脆弱 轻中度痘 细纹下垂","","受损肌修护液体绷带"); product_array["127"] = Array("127","去端肽胶原冻干面膜","238","25ml/片*5片","16","http://up.yiqiaitao.com/pinpai/vense/images/202205311139413266.png","http://up.yiqiaitao.com/pinpai/vense/images/202205311139413266.png","急救敏肌 全脸修护","","精研胶原 冻干黑科技"); product_array["131"] = Array("131","鱼胶原蛋白肽","580","12瓶","32","http://up.yiqiaitao.com/pinpai/vense/images/2024122611051410531.png","http://up.yiqiaitao.com/pinpai/vense/images/2024122611051410531.png","至纯奢养 逆龄新生","FISH COLLAGEN PEPTIDE POWDER","100% 纯胶原"); product_array["134"] = Array("134","胶原蛋白精华水乳","416","120ml+100g","16","http://up.yiqiaitao.com/pinpai/vense/images/202407011006194046.jpg","http://up.yiqiaitao.com/pinpai/vense/images/202407011006194046.jpg","双效胶原 维稳透润","","新一代生物护肤 全天状态稳稳"); product_array["136"] = Array("136","氨基酸臻颜净透洁面乳","88","100g","11","http://up.yiqiaitao.com/pinpai/vense/images/202412191133355152.png","http://up.yiqiaitao.com/pinpai/vense/images/202412191133355152.png","氨基酸洁面 温和更洁净","","温和净颜 深澈柔肤"); product_array["137"] = Array("137","舒缓屏障特护霜","198","30g","11","http://up.yiqiaitao.com/pinpai/vense/images/2024092811155814534.jpg","http://up.yiqiaitao.com/pinpai/vense/images/2024092811155814534.jpg","高能舒缓力 修护受损肌","","高阶速修霜 安抚脆弱肌"); product_array["138"] = Array("138","祛痘修护凝胶","98","4g","35","http://up.yiqiaitao.com/pinpai/vense/images/2022091917162114582.jpg","http://up.yiqiaitao.com/pinpai/vense/images/2022091917162114582.jpg","定点靶向祛痘 刷新战痘值","","消痘急救棒 精准战痘不留痕"); product_array["141"] = Array("141","玻色因抗皱精萃面霜","580","50g","11","http://up.yiqiaitao.com/pinpai/vense/images/2023052709213010595.jpg","http://up.yiqiaitao.com/pinpai/vense/images/2023052709213010595.jpg","修护愈颜 抚纹驻龄","","内源紧塑 外源强韧 全方位肌活年轻"); product_array["142"] = Array("142","铂金双效面膜","138","30ml*5","11","http://up.yiqiaitao.com/pinpai/vense/images/2023122117415516027.jpg","http://up.yiqiaitao.com/pinpai/vense/images/2023122117415516027.jpg","微米铂金赋能 卓效抑菌抗氧","","革新面膜黑科技 全方位愈颜紧塑"); product_array["143"] = Array("143","黑松露臻奢舒缓水乳","466","120ml+100g","11","http://up.yiqiaitao.com/pinpai/vense/images/2023122513451013044.jpg","http://up.yiqiaitao.com/pinpai/vense/images/2023122513451013044.jpg","凝炼稀世精萃 肌肤蕴能焕新","","满蕴修护能量 重启内源驱动力"); product_array["146"] = Array("146","臻奢精萃抗皱紧致眼霜","280","20g","11","http://up.yiqiaitao.com/pinpai/vense/images/202402231505359027.jpg","http://up.yiqiaitao.com/pinpai/vense/images/202402231505359027.jpg","多效合一 靶向攻克眼周难题","","赋活睛采 眼见年轻"); product_array["147"] = Array("147","繁花植萃精华油","420","30g","16","http://up.yiqiaitao.com/pinpai/vense/images/2024122614375811086.png","http://up.yiqiaitao.com/pinpai/vense/images/2024122614375811086.png","天然植物油脂 好油更养肤 ","","100%纯油体系 以油养肤新时代"); product_array["148"] = Array("148","黑松露臻奢舒缓水","198","120ml","11","http://up.yiqiaitao.com/pinpai/vense/images/2024123016375218150.png","http://up.yiqiaitao.com/pinpai/vense/images/2024123016375218150.png","凝炼稀世精萃 肌肤蕴能焕新","","满蕴修护能量 立体激活水循环"); product_array["149"] = Array("149","黑松露臻奢舒缓乳","268","100g","11","http://up.yiqiaitao.com/pinpai/vense/images/202412301642274896.png","http://up.yiqiaitao.com/pinpai/vense/images/202412301642274896.png","凝炼稀世精萃 肌肤蕴能焕新","","重启内源驱动力 紧致年轻轮廓"); function ckItem(e1, e2, e3)//e3:+ =add - = remove c=clear { var xh = e1; var strPros = "["; if($.cookie("cart") == null) { strPros += '{"proX":"' + xh + '","proS":"' + e2 + '"}'; } else { var obj = eval("(" + $.cookie("cart") + ")"); var strPro = ""; var flag = false; for(var i = 0;i < obj.length;i++) { if(obj[i]["proX"] == xh) { flag = true; var sl = 0; if(e3 == "+") { sl = parseInt(obj[i]["proS"]) + e2; } else if(e3 == "-") { sl = parseInt(obj[i]["proS"]) - e2; } else if(e3 == "*") { sl = parseInt(obj[i]["proS"]) * e2; } else if(e3 == "/") { sl = parseInt(obj[i]["proS"]) / e2; } else if(e3 == "c"){ s1 = 0; } else { sl = e2; } strPro += "," + '{"proX":"' + xh + '","proS":"' + sl + '"}'; } else { strPro += "," + '{"proX":"' + obj[i]["proX"] + '","proS":"' + obj[i]["proS"] + '"}'; } } if(!flag) { strPro += "," + '{"proX":"' + xh + '","proS":"' + e2 + '"}'; } var strProL = strPro.length; var strTemp = ""; if(strProL > 1) { strTemp =strPro.substring(1, strProL); } strPros += strTemp; } strPros += "]"; $.cookie("cart", strPros); qk0(); } function ckItem_promptly(e1, e2, e3)//e3:+ =add - = remove c=clear { $.cookie("cart_promptly", "[]"); var xh = e1; var strPros = "["; if($.cookie("cart_promptly") == null) { strPros += '{"proX":"' + xh + '","proS":"' + e2 + '"}'; } else { var obj = eval("(" + $.cookie("cart_promptly") + ")"); var strPro = ""; var flag = false; for(var i = 0;i < obj.length;i++) { if(obj[i]["proX"] == xh) { flag = true; var sl = 0; if(e3 == "+") { sl = parseInt(obj[i]["proS"]) + e2; } else if(e3 == "-") { sl = parseInt(obj[i]["proS"]) - e2; } else if(e3 == "*") { sl = parseInt(obj[i]["proS"]) * e2; } else if(e3 == "/") { sl = parseInt(obj[i]["proS"]) / e2; } else if(e3 == "c"){ s1 = 0; } else { sl = e2; } strPro += "," + '{"proX":"' + xh + '","proS":"' + sl + '"}'; } else { strPro += "," + '{"proX":"' + obj[i]["proX"] + '","proS":"' + obj[i]["proS"] + '"}'; } } if(!flag) { strPro += "," + '{"proX":"' + xh + '","proS":"' + e2 + '"}'; } var strProL = strPro.length; var strTemp = ""; if(strProL > 1) { strTemp =strPro.substring(1, strProL); } strPros += strTemp; } strPros += "]"; $.cookie("cart_promptly", strPros); qk0(); } function qk0() { if($.cookie("cart") != null) { if($.cookie("cart") == "[]") $.cookie("cart", null); else { var strPros = ""; var obj = eval("(" + $.cookie("cart") + ")"); var strPro = ""; for(var i = 0;i < obj.length;i++) { if(parseInt(obj[i]["proS"]) > 0) { strPro += "," + '{"proX":"' + obj[i]["proX"] + '","proS":"' + obj[i]["proS"] + '"}'; } } if(strPro.length > 0) { strPros = "[" + strPro.substring(1, strPro.length) + "]"; } if(strPros.length > 2) { $.cookie("cart", strPros); } else { $.cookie("cart", null); } } } } function c_cart(){ var string; if($.cookie("cart")!=null){ string = '
唯恩诗官网
购物车 0
'; $(".cart-div").html(string); $("#c_f,#show-cart").mouseover(function(){ $("#show-cart").addClass("up"); }).mouseout(function(){ $("#show-cart").removeClass("up"); }).click(function(){ $(".c-up").hide(); $(".box").slideDown(); hide = 0; $(".cart").mouseover(function(){hide=0;}).mouseout(function(){ hide = 1; }); }); }else{ string = '
'; $(".cart-div").html(string); } } function c_s_list(){ c_cart();/*删除(程元刚)*/ var cart = $.cookie("cart"); var trs = ""; var count = 0; var cartn = 0; if(cart!=null){ var obj = eval("(" + cart + ")"); var pid,pnum,pprice,purl,pname; for(var i = 0;i < obj.length;i++){ pid = obj[i]["proX"]; pnum = parseInt(obj[i]["proS"]); pname = product_array[""+pid][1]; pprice = parseInt(product_array[""+pid][2]); purl = product_array[""+pid][5]; count += (pnum*pprice); cartn += 1; trs += "
"+pname+""+pnum+"
"+(pnum*pprice)+".00
"; } } $("#c_l").html(trs);/*删除(程元刚)*/ $("#price").html(count+".00"); $("#cart_num").html(cartn); if(cartn<10){ $(".header_num").html(cartn); }else{ $(".header_num").html("..."); } $("a[name='r_p']").click(function(){ ckItem($(this).attr("pro"),0,"c"); if($.cookie("cart")!=null){ $("div[plist='"+$(this).attr("pid")+"']").remove(); }else{ c_cart(); c_s_list(); } return false; }) } function c_s_list_promptly(){ c_cart();/*删除(程元刚)*/ var cart = $.cookie("cart_promptly"); var trs = ""; var count = 0; var cartn = 0; if(cart!=null){ var obj = eval("(" + cart + ")"); var pid,pnum,pprice,purl,pname; for(var i = 0;i < obj.length;i++){ pid = obj[i]["proX"]; pnum = parseInt(obj[i]["proS"]); pname = product_array[""+pid][1]; pprice = parseInt(product_array[""+pid][2]); purl = product_array[""+pid][5]; count += (pnum*pprice); cartn += 1; trs += "
"+pname+""+pnum+"
"+(pnum*pprice)+".00
"; } } $("#c_l").html(trs);/*删除(程元刚)*/ $("#price").html(count+".00"); $("#cart_num").html(cartn); if(cartn<10){ $(".header_num").html(cartn); }else{ $(".header_num").html("..."); } $("a[name='r_p']").click(function(){ ckItem($(this).attr("pro"),0,"c"); if($.cookie("cart_promptly")!=null){ $("div[plist='"+$(this).attr("pid")+"']").remove(); }else{ c_cart(); c_s_list(); } return false; }) } var hide = 0,move= 10,startL,startT,endL,endT,moveL,moveT; function movepic(def,pic){ if($("#movePic").length<=0){ var string = ''; $("body").append(string); } if(def==0){ $("#movePic img").attr("src",pic); $("#movePic").css({top:startT+"px",left:startL+"px"}).show(); setTimeout("movepic(1)",20); }else if(def==1){ var curoffset = $("#movePic").offset(); var curL = curoffset.left; var curT = curoffset.top; if(curL>=endL){moveL=0} if(curT>=endT){moveT=0} if(curL').click(function(){ if(hide==1) { $(".box").hide(); $(".c-up").show(); } }); c_cart();/*删除(程元刚)*/ c_s_list(); /*删除(程元刚)*/ $("a[name='plus']").click(function(){ var obj = "#"+$(this).attr("pro"); $(obj).val(parseInt($(obj).val())+1); return false }); $("a[name='subt']").click(function(){ var obj = "#"+$(this).attr("pro"); if(parseInt($(obj).val())>1){ $(obj).val(parseInt($(obj).val())-1); } return false; }); $(".tocart_promptly").click(function(){ var pid = $(this).attr("pid"); var purl =product_array[""+pid][5]; var pnum = parseInt($("#proname_"+pid).val()); if(pnum==0||pnum==undefined){ pnum = 1; } ckItem_promptly(pid,pnum,"+"); c_s_list_promptly(); var boffset = $(this).offset(); startL = boffset.left; startT = boffset.top; var cartoffset = $("#cartbox").offset(); endL = cartoffset.left+70; endT = cartoffset.top-70; moveL = ((cartoffset.left+70) - boffset.left)/10; moveT = ((cartoffset.top-70) - boffset.top)/10; movepic(0,purl); return false; }); $(".tocart").click(function(){ var pid = $(this).attr("pid"); var purl =product_array[""+pid][5]; var pnum = parseInt($("#proname_"+pid).val()); if(pnum==0||pnum==undefined){ pnum = 1; } ckItem(pid,pnum,"+"); c_s_list(); var boffset = $(this).offset(); startL = boffset.left; startT = boffset.top; var cartoffset = $("#cartbox").offset(); endL = cartoffset.left+70; endT = cartoffset.top-70; moveL = ((cartoffset.left+70) - boffset.left)/10; moveT = ((cartoffset.top-70) - boffset.top)/10; movepic(0,purl); return false; }); } }) function ptocart(pid,price){ var cart = $.cookie("cart"); var prohas = 0; if(cart!=null){ var obj = eval("(" + cart + ")"); for(var i = 0;i < obj.length;i++){ if(obj[i]["pId"]==pid){ prohas = 1; break; } } } if(prohas==0){ ckItem(parr[pid][1],1,"+",price,pid); } } function grouptocart(pids){ $.cookie("cart", null); //清空原有的购物车 if(pids.indexOf(",")>0){ pidsArr = pids.split(","); for(var i=0;i0){ pid_arr = pidsArr[i].split("|"); pid = pid_arr[0]; num = pid_arr[1]; ckItem(parr[pid][1],num,"+",parr[pid][3],pid); } } }else if(pids.indexOf("|")>0){ pid_arr = pids.split("|"); pid = pid_arr[0]; num = pid_arr[1]; ckItem(parr[pid][1],num,"+",parr[pid][3],pid); } }