Files
tehran_tala/apps/user-app-v2/dist/assets/SingleProduct-CDKWZbYq.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

import{g as _,m as de,d as ze,E as qe,B as $e,u as f,j as Q,q as x,e as r,f as a,b as t,i as C,l as u,t as n,I as d,c as o,n as Ie,F as W,r as G,C as b,v as Fe,h as l,s as Oe,_ as Re}from"./index-CmYEpHK9.js";import{a as Ve}from"./Spinner.vue_vue_type_style_index_0_lang-CvgYqzhC.js";import{_ as De}from"./NotifyVant.vue_vue_type_script_setup_true_lang-jgMMdODO.js";import{_ as Be}from"./DialogVant.vue_vue_type_style_index_0_lang-D7yryjTd.js";import{a as Ee,u as Le}from"./cartStore-DSCChC_v.js";import{a as Me}from"./client-WIBW0tF5.js";import{l as Xe}from"./dialogEmpty1-Caw7F5KL.js";function Ne(y){const m=_(!1),h=_(!1),q=_(!1),k=_(null);return{loading:m,flag:h,notFound:q,productRef:k,load:async()=>{m.value=!0;try{const v=(await Me.listProducts()).find(L=>L.id===y)??null;k.value=v,q.value=!v,h.value=!0}catch(V){console.log(V)}finally{m.value=!1}}}}const je=de("favorites",{state:()=>({ids:[]}),actions:{toggle(y){const m=this.ids.indexOf(y);m===-1?this.ids.push(y):this.ids.splice(m,1)},isFavorite(y){return this.ids.includes(y)}}}),ue={colors:[],brands:[],ciny_id:[],limit_percent:[],limit_gram:[],has_discount:!1,text:void 0,cats:void 0,page:0},Ae=de("filters",{state:()=>({query:{...ue}}),actions:{reset(){this.query={...ue}}}});function He(){return localStorage.getItem("appToken")}const Ue={class:"pd__controls"},Qe={class:"pd__headerTitle"},We={class:"pd__controlsEnd"},Ge={key:0,class:"pd__roundBadge"},Je={class:"pd__gallery"},Ke=["src","alt"],Ye={key:0,class:"pd__rail"},Ze=["aria-label","onClick"],et={key:1,class:"pd__stage pd__stage--empty"},tt={class:"pd__scroll"},st={class:"pd__sheet"},lt={class:"pd__eyebrow"},at={class:"pd__eyebrowText"},ot={class:"pd__head"},nt={class:"pd__headMain"},it={class:"pd__title"},ut={key:0,class:"pd__code"},rt={class:"pd__figures"},dt={class:"pd__figure"},ct={class:"pd__figureValue"},vt={key:0,class:"pd__figure pd__figure--accent"},_t={class:"pd__figureValue"},pt={key:0,class:"pd__chips no-scrollbar"},gt=["onClick"],ft={key:1,class:"pd__block"},yt={class:"pd__block"},mt={class:"pd__specs"},bt={class:"pd__spec"},ht={key:0,class:"pd__spec"},kt={key:1,class:"pd__spec"},xt={key:2,class:"pd__spec"},Ct={key:3,class:"pd__spec"},St={class:"pd__bar"},Tt={key:0,class:"pd__qty"},Pt=["aria-label"],wt={class:"pd__qtyValue"},zt={class:"pd__pillText"},qt=["disabled"],$t=["src"],It=56,re=48,Ft=ze({__name:"SingleProduct",props:{id:{}},emits:["closeDrawer"],setup(y,{emit:m}){const h=y,q=m,k=Fe(),R=je(),V=Ae(),v=Ee(),L=()=>{q("closeDrawer"),k.currentRoute.value.name==="singleProduct"&&k.back()},M=_(!1),D=_(!1),g=_(0),B=_(!1),J=_(null),K=_(!1);function ce(){var O;const s=J.value;if(!s)return;const e=((O=s.querySelector(".pd__gallery"))==null?void 0:O.clientHeight)??0;K.value=s.scrollTop>Math.max(e-It,0)}const c=Ne(h.id),ve=c.loading,_e=c.flag,Y={id:h.id,title:"",description:null,variants:[],images:[],category:null,brand:null,collections:[]},p=l(()=>Le(c.productRef.value??Y)),Z=l(()=>p.value.id.value),X=l(()=>p.value.title.value),ee=l(()=>p.value.productCode.value),N=l(()=>p.value.variants.value),$=l({get:()=>p.value.selectedVariant.value,set:s=>p.value.selectedVariant.value=s}),te=l(()=>p.value.min_gram.value),j=l(()=>p.value.wage.value),A=l(()=>p.value.qty.value),se=l(()=>p.value.isPreOrder.value),H=l(()=>p.value.is_exist.value),U=l(()=>{var s;return((s=c.productRef.value)==null?void 0:s.description)??""}),pe=l(()=>U.value.length>120),le=l(()=>{var s,e;return((e=(s=c.productRef.value)==null?void 0:s.category)==null?void 0:e.id)??""}),I=l(()=>{var s,e;return((e=(s=c.productRef.value)==null?void 0:s.category)==null?void 0:e.title)??""}),ae=l(()=>{var s,e;return((e=(s=c.productRef.value)==null?void 0:s.brand)==null?void 0:e.title)??""}),ge=l(()=>{var s;return(((s=c.productRef.value)==null?void 0:s.images.length)??0)>0}),S=l(()=>{var s;return((s=c.productRef.value)==null?void 0:s.images.map(e=>e.url))??[]});qe(S,s=>{g.value>s.length-1&&(g.value=0)});const F=_(0),T=_(!1);let oe=0;const fe=l(()=>T.value?`calc(${g.value*100}% + ${F.value}px)`:`${g.value*100}%`);function ye(s){S.value.length<2||(oe=s.touches[0].clientX,F.