Files
tehran_tala/apps/user-app/dist/assets/HomeView-DX9UtqGS.js
T
2026-09-16 10:44:58 +03:30

2 lines
12 KiB
JavaScript

import{d as B,o as j,a as te,c as o,b as e,e as n,T as se,w as y,F as z,r as D,f as _,g as s,h as X,t as w,i as oe,I as $,v as ae,j as S,n as H,_ as R,u as i,k as ne,l as P,m as ie,p as le,q as G,s as V,L as E,x as ce}from"./index-LpTslFTX.js";import{u as re,S as ue}from"./SingleProduct-CMfHbqeB.js";import{R as de}from"./RateStrip-RPLfw8jP.js";import{u as _e,a as me}from"./cartStore-Bn8LqNla.js";import{S as T}from"./SectionHead-BJsD32x1.js";import{a as M}from"./client-WIBW0tF5.js";import{u as ve}from"./filtersStore-BaRlN7PZ.js";import{P as he}from"./index-DERXHV64.js";import{D as pe}from"./index-CMtTzxtO.js";import"./Spinner.vue_vue_type_style_index_0_lang-owEXFFto.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./NotifyVant.vue_vue_type_script_setup_true_lang-BIH_3pMT.js";import"./DialogVant.vue_vue_type_style_index_0_lang-CRaNJGid.js";import"./dialogEmpty1-E3h_JfwQ.js";import"./filters-CLL9nGZ2.js";import"./classCallCheck-BnV4Db3Z.js";const ge="/img/henza1.svg",fe={key:0,class:"showcase"},ye={class:"showcase__frame"},we=["src"],be={class:"showcase__copy"},Ce={class:"showcase__eyebrow"},ke={class:"showcase__title"},$e={class:"showcase__sub"},xe=["onClick"],Se={key:0,class:"showcase__dots"},Ie=["aria-label","onClick"],Ve=B({__name:"ShowcaseSlider",props:{slides:{}},emits:["select"],setup(a,{emit:d}){const l=a,x=d,m=S(0);let c;function p(C){m.value=C,v()}function v(){c&&clearInterval(c),l.slides.length>1&&(c=setInterval(()=>{m.value=(m.value+1)%l.slides.length},6e3))}return j(v),te(()=>{c&&clearInterval(c)}),(C,f)=>a.slides.length?(s(),o("section",fe,[e("div",ye,[n(se,{name:"showcase-fade",tag:"div",class:"showcase__stage"},{default:y(()=>[(s(!0),o(z,null,D(a.slides,(r,h)=>X((s(),o("article",{key:r.key,class:"showcase__slide"},[r.image?(s(),o("img",{key:0,src:r.image,alt:"",class:"showcase__art"},null,8,we)):_("",!0),f[0]||(f[0]=e("div",{class:"showcase__scrim","aria-hidden":"true"},null,-1)),e("div",be,[e("span",Ce,w(r.eyebrow),1),e("h2",ke,w(r.title),1),e("p",$e,w(r.subtitle),1),e("button",{type:"button",class:"showcase__cta",onClick:b=>x("select",r)},[oe(w(r.cta)+" ",1),n($,{icon:"vuesax-linear:arrow-left-2",size:"17"})],8,xe)])])),[[ae,h===m.value]])),128))]),_:1})]),a.slides.length>1?(s(),o("div",Se,[(s(!0),o(z,null,D(a.slides,(r,h)=>(s(),o("button",{key:r.key,type:"button",class:H(["showcase__dot",{"is-active":h===m.value}]),"aria-label":r.title,onClick:b=>p(h)},null,10,Ie))),128))])):_("",!0)])):_("",!0)}}),Pe=R(Ve,[["__scopeId","data-v-956829b0"]]),ze={class:"rail no-scrollbar"},De=["onClick"],Le={class:"rail__mark","aria-hidden":"true"},Fe=["src"],He={class:"rail__title"},Be=B({__name:"CategoryRail",props:{categories:{},activeId:{}},emits:["select"],setup(a,{emit:d}){const l=d;return(x,m)=>(s(),o("div",ze,[(s(!0),o(z,null,D(a.categories,c=>{var p;return s(),o("button",{key:c.id,type:"button",class:H(["rail__chip",{"is-active":c.id===a.activeId}]),onClick:v=>l("select",c)},[e("span",Le,[(p=c.icon)!=null&&p.image?(s(),o("img",{key:0,src:c.icon.image,alt:""},null,8,Fe)):_("",!0)]),e("span",He,w(c.title),1)],10,De)}),128))]))}}),Re=R(Be,[["__scopeId","data-v-c61b3098"]]),Ae={class:"card__art"},Ee=["alt"],qe={key:0,class:"card__badge"},Me={class:"card__body"},Ne={class:"card__title"},Oe={class:"card__meta"},Ue={class:"card__weight"},Ge={key:0,class:"card__wage"},Te=B({__name:"ShowcaseCard",props:{value:{},wide:{type:Boolean},badge:{}},emits:["open"],setup(a,{emit:d}){const l=a,x=d,m=re(),{image:c,id:p,title:v,min_gram:C,wage:f}=_e(l.value),r=P(()=>{const h=f.value;return h==null?"":h%1===0?String(h):h.toFixed(2)});return(h,b)=>{const L=ie("lazy");return s(),o("article",{class:H(["card",{"card--wide":a.wide}]),onClick:b[1]||(b[1]=I=>x("open",a.value))},[e("div",Ae,[X(e("img",{alt:i(v)},null,8,Ee),[[L,i(c)]]),e("button",{type:"button",class:H(["card__fav",{"is-on":i(m).isFavorite(i(p))}]),onClick:b[0]||(b[0]=ne(I=>i(m).toggle(i(p)),["stop"]))},[n($,{icon:i(m).isFavorite(i(p))?"vuesax-linear:heart-fill":"vuesax-linear:heart",size:"17"},null,8,["icon"])],2),a.badge?(s(),o("span",qe,w(a.badge),1)):_("",!0)]),e("div",Me,[e("h3",Ne,w(i(v)),1),e("div",Oe,[e("span",Ue,w(i(C))+" گرم",1),i(f)!=null?(s(),o("span",Ge,"اجرت "+w(r.value)+"٪",1)):_("",!0)])])],2)}}}),q=R(Te,[["__scopeId","data-v-43c92533"]]),je="/assets/shipping-and-delivery-CyUGL93q.png",Xe="/assets/sports-and-competition-ao926_SX.png",Y="data:image/svg+xml,%3csvg%20width='50'%20height='60'%20viewBox='0%200%2050%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M24.5418%2036.9838C24.35%2029.7584%2019.4608%2027.4767%2011.5039%2026.9062C19.2691%2026.621%2024.35%2023.959%2024.5418%2016.8286C24.7335%2024.0541%2029.7185%2026.7161%2037.5796%2026.9062C29.7185%2027.4767%2024.7335%2029.7584%2024.5418%2036.9838Z'%20fill='%238D6A46'/%3e%3cpath%20d='M11.1205%2024.7187V43.2577C11.1205%2049.3422%209.68252%2053.5254%206.99826%2055.9022C5.09894%2057.4716%202.8184%2058.5205%200.383466%2058.9445L0%2058.279C2.15045%2057.1267%203.84105%2055.2825%204.79333%2053.05C5.84786%2050.6733%206.32719%2047.4408%206.32719%2043.2577V5.13388C6.33048%204.54788%206.21314%203.96739%205.98237%203.42793C5.75159%202.88847%205.41223%202.40139%204.98506%201.99651C4.5579%201.5714%204.04974%201.23479%203.49016%201.00629C2.93057%200.77778%202.33075%200.661938%201.7256%200.665502H0.881972V0H16.5082V0.665502H15.5496C14.9804%200.654544%2014.415%200.758455%2013.8877%200.970921C13.3603%201.18339%2012.882%201.49997%2012.4818%201.90144C11.645%202.70812%2011.1337%203.78985%2011.0438%204.94373V23.3877'%20fill='%231F2E54'/%3e%3cpath%20d='M38.3472%2023.4834V5.03944C38.2934%203.87641%2037.7762%202.78216%2036.9092%201.99714C36.509%201.59567%2036.0307%201.27909%2035.5034%201.06662C34.976%200.854159%2034.4106%200.750247%2033.8415%200.761205H32.8828V0.0957031H48.5091V0.761205H47.6463C47.0384%200.762605%2046.437%200.88443%2045.8772%201.11953C45.3175%201.35462%2044.8108%201.69825%2044.3868%202.13024C43.9596%202.53513%2043.6203%203.02221%2043.3895%203.56167C43.1587%204.10113%2043.0414%204.68162%2043.0447%205.26761V43.3914C43.0447%2047.5745%2043.524%2050.807%2044.5785%2053.1838C45.5308%2055.4162%2047.2214%2057.2605%2049.3719%2058.4127L48.9884%2059.0782C46.5535%2058.6542%2044.2729%2057.6053%2042.3736%2056.0359C39.6893%2053.6591%2038.3472%2049.476%2038.2513%2043.3914V24.7193'%20fill='%231F2E54'/%3e%3c/svg%3e",Ye=[{type:"popup",src:je,text:"ارسال سریع و مطمئن سفارش‌های شما به سراسر کشور.",link:void 0},{type:"popup",src:Xe,text:"جدیدترین محصولات هنزاگلد را در بخش محصولات جدید ببینید.",link:void 0},{type:"popup",src:Y,text:"هنزاگلد، همراه شما در خرید و فروش طلا.",link:void 0}],Ze=le("config",{state:()=>({config:{main_slider:Ye},cats:[],loaded:!1}),actions:{setCats(a){this.cats=a},async init(){try{const a=await M.listProducts(),d=new Map;for(const l of a)l.category&&!d.has(l.category.id)&&d.set(l.category.id,{id:l.category.id,title:l.category.title,icon:{image:Y}});this.cats=[...d.values()],this.loaded=!0}catch(a){console.log(a)}}}}),Je={class:"home"},Ke={class:"home__bar"},Qe={class:"home__barInner"},We={key:0,class:"home__badge"},et={key:2,class:"home__section"},tt={key:0,class:"home__grid"},st={key:3,class:"home__section"},ot={class:"home__reel no-scrollbar"},at={key:4,class:"home__empty"},nt={class:"home__trust"},it={class:"home__trustItem"},lt={class:"home__trustItem"},ct={class:"home__trustItem"},rt=B({__name:"HomeView",setup(a){const d=ce(),l=Ze(),x=me(),m=ve(),c=S(!0),p=S(!1),v=S([]),C=S(null),f=S(!1),r=S(null),h=P(()=>v.value[0]??null),b=P(()=>v.value.slice(1,5)),L=P(()=>v.value.slice(5,13)),I=[{eyebrow:"مجموعه هنزا",cta:"دیدن مجموعه"},{eyebrow:"انتخاب سردبیر",cta:"مشاهده"},{eyebrow:"پیشنهاد این هفته",cta:"بررسی کنید"}],N=P(()=>{const u=l.cats.slice(0,3);return u.length?u.map((t,k)=>({key:t.id,eyebrow:I[k%I.length].eyebrow,title:t.title,subtitle:"ساخته‌شده از طلای ۱۸ عیار، با اجرت شفاف و اصالت تضمین‌شده.",cta:I[k%I.length].cta,image:Z(t.id),categoryId:t.id})):[]});function Z(u){var k,F;const t=v.value.find(g=>{var U;return((U=g.category)==null?void 0:U.id)===u});return(F=(k=t==null?void 0:t.images)==null?void 0:k[0])==null?void 0:F.url}function A(u){r.value=u.id,f.value=!0}function J(u){m.query.cats=[u.id],d.push({name:"search"})}function K(u){u.categoryId&&(m.query.cats=[u.categoryId]),d.push({name:"search"})}function Q(){d.push({name:"search"})}function W(){d.push({name:"newestProduct"})}async function O(){try{const[u]=await Promise.all([M.listProducts(),l.init()]);v.value=u}catch(u){console.log(u)}try{C.value=await M.getLatestGoldPrice()}catch{C.value=null}}async function ee(){await O(),p.value=!1}return j(async()=>{await O(),c.value=!1}),(u,t)=>{const k=G("router-link"),F=G("container");return s(),o("div",Je,[e("header",Ke,[e("div",Qe,[n(k,{to:{name:"cart"},class:"home__iconBtn","aria-label":"سبد خرید"},{default:y(()=>[n($,{icon:"vuesax-linear:bag-2",size:"21"}),i(x).items.length?(s(),o("span",We,w(i(x).items.length),1)):_("",!0)]),_:1}),t[3]||(t[3]=e("img",{src:ge,alt:"هنزاگلد",class:"home__logo"},null,-1)),n(k,{to:{name:"search"},class:"home__iconBtn","aria-label":"جستجو"},{default:y(()=>[n($,{icon:"vuesax-linear:search-normal-1",size:"21"})]),_:1})])]),n(i(he),{modelValue:p.value,"onUpdate:modelValue":t[0]||(t[0]=g=>p.value=g),onRefresh:ee},{pulling:y(()=>[n(i(E),{size:"18"})]),loosing:y(()=>[n(i(E),{size:"18"})]),loading:y(()=>[n(i(E),{size:"18"})]),success:y(()=>[...t[4]||(t[4]=[e("span",null,null,-1)])]),default:y(()=>[n(F,{class:"home__body"},{default:y(()=>[n(de,{quote:C.value,class:"home__rate"},null,8,["quote"]),N.value.length?(s(),V(Pe,{key:0,slides:N.value,class:"home__hero",onSelect:K},null,8,["slides"])):_("",!0),i(l).cats.length?(s(),V(Re,{key:1,categories:i(l).cats,"active-id":null,class:"home__rail",onSelect:J},null,8,["categories"])):_("",!0),h.value?(s(),o("section",et,[n(T,{title:"برگزیده هنزا",subtitle:"انتخاب‌شده از میان مجموعه‌های موجود","action-label":"همه محصولات",onAction:Q}),n(q,{value:h.value,wide:"",badge:"برگزیده",onOpen:A},null,8,["value"]),b.value.length?(s(),o("div",tt,[(s(!0),o(z,null,D(b.value,g=>(s(),V(q,{key:g.id,value:g,onOpen:A},null,8,["value"]))),128))])):_("",!0)])):_("",!0),L.value.length?(s(),o("section",st,[n(T,{title:"تازه‌ها",subtitle:"آخرین افزوده‌های مجموعه","action-label":"مشاهده همه",onAction:W}),e("div",ot,[(s(!0),o(z,null,D(L.value,g=>(s(),V(q,{key:g.id,value:g,class:"home__reelItem",onOpen:A},null,8,["value"]))),128))])])):_("",!0),!c.value&&!v.value.length?(s(),o("section",at,[n($,{icon:"vuesax-linear:box",size:"26"}),t[5]||(t[5]=e("p",null,"هنوز محصولی در مجموعه ثبت نشده است.",-1))])):_("",!0),e("div",nt,[e("div",it,[n($,{icon:"vuesax-linear:shield-tick",size:"18"}),t[6]||(t[6]=e("span",null,"خرید امن",-1))]),e("div",lt,[n($,{icon:"vuesax-linear:verify",size:"18"}),t[7]||(t[7]=e("span",null,"اصالت کالا",-1))]),e("div",ct,[n($,{icon:"vuesax-linear:box-tick",size:"18"}),t[8]||(t[8]=e("span",null,"ارسال بیمه‌شده",-1))])])]),_:1})]),_:1},8,["modelValue"]),n(i(pe),{visible:f.value,"onUpdate:visible":t[2]||(t[2]=g=>f.value=g),placement:"bottom",closable:!1,class:"rtl",height:"100vh",bodyStyle:{padding:0,position:"relative"}},{default:y(()=>[r.value?(s(),V(ue,{key:0,id:r.value,onCloseDrawer:t[1]||(t[1]=g=>f.value=!1)},null,8,["id"])):_("",!0)]),_:1},8,["visible"])])}}}),St=R(rt,[["__scopeId","data-v-8c647343"]]);export{St as default};