Files
tehran_tala/apps/user-app/dist/assets/HomeView-CarYJw6t.js
T
2026-10-11 17:00:31 +03:30

2 lines
10 KiB
JavaScript

import{d as G,u as re,o as oe,a as ee,b as t,c as l,e as a,n as R,F as q,r as Y,f as L,g as k,h as z,i as M,_ as T,t as O,j as ce,k as ue,l as de,w as _e,m as e,p as ve,q as u,I as B,s as me,v as le,x as ie,y as ge,z as he,K as te,A as x,B as pe,C as se,D as fe,E as U,L as J,G as ye}from"./index-ClmkEBsB.js";import{R as ke}from"./RateStrip-BfH6BJ6M.js";import{S as ae}from"./SectionHead-BCigawPG.js";import{u as be}from"./filtersStore-DHFx31i1.js";import{u as we}from"./useReveal-Blp8IFfR.js";import{P as Se}from"./index-BZqGrXNr.js";import"./filters-BhPmSmBc.js";const Ce={key:0,class:"showcase"},Ie=["onClick"],$e=["src"],Pe={key:0,class:"showcase__dots"},xe=["aria-label","onClick"],ne=.18,Re=6,ze=G({__name:"ShowcaseSlider",props:{slides:{}},emits:["select"],setup(i,{emit:v}){const h=i,A=v,c=z(0);let d;const f=re();function P(n){c.value=n,I()}function I(){d&&clearInterval(d),h.slides.length>1&&!f.isReducedMotion&&(d=setInterval(()=>{c.value=(c.value+1)%h.slides.length},6e3))}oe(I),ee(()=>{d&&clearInterval(d)});const y=z(null),b=z(!1),m=z(0);let g=null,w=0,F=0,D=0,C=!1;function H(n){var p;if(h.slides.length<2||g!==null)return;const _=y.value;_&&(g=n.pointerId,w=n.clientX,F=n.clientY,D=_.getBoundingClientRect().width||1,m.value=0,b.value=!0,C=!1,(p=_.setPointerCapture)==null||p.call(_,n.pointerId))}function V(n){if(!b.value||n.pointerId!==g)return;const _=n.clientX-w,p=n.clientY-F;!C&&Math.abs(_)>Math.abs(p)&&Math.abs(_)>Re&&(C=!0),C&&(m.value=_)}function N(){if(!b.value)return;const _=m.value/D;b.value=!1,g=null,m.value=0,_<=-ne&&c.value<h.slides.length-1?c.value++:_>=ne&&c.value>0&&c.value--,C&&I(),C=!1}function j(n){n.pointerId===g&&N()}function X(n){n.pointerId===g&&(b.value=!1,g=null,m.value=0,C=!1)}function K(n){C||A("select",n)}const W=M(()=>{const n=-c.value*100,_=D?m.value/D*100:0;return{transform:`translate3d(${n+_}%, 0, 0)`,transition:b.value?"none":void 0}});return ee(()=>{if(g!==null&&y.value)try{y.value.releasePointerCapture(g)}catch{}}),(n,_)=>i.slides.length?(t(),l("section",Ce,[a("div",{ref_key:"root",ref:y,class:L(["showcase__frame",{"is-dragging":b.value}]),onPointerdown:H,onPointermove:V,onPointerup:j,onPointercancel:X},[a("div",{class:"showcase__track",style:R(W.value)},[(t(!0),l(q,null,Y(i.slides,(p,E)=>(t(),l("article",{key:p.key,class:L(["showcase__slide",{"is-active":E===c.value}]),onClick:o=>K(p)},[p.image?(t(),l("img",{key:0,src:p.image,alt:"",class:"showcase__art",draggable:"false"},null,8,$e)):k("",!0)],10,Ie))),128))],4)],34),i.slides.length>1?(t(),l("div",Pe,[(t(!0),l(q,null,Y(i.slides,(p,E)=>(t(),l("button",{key:p.key,type:"button",class:L(["showcase__dot",{"is-active":E===c.value}]),"aria-label":p.title,onClick:o=>P(E)},null,10,xe))),128))])):k("",!0)])):k("",!0)}}),Ae=T(ze,[["__scopeId","data-v-90ab1328"]]),De={class:"rail no-scrollbar"},Be=["onClick"],Me={class:"rail__mark","aria-hidden":"true"},Le=["src"],Fe={class:"rail__title"},Ve=G({__name:"CategoryRail",props:{categories:{},activeId:{}},emits:["select"],setup(i,{emit:v}){const h=v;return(A,c)=>(t(),l("div",De,[(t(!0),l(q,null,Y(i.categories,d=>{var f;return t(),l("button",{key:d.id,type:"button",class:L(["rail__chip",{"is-active":d.id===i.activeId}]),onClick:P=>h("select",d)},[a("span",Me,[(f=d.icon)!=null&&f.image?(t(),l("img",{key:0,src:d.icon.image,alt:""},null,8,Le)):k("",!0)]),a("span",Fe,O(d.title),1)],10,Be)}),128))]))}}),Ee=T(Ve,[["__scopeId","data-v-b38bbeb0"]]),Oe={class:"card__art"},Xe=["alt"],qe={key:0,class:"card__badge"},Ye={class:"card__body"},He={class:"card__title"},Ne={class:"card__meta"},Ue={class:"card__weight"},Ge={key:0,class:"card__wage"},Te=G({__name:"ShowcaseCard",props:{value:{},wide:{type:Boolean},badge:{}},emits:["open"],setup(i,{emit:v}){const h=i,A=v,c=ce(),{image:d,id:f,title:P,min_gram:I,wage:y}=ue(h.value),b=M(()=>{const m=y.value;return m==null?"":m%1===0?String(m):m.toFixed(2)});return(m,g)=>{const w=de("lazy");return t(),l("article",{class:L(["card",{"card--wide":i.wide}]),"data-product-origin":"",onClick:g[1]||(g[1]=F=>A("open",i.value))},[a("div",Oe,[_e(a("img",{alt:e(P)},null,8,Xe),[[w,e(d)]]),a("button",{type:"button",class:L(["card__fav",{"is-on":e(c).isFavorite(e(f))}]),onClick:g[0]||(g[0]=ve(F=>e(c).toggle(e(f)),["stop"]))},[u(B,{icon:e(c).isFavorite(e(f))?"vuesax-linear:heart-fill":"vuesax-linear:heart",size:"17"},null,8,["icon"])],2),i.badge?(t(),l("span",qe,O(i.badge),1)):k("",!0)]),a("div",Ye,[a("h3",He,O(e(P)),1),a("div",Ne,[a("span",Ue,O(e(I))+" گرم",1),e(y)!=null?(t(),l("span",Ge,"اجرت "+O(b.value)+"٪",1)):k("",!0)])])],2)}}}),Q=T(Te,[["__scopeId","data-v-bd6d18a4"]]),je="/assets/shipping-and-delivery-CyUGL93q.png",Ke="/assets/sports-and-competition-ao926_SX.png",We=[{type:"popup",src:je,text:"ارسال سریع و مطمئن سفارش‌های شما به سراسر کشور.",link:void 0},{type:"popup",src:Ke,text:"جدیدترین محصولات منتزر را در بخش محصولات جدید ببینید.",link:void 0},{type:"popup",src:le,text:"منتزر، همراه شما در خرید و فروش طلا.",link:void 0}],Je=me("config",{state:()=>({config:{main_slider:We},cats:[],loaded:!1}),actions:{setCats(i){this.cats=i},async init(i=!1){try{const v=ie();await v.load(i),this.cats=v.categories.map(h=>({...h,icon:{image:le}})),this.loaded=!0}catch(v){console.log(v)}}}}),Qe={class:"home"},Ze={class:"home__bar"},et={class:"home__barInner"},tt={key:0,class:"home__badge"},st={key:0,class:"home__grid"},at={class:"home__reel no-scrollbar"},nt={class:"home__trustItem"},ot={class:"home__trustItem"},lt={class:"home__trustItem"},it=G({__name:"HomeView",setup(i){const v=fe(),h=Je(),A=ge(),c=be(),d=ie(),f=he(),P=z(!d.loaded),I=z(!1),y=M(()=>d.products),b=z(f.peek(te.goldPrice)??null),m=z(f.peek(te.homeSlider)??null),{revealed:g,revealDelay:w,reveal:F}=we("home"),D=M(()=>y.value[0]??null),C=M(()=>y.value.slice(1,5)),H=M(()=>y.value.slice(5,13)),V=[{eyebrow:"مجموعه منتزر",cta:"دیدن مجموعه"},{eyebrow:"انتخاب سردبیر",cta:"مشاهده"},{eyebrow:"پیشنهاد این هفته",cta:"بررسی کنید"}],N=M(()=>{var s;if((s=m.value)!=null&&s.length)return m.value.filter(r=>r.image).map((r,S)=>({key:`${S}-${r.image}`,eyebrow:"مجموعه منتزر",title:"",subtitle:"",cta:"",image:r.image,link:r.link||void 0}));const o=h.cats.slice(0,3);return o.length?o.map((r,S)=>({key:r.id,eyebrow:V[S%V.length].eyebrow,title:r.title,subtitle:"ساخته‌شده از طلای ۱۸ عیار، با اجرت شفاف و اصالت تضمین‌شده.",cta:V[S%V.length].cta,image:j(r.id),categoryId:r.id})):[]});function j(o){var r,S;const s=y.value.find($=>{var Z;return((Z=$.category)==null?void 0:Z.id)===o});return(S=(r=s==null?void 0:s.images)==null?void 0:r[0])==null?void 0:S.url}function X(o){ye(o)}function K(o){c.query.cats=[o.id],v.push({name:"search"})}function W(o){if(o.link){/^https?:\/\//i.test(o.link)?window.open(o.link,"_blank","noopener"):v.push(o.link);return}o.categoryId&&(c.query.cats=[o.categoryId]),v.push({name:"search"})}function n(){v.push({name:"search"})}function _(){v.push({name:"newestProduct"})}async function p(o=!1){const[s,r,S]=await Promise.allSettled([h.init(o),f.goldPrice({force:o}),f.homeSlider({force:o})]);s.status==="rejected"&&console.log(s.reason),b.value=r.status==="fulfilled"?r.value:null,m.value=S.status==="fulfilled"?S.value:null}async function E(){await p(!0),I.value=!1}return oe(async()=>{await p(),P.value=!1,F()}),(o,s)=>{const r=se("router-link"),S=se("container");return t(),l("div",Qe,[a("header",Ze,[a("div",et,[u(r,{to:{name:"cart"},class:"home__iconBtn","aria-label":"سبد خرید"},{default:x(()=>[u(B,{icon:"vuesax-linear:bag-2",size:"21"}),e(A).items.length?(t(),l("span",tt,O(e(A).items.length),1)):k("",!0)]),_:1}),s[1]||(s[1]=a("img",{src:pe,alt:"منتزر",class:"home__logo"},null,-1)),u(r,{to:{name:"search"},class:"home__iconBtn","aria-label":"جستجو"},{default:x(()=>[u(B,{icon:"vuesax-linear:search-normal-1",size:"21"})]),_:1})])]),u(e(Se),{modelValue:I.value,"onUpdate:modelValue":s[0]||(s[0]=$=>I.value=$),onRefresh:E},{pulling:x(()=>[u(e(J),{size:"18"})]),loosing:x(()=>[u(e(J),{size:"18"})]),loading:x(()=>[u(e(J),{size:"18"})]),success:x(()=>[...s[2]||(s[2]=[a("span",null,null,-1)])]),default:x(()=>[u(S,{class:L(["home__body",{"is-revealed":e(g)}])},{default:x(()=>[u(ke,{quote:b.value,class:"home__rate reveal",style:R(e(w)(0))},null,8,["quote","style"]),N.value.length?(t(),U(Ae,{key:0,slides:N.value,class:"home__hero reveal",style:R(e(w)(1)),onSelect:W},null,8,["slides","style"])):k("",!0),e(h).cats.length?(t(),U(Ee,{key:1,categories:e(h).cats,"active-id":null,class:"home__rail reveal",style:R(e(w)(2)),onSelect:K},null,8,["categories","style"])):k("",!0),D.value?(t(),l("section",{key:2,class:"home__section reveal",style:R(e(w)(3))},[u(ae,{title:"برگزیده منتزر",subtitle:"انتخاب‌شده از میان مجموعه‌های موجود","action-label":"همه محصولات",onAction:n}),u(Q,{value:D.value,wide:"",badge:"برگزیده",onOpen:X},null,8,["value"]),C.value.length?(t(),l("div",st,[(t(!0),l(q,null,Y(C.value,$=>(t(),U(Q,{key:$.id,value:$,onOpen:X},null,8,["value"]))),128))])):k("",!0)],4)):k("",!0),H.value.length?(t(),l("section",{key:3,class:"home__section reveal",style:R(e(w)(4))},[u(ae,{title:"تازه‌ها",subtitle:"آخرین افزوده‌های مجموعه","action-label":"مشاهده همه",onAction:_}),a("div",at,[(t(!0),l(q,null,Y(H.value,$=>(t(),U(Q,{key:$.id,value:$,class:"home__reelItem",onOpen:X},null,8,["value"]))),128))])],4)):k("",!0),!P.value&&!y.value.length?(t(),l("section",{key:4,class:"home__empty reveal",style:R(e(w)(3))},[u(B,{icon:"vuesax-linear:box",size:"26"}),s[3]||(s[3]=a("p",null,"هنوز محصولی در مجموعه ثبت نشده است.",-1))],4)):k("",!0),a("div",{class:"home__trust reveal",style:R(e(w)(5))},[a("div",nt,[u(B,{icon:"vuesax-linear:shield-tick",size:"18"}),s[4]||(s[4]=a("span",null,"خرید امن",-1))]),a("div",ot,[u(B,{icon:"vuesax-linear:verify",size:"18"}),s[5]||(s[5]=a("span",null,"اصالت کالا",-1))]),a("div",lt,[u(B,{icon:"vuesax-linear:box-tick",size:"18"}),s[6]||(s[6]=a("span",null,"ارسال بیمه‌شده",-1))])],4)]),_:1},8,["class"])]),_:1},8,["modelValue"])])}}}),gt=T(it,[["__scopeId","data-v-a71098c1"]]);export{gt as default};