import{_ as u,a as g}from"./14.js";import{o,c as i,a as s,e as _,t as d,F as p,i as h,k as v,M as f,p as b,g as C,_ as S}from"./index.js";import{b as k,a as y,_ as w}from"./remove.js";const c=t=>(b("data-v-79cd81cd"),t=t(),C(),t),x={class:"rows"},N={class:"row"},B={class:"row-title"},F=c(()=>s("span",null,"₽",-1)),I={class:"items"},G=["onClick"],D=c(()=>s("div",{class:"action"},[s("img",{src:k})],-1)),V={class:"item-image"},j=["src"],E={class:"item-data"},L={class:"price"},M=c(()=>s("span",null,"₽",-1)),O={class:"desc"},P=c(()=>s("img",{src:y},null,-1)),T=[P],q=c(()=>s("div",{class:"button"},[s("button",null,[s("img",{src:w}),_("Подтвердить")])],-1));function z(t,a,l,H,r,n){return o(),i("div",x,[s("div",N,[s("div",B,[_("Ваши покупки"),s("p",null,[_(d(n._formatNumber(r.priceSum)),1),F])]),s("div",I,[(o(!0),i(p,null,h(r.goods,(e,m)=>v((o(),i("div",{class:"item",onClick:J=>n.removeFromCart(m),key:m,style:{"margin-left":"7px"}},[D,s("div",V,[s("img",{class:"image",src:r.images["/src/assets/images/clothing_shop/items/"+e.image]},null,8,j)]),s("div",E,[s("div",L,[_(d(n._formatNumber(e.price)),1),M]),s("div",O,d(e.title),1)])],8,G)),[[f,e.inCart]])),128)),(o(!0),i(p,null,h(4-r.count,e=>(o(),i("div",{class:"item-empty",key:e},T))),128))])]),q])}const A={name:"mainPage",props:["openGoods"],data(){return{images:Object.assign({"/src/assets/images/clothing_shop/items/1.png":u,"/src/assets/images/clothing_shop/items/1.svg":g}),goods:[],count:0,priceSum:0}},created(){this.openGoods&&(this.goods=this.openGoods),this.calc()},methods:{calc(){const t=this.goods.filter(a=>a.inCart);this.count=t.length,this.priceSum=t.reduce((a,l)=>a+l.price,0)},removeFromCart(t){this.goods[t].inCart=!1,this.calc()},_formatNumber(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}}},U=S(A,[["render",z],["__scopeId","data-v-79cd81cd"]]);export{U as default};
