//author: 声色视觉
//webSite: www.softboyo.cn
//blog.sina.com/k3man
//2021-05
$(function(){$.extend({tipsBox:function(a){a=$.extend({obj:null,str:"+1",startSize:"12px",endSize:"30px",interval:600,color:"red",callback:function(){}},a);$("body").append("\x3cspan class\x3d'num'\x3e"+a.str+"\x3c/span\x3e");var b=$(".num"),c=a.obj.offset().left+a.obj.width()/2,d=a.obj.offset().top-a.obj.height();b.css({position:"absolute",left:c+"px",top:d+"px","z-index":9999,"font-size":a.startSize,"line-height":a.endSize,color:a.color});b.animate({"font-size":a.endSize,opacity:"0",top:d-parseInt(a.endSize)+"px"},a.interval,function(){b.remove();a.callback()})}});1==ExtractURL("paystatu")&&($.cookie("cakecar",null,{expires:-1}),msgbox("\u4e0b\u5355\u6210\u529f\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u3010\u8ba2\u5355\u3011\u67e5\u770b\u8be6\u60c5\u3002",2));goodsQuantity()});function niceIn(a){a.find("i").addClass("niceIn");setTimeout(function(){a.find("i").removeClass("niceIn")},1E3)}function addtocar(a){var b=a.id.split("_")[1];$.tipsBox({obj:$("#addcar_"+b),str:"+1",callback:function(){var a=parseInt($("#count").text())+1;$("#count").text(a);var a={},d=[],f=$("#addcar_"+b).next().next()[0],e=readcardb();a.pid=b;a.goods=$(f).children().eq(0).text();a.quant=1;a.price=$("#pri_"+b).text();if(null!=e)if(d=e,0<compare(d,a))for(key in d)d[key].pid===a.pid&&(d[key].quant+=1);else d.push(a);else d.push(a);writeCardb(d)}})}function compare(a,b){return a.filter(function(a){return a.pid===b.pid}).length}function InitialDB(){GetBackstage("SendProduct",function(a){filldata(a[0]);Merchant()})}function Merchant(){GetBackstage("merinfo",function(a){a=a[0];$("h6.font-weight-light").eq(0).html('\x3ci class\x3d"fa fa-phone"\x3e\x3c/i\x3e\x26nbsp;'+a.phone);$("h6.font-weight-light").eq(1).html('\x3ci class\x3d"fa fa-location-arrow"\x3e\x3c/i\x3e\x26nbsp;'+a.address);$("#title").text(a.merchant);$("title").text(a.merchant)})}function filldata(a){var b="",c='\x3cdiv class\x3d"col-sm-6 col-lg-4" style\x3d"margin-top: 35px;"\x3e\x3cdiv class\x3d"card clean-card text-center"\x3e\x3cbutton class\x3d"btn btn-primary overlay" onclick\x3d"addtocar(this)" type\x3d"button" id\x3d"addcar_,"\x3e\x3ci class\x3d"fas fa-shopping-cart"\x3e\x3c/i\x3e\x3c/button\x3e\x3cimg class\x3d"card-img w-100 d-block" src\x3d"./uploads/,"\x3e\x3cdiv class\x3d"card-body info"\x3e\x3ch5\x3e,\x3c/h5\x3e\x3cdiv class\x3d"row"\x3e\x3cdiv class\x3d"col"\x3e\x3cp\x3e\u89c4\u683c\x3c/p\x3e\x3c/div\x3e\x3cdiv class\x3d"col"\x3e\x3cp class\x3d"text-primary"\x3e,\x3c/p\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"row"\x3e\x3cdiv class\x3d"col"\x3e\x3cp\x3e\u4ef7\u683c\x3c/p\x3e\x3c/div\x3e\x3cdiv class\x3d"col"\x3e\x3cp class\x3d"text-primary"\x3e\uffe5\x3cspan id\x3d"pri_,"\x3e,\x3c/span\x3e\x3c/p\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"row"\x3e\x3cdiv class\x3d"col"\x3e\x3cp\x3e\u7f16\u53f7\x3c/p\x3e\x3c/div\x3e\x3cdiv class\x3d"col"\x3e\x3cp class\x3d"text-primary"\x3e,\x3c/p\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'.split(",");for(key in a.id)b+=c[0]+a.id[key]+c[1]+a.picture[key]+c[2]+a.product[key]+c[3]+a.model[key]+c[4]+a.id[key]+c[5]+a.price[key].toFixed(2)+c[6]+a.id[key]+c[7];$("#Productlist").html(b)}function submitdata(){var a={},b=$('[name\x3d"name"]').val(),c=$('[name\x3d"tel"]').val(),d=$('[name\x3d"message"]').val();""==c?(msgbox("\u8bf7\u8f93\u5165\u624b\u673a\u53f7\u7801",0),$('input[name\x3d"tel"]').focus()):isPhoneNo(c)?(a.tel=c,a.name=b,a.msg=d,postBackstage("Msgjson",a,function(a){!0===a?msgbox("\u7533\u8bf7\u6210\u529f\uff0c\u8bf7\u4fdd\u6301\u8054\u7cfb\u7545\u901a\u3002",1):msgbox("\u63d0\u4ea4\u5931\u8d25\uff0c\u8bf7\u7a0d\u5019\u518d\u8bd5\u3002",0)})):msgbox("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7",0)};