text: "use strict";define("render.js",["jquery"],function(){return{index_render:function(){var t=this;$.ajax({url:"../php/data.php",dataType:"json"}).done(function(e){t.chooseRender(e,"文艺女装",$("#main .literature"),0),t.chooseRender(e,"优雅女装",$("#main .grace"),1),t.chooseRender(e,"活泼女装",$("#main .lively"),2),t.chooseRender(e,"简约女装",$("#main .simplicity"),3),t.chooseRender(e,"度假女装",$("#main .vacation"),4),t.chooseRender(e,"舒适内衣",$("#main .underwear"),5),t.chooseRender(e,"品质男装",$("#main .mens"),6),t.chooseRender(e,"箱包品类",$("#main .package"),7),t.indexCart(e),$(function(){$("img.lazy").lazyload({effect:"fadeIn"})})})},chooseRender:function(e,t,n,o){var i="<ul>";$.each(["文艺女装","优雅女装","活泼女装","简约女装","度假女装","舒适内衣","品质男装","箱包品类"],function(e,t){i+=o==e?"<li><a href=\"javascript:void(0);\" class='active'>"+t+"</a></li>":'<li><a href="javascript:void(0);">'+t+"</a></li>"}),i+="</ul>";var a=!0,c=!1,s=void 0;try{for(var l,r=e[Symbol.iterator]();!(a=(l=r.next()).done);a=!0){var h=l.value;h.type===t&&(i+='\n                    <div class="good">\n                    <a href="details.html?sid='+h.sid+'" target=\'_blank\'>\n                        <img class="lazy"\n                            data-original="'+h.small_url+'"\n                            width="225" height="304">\n                    </a>\n                    <div>\n                        <a href="">￥'+h.new_price+'</a>\n                        <a href="">￥'+h.old_price+"</a>\n                    </div>\n                </div>")}}catch(e){c=!0,s=e}finally{try{!a&&r.return&&r.return()}finally{if(c)throw s}}n.html(i)},details_render:function(){var e=location.search.replace("?","");$.ajax({url:"../php/check_good.php?"+e,dataType:"json"}).done(function(e){var n,t,o,i,a,c,s,l;$("#store").html(e.store),$("#small_pic").attr({src:e.small_url}),$("title").html(e.title),$("#big_pic").attr({src:e.small_url.replace("large","huge").replace("L.jpg","H.jpg")}),$("#detail main article .list ul").html((n="",t=e.urls.split(","),$.each(t,function(e,t){n+=0===e?'\n                            <li><img src="'+t+'S.jpg" alt="" class=\'active\'></li>\n                            ':'\n                        <li><img src="'+t+'S.jpg" alt=""></li>\n                        '}),n)),$("#detail h2").html(e.title),$("#detail .new_price").html("￥"+e.new_price),$("#detail .old_price").html("￥"+e.old_price),$("#detail .choose").html((i="",a=(o=e).color.split(","),c=o.urls_good.split(","),$.each(a,function(e,t){i+=0===e?'\n                            <div class="color_content active">\n                                <img src="'+c[e]+'" alt="">\n                                <span>'+t+"</span>\n                            </div>\n                        ":'\n                        <div class="color_content">\n                            <img src="'+c[e]+'" alt="">\n                        <span>'+t+"</span>\n                        </div>\n                        "}),i)),$("#detail .size div").html((s="",l=e.size.split(","),$.each(l,function(e,t){s+=0===e?"\n                            <span class='active'>"+t+"</span>\n                        ":"\n                            <span>"+t+"</span>\n                        "}),s)),$(function(){$("img.lazy").lazyload({effect:"fadeIn"})})})},cart_render:function(e,t,n){if($.cookie("sid")){var o=Array.from(new Set($.cookie("sid").split(","))).map(function(e){return+e}).sort(function(e,t){return e-t}),c=$.cookie("sid").split(","),s=$.cookie("color").split(","),l=$.cookie("size").split(","),r=$.cookie("num").split(",");$.ajax({url:"../php/cart.php?sid="+o,type:"get",dataType:"json"}).done(function(a){$.each(o,function(n,o){var i='\n                        <aside>\n                        <div class="title">\n                            <p>以下商品由 <span>'+a[n].store+"</span> 发货 免配送费</p>\n                        </div>\n                        ";$.each(c,function(e,t){o==t&&(a[n].new_price*r[n],i+='\n                                <div class="shop_content">\n                                    <input type="checkbox" class="choose">\n                                    <div class="good_info">\n                                        <img src="'+a[n].small_url+'" alt="">\n                                        <p>'+a[n].title+"</p>\n                                        <div>\n                                            <p>品牌:"+a[n].store+"</p>\n                                            <p class='cSize'>尺寸:"+l[e]+"</p>\n                                            <p class='cColor'>颜色:"+s[e]+'</p>\n                                        </div>\n                                    </div>\n                                    <p class="single_price">￥'+a[n].new_price+'</p>\n                                    <div class="number">\n                                        <button class="del">-</button>\n                                        <input type="text" class="good_num" value="'+r[e]+'">\n                                        <button class="add">+</button>\n                                    </div>\n                                    <p class="total_price">￥'+a[n].new_price*r[e]+'</p>\n                                    <div class="opecation">\n                                        <button class="remove">移除</button>\n                                    </div>\n                                </div>\n                            ')}),i+="</aside>",$(".good_content").html($(".good_content").html()+i);$.each(r,function(e,t){+t}),$(".deal").html('\n                        <div>\n                            <p>商品数量总计: <span class="sum"></span>\n                            <span>件 折后商品金额总计</span>\n                            <span id="total_price">￥</span>\n                            </p>\n                        </div>\n                        <div>\n                            <button class=\'settle\'>去结算</button>\n                        </div>\n                        ')}),t(),n(),e()})}else $(".deal").html("\n                    <p class='empty'>您的购物车空空如也,快去挑选一些商品吧</p>\n                    <a href='index.html'>去首页</a>\n                ")},indexCart:function(i){if($.cookie("sid")){var e=Array.from(new Set($.cookie("sid").split(","))).map(function(e){return+e}).sort(function(e,t){return e-t}),t=$.cookie("sid").split(","),a=$.cookie("color").split(","),c=$.cookie("size").split(","),s=$.cookie("num").split(","),l="",r=0;$.each(e,function(n,o){l+='\n                        <div class="good_content">\n                        <p class="store">'+i[n].title+"</p>\n                    ",$.each(t,function(e,t){o==t&&(r+=s[e]*i[n].new_price,l+='\n                                <div class="shop_content">\n                                <div class="onegood">\n                                    <img src="'+i[n].small_url+'" alt="">\n                                    <div class="info">\n                                        <p class="shoptitle">'+i[n].title+'</p>\n                                        <div class="colorinfo">\n                                            <span>'+c[e]+"</span>\n                                            <span>"+a[e]+'</span>\n                                        </div>\n                                        <div class="priceinfo">\n                                            <span class="goodprice">￥'+i[n].new_price+'</span>\n                                            <span class="goodnum">*'+s[e]+"</span>\n                                        </div>\n                                    </div>\n                                </div>\n                        ")}),l+="</div>"}),$(".indexCart").html(l),$(".counting").html('\n                <div>\n                <span class="goodNum">共'+s.map(function(e){return+e}).reduce(function(e,t){return e+t})+'件商品</span>\n                <span class="goodPrice">￥'+r+'</span>\n                </div>\n                <a href="cart.html" class="totalPrice">去购物车结算</a>\n                ')}else $(".indexCart").html(""),$(".counting").html("")}}}),define("index_effect.js",["./render.js","jquery","jqcookie","lazyload"],function(e,s){return{init:function(){s("#list").load("session.html"),s("#footer").load("index_footer.html"),this.louti(),this.isLogin(),this.logout(),this.search(),this.searchGood(),this.showChat(),this.rightSidebar(),this.weChat(),this.loginBox(),e.index_render()},louti:function(){s("#main section").on("click",function(e){if("A"==e.target.nodeName){var t=s("#main section").eq(s(e.target).parent().index()).offset().top;s("html,body").animate({scrollTop:t},500)}})},isLogin:function(){var t=this;if(+s.cookie("flag")){var e=/^1[3,4,5,7,8]\d{9}$/.test(s.cookie("username"))?"phone":"email";s.ajax({type:"post",data:e+"="+s.cookie("username")+"&password="+s.cookie("password"),url:"../php/check_login.php"}).done(function(e){e?(s.cookie("flag",1,{expires:7,path:"/"}),t.changeHead()):s.cookie("flag",0,{expires:7,path:"/"})})}else s.cookie("flag",0,{expires:7,path:"/"}),t.changeHead()},changeHead:function(){+s.cookie("flag")?(s(".login").html("<a href='login.html'>欢迎您,"+s.cookie("username")+"</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:;'>我的梦芭莎</a>"),s(".register").html("<a href=\"javascript:;\" class='logout'>退出</a>")):(s(".login").html('<a href="login.html" class="loginaddress">登录</a>'),s(".register").html('<a href="register.html">注册</a>'))},logout:function(){s("header ul").on("click",function(e){s(e.target).is(".logout")&&(s.cookie("username","",{expires:-1,path:"/"}),s.cookie("password","",{expires:-1,path:"/"}),s.cookie("flag","0",{expires:7,path:"/"}),location.reload())})},search:function(){s(".search_value").on("input",function(){s.ajax({url:"https://suggest.taobao.com/sug?code=utf-8&q="+s(".search_value").val()+"&_ksTS=1569402939975_317&callback=taobao&k=1&area=c2c&bucketid=15",dataType:"jsonp"}).done(function(e){var t="",n=!0,o=!1,i=void 0;try{for(var a,c=e.result[Symbol.iterator]();!(n=(a=c.next()).done);n=!0){t+="\n                            <aside>"+a.value[0]+"</aside>\n                        "}}catch(e){o=!0,i=e}finally{try{!n&&c.return&&c.return()}finally{if(o)throw i}}s(".search .result").html(t)})})},searchGood:function(){s(".result").on("click",function(e){"ASIDE"===e.target.nodeName&&(s(".search_value").val(s(e.target).html()),s(".search .result").html(""),s(document).on("blur",function(){s(".search .result").html("")}))})},showChat:function(){s(".chat").hover(function(){s(this).children("img").show()},function(){s(this).children("img").hide()})},stairsShow:function(){1e3<=s("html,body").scrollTop()?s(".stairs").show():s(".stairs").hide()},rightSidebar:function(){var e=this;this.stairsShow(),s(document).on("scroll",function(){e.stairsShow()})},weChat:function(){s(".wechat").hover(function(){s(".wechat img").show()},function(){s(".wechat img").hide()})},loginBox:function(){+s.cookie("flag")&&s(".login_box").html('\n                    <img class="img2" src="http://i0.mbscss.com/img/moonbasa2/member/default-head.jpg" alt="">\n                    <p class="username">用户名:'+s.cookie("username")+'</p>\n                    <p class="usertype">会员类型:普通客户</p>\n                '),s("#user").hover(function(){s(".login_box").show()},function(){s(".login_box").hide()}),s.cookie("num")&&s(".shopcount").html(s.cookie("num").split(",").map(function(e){return+e}).reduce(function(e,t){return e+t})),s("#left_sidebar").on("mouseover",function(e){s(e.target).parents("section").is(".cartList")||s(e.target).is(".sideBar")||s(e.target).is(".sideBar p")?s(".cartList").show():s(".cartList").hide()}),s(".cartList").on("mouseout",function(){s(".cartList").hide()})}}}),define("cart_effect",["./index_effect.js","./render.js","jquery","jqcookie"],function(e,t,h){return{init:function(){h("#list").load("session.html"),h("#footer").load("index_footer.html"),h.cookie("url",location.href,{expires:7,path:"/"}),t.cart_render(this.setNum,this.isCheck,this.setCheck),this.clickEvent(),this.checkAll(),this.settleMent(),e.changeHead(),e.logout()},clickEvent:function(){var r=this;h(".good_content").on("click",function(e){if(h(e.target).is(".add")){var t=h(e.target).index(".add");h(".good_num").eq(t).val(+h(".good_num").eq(h(e.target).index(".add")).val()+1),h(".total_price").eq(t).html("￥"+h(".single_price").eq(t).html().replace("￥","")*h(".good_num").eq(t).val()),h(".choose").eq(t).prop("checked",!0),r.setCheck(),r.setNum(),r.changeNum(h(".good_num").eq(t).val(),t)}if(h(e.target).is(".del")){var n=h(e.target).index(".del"),o=+h(".good_num").eq(h(e.target).index(".del")).val()-1;o=o<=0?0:o--,h(".good_num").eq(n).val(o),0!=o?h(".total_price").eq(n).html("￥"+h(".single_price").eq(n).html().replace("￥","")*o):(h(".total_price").eq(n).html(0),h(".choose").eq(n).prop("checked",!1),r.setCheck()),r.setNum(),r.changeNum(h(".good_num").eq(n).val(),n)}if(h(e.target).is(".choose")&&(h(e.target).prop("checked")||h("#allcheck").prop("checked",!1),r.setCheck(),r.setNum()),h(e.target).is(".remove")&&confirm("你确定要删除吗")){var i=h(e.target).index(".remove"),a=h.cookie("color").split(","),c=h.cookie("size").split(","),s=h.cookie("sid").split(","),l=h.cookie("num").split(",");i=r.findIndex(i),a.splice(i,1),c.splice(i,1),s.splice(i,1),l.splice(i,1),h.cookie("num",l,{expires:7,path:"/"}),h.cookie("sid",s,{expires:7,path:"/"}),h.cookie("color",a,{expires:7,path:"/"}),h.cookie("size",c,{expires:7,path:"/"}),h(".shop_content").eq(h(e.target).index(".remove")).remove(),h.each(h(".good_content aside"),function(e,t){0==h(t).children(".shop_content").length&&h(t).remove()}),r.setNum(),r.setCheck(),r.emptyCart()}}),h(".good_content").on("input",function(e){if(h(e.target).is(".good_num")){var t=h(e.target).index(".good_num"),n=h(e.target).val();0!=n?h(".total_price").eq(t).html("￥"+h(".single_price").eq(t).html().replace("￥","")*n):h(".total_price").eq(t).html(0),this.setNum()}})},checkAll:function(){var e=this;h("#allcheck").on("click",function(){h(this).prop("checked")?h(".choose").prop("checked",!0):h(".choose").prop("checked",!1),e.setNum()})},setCheck:function(){var n=!0;n=0!=h(".good_content").children("aside").length,h.each(h(".choose"),function(e,t){if(!h(t).prop("checked"))return n=!1}),n?h("#allcheck").prop("checked",!0):h("#allcheck").prop("checked",!1)},setNum:function(){var o=0,i=0;h.each(h(".choose:checked"),function(e,t){var n=h(".choose").index(t);i+=+h(".good_num").eq(n).val(),o+=+h(".total_price").eq(n).html().replace("￥","")}),0!=i?h(".sum").html("￥"+i):h(".sum").html(0),0!=o?h("#total_price").html("￥"+o):h("#total_price").html(0)},changeNum:function(e,t){var n=h.cookie("num").split(",");n[this.findIndex(t)]=e,h.cookie("num",n,{expires:7,path:"/"})},isCheck:function(){h.each(h(".good_num"),function(e,t){0!=h(this).val()&&h(".choose").eq(e).prop("checked",!0)})},findIndex:function(e){var t=h.cookie("color").split(","),n=h.cookie("size").split(","),o=h(".cColor").eq(e).html().replace("颜色:",""),i=h(".cSize").eq(e).html().replace("尺寸:",""),a=0;return h.each(t,function(e,t){if(o==t&&n[e]==i)return a=e,!1}),a},settleMent:function(){var t=this;h(".deal").on("click",function(e){h(e.target).is(".settle")&&(+h.cookie("flag")?0!=h(".sum").html().replace("￥","")?confirm("您确认要购买选中的商品吗?")&&(alert("购买成功"),h(".good_content aside").remove(),t.setNum(),t.setCheck(),t.emptyCart(),h.cookie("num","",{expires:-1,path:"/"}),h.cookie("color","",{expires:-1,path:"/"}),h.cookie("size","",{expires:-1,path:"/"}),h.cookie("sid","",{expires:-1,path:"/"})):alert("您还没有选择商品哦!请您先选择商品"):confirm("您还没有登录,请先登录")&&(location.href="login.html"))})},emptyCart:function(){0==h(".good_content").children("aside").length&&h(".deal").html("\n                    <p class='empty'>您的购物车空空如也,快去挑选一些商品吧</p>\n                    <a href='http://10.31.155.75/mbs/dist/'>去首页</a>\n                ")}}});