import{_ as C,a as k}from"./14.js";import{o as t,c as i,a as s,F as d,i as h,f as g,e as v,t as l,k as m,M as p,_ as y}from"./index.js";import{_ as f}from"./check2.js";const T={class:"rows"},w={key:0,class:"row"},N=s("div",{class:"row-title"},"В тренде",-1),b={class:"items"},x=["onClick"],S={class:"action"},G={key:0,style:{margin:"-1px 0 0 1px"}},B={key:1,style:{margin:"0 0 0 2px",height:"10px"},src:f},I={class:"item-image"},M=["src"],V={class:"item-data"},A={class:"price"},D=s("span",null,"₽",-1),F={class:"desc"},P={class:"row-title"},j={class:"items"},E=["onClick"],L={class:"action"},O={src:f},R={class:"item-image"},X=["src"],q={class:"item-data"},z={class:"price"},H=s("span",null,"₽",-1),J={class:"desc"};function K(o,a,W,Y,e,c){return t(),i("div",T,[e.searching?g("",!0):(t(),i("div",w,[N,s("div",b,[(t(!0),i(d,null,h(e.trends,(r,_)=>(t(),i("div",{class:"item",onClick:n=>c.addToCart(r),key:_},[s("div",S,[e.goods[r].inCart?g("",!0):(t(),i("span",G,"+")),e.goods[r].inCart?(t(),i("img",B)):g("",!0)]),s("div",I,[s("img",{class:"image",src:e.images["/src/assets/images/clothing_shop/items/"+e.goods[r].image]},null,8,M)]),s("div",V,[s("div",A,[v(l(c._formatNumber(e.goods[r].price)),1),D]),s("div",F,l(e.goods[r].title),1)])],8,x))),128))])])),(t(!0),i(d,null,h(e.categories,(r,_)=>m((t(),i("div",{class:"row",key:_},[s("div",P,l(r),1),s("div",j,[(t(!0),i(d,null,h(e.goods.filter(n=>n.category==_),(n,u)=>(t(),i("div",{class:"item",onClick:Z=>c.addToCart(u),key:u},[s("div",L,[m(s("span",null,"+",512),[[p,!n.inCart]]),m(s("img",O,null,512),[[p,n.inCart]])]),s("div",R,[s("img",{class:"image",src:e.images["/src/assets/images/clothing_shop/items/"+n.image]},null,8,X)]),s("div",q,[s("div",z,[v(l(c._formatNumber(n.price)),1),H]),s("div",J,l(n.title),1)])],8,E))),128))])])),[[p,c.issetGoodsInCategory(_)]])),128))])}const Q=4,U={name:"mainPage",props:["openGoods","openTrends","openCategories","openSearching"],data(){return{images:Object.assign({"/src/assets/images/clothing_shop/items/1.png":C,"/src/assets/images/clothing_shop/items/1.svg":k}),goods:[],trends:[],categories:[],searching:!1}},created(){this.openGoods&&(this.goods=this.openGoods),this.openTrends&&(this.trends=this.openTrends),this.openCategories&&(this.categories=this.openCategories),this.openSearching&&(this.searching=this.openSearching)},methods:{pathImage(o){return console.log(o),"@/assets/images/clothing_shop/items/1.png"},addToCart(o){this.goods.filter(a=>a.inCart).length<Q&&(this.goods[o].inCart=!0,this.$emit("add-to-cart",o))},issetGoodsInCategory(o){for(let a=0;a<this.goods.length;++a)if(this.goods[a].category==o)return!0;return!1},_formatNumber(o){return o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}}},ts=y(U,[["render",K]]);export{ts as default};
