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

2 lines
14 KiB
JavaScript
Raw Normal View History

import{d as be,ah as Re,a as me,i as l,c as n,b as t,n as qe,F as W,r as Q,t as u,f as r,B as Ve,e as $,ai as ve,g as C,h as o,_ as ke,q as Me,m as Be,H as _e,D as Fe,u as z,x as A,s as B,k as v,I as f,E as P,aj as De,j as pe,T as Ue,y as Ae,O as Le,v as Ne}from"./index-CRQPRp-C.js";import{a as Xe}from"./Spinner.vue_vue_type_style_index_0_lang-uVHC4xq0.js";import{_ as je}from"./DialogVant.vue_vue_type_style_index_0_lang-DFKmWR5Z.js";import{a as Ee,i as Ge,u as We}from"./cartStore-CIlq1T4-.js";import{l as Qe}from"./dialogEmpty1-E3h_JfwQ.js";const He=["src","alt"],Je={key:0,class:"gs__counter"},fe=.18,Ke=6,Ye=be({__name:"GallerySlider",props:ve({slides:{},alt:{},fit:{default:"cover"},showCounter:{type:Boolean,default:!1}},{index:{default:0},indexModifiers:{}}),emits:ve(["tap"],["update:index"]),setup(_,{emit:I}){const w=_,y=Re(_,"index"),S=I,F=o(()=>w.fit==="contain"?"gs__img--contain":"gs__img--cover"),p=C(null),k=C(!1),b=C(0);let d=null,R=0,c=0;function H(i){var T;if(w.slides.length<2||d!==null)return;const g=p.value;g&&(d=i.pointerId,R=i.clientX,c=g.getBoundingClientRect().width||1,b.value=0,k.value=!0,(T=g.setPointerCapture)==null||T.call(g,i.pointerId))}function J(i){!k.value||i.pointerId!==d||(b.value=i.clientX-R)}function L(){if(!k.value)return;const i=b.value,g=i/c;k.value=!1,d=null,b.value=0,g<=-fe&&y.value<w.slides.length-1?y.value++:g>=fe&&y.value>0&&y.value--,Math.abs(i)<=Ke&&S("tap")}function m(i){i.pointerId===d&&L()}function N(i){i.pointerId===d&&(k.value=!1,d=null,b.value=0)}function D(){}function X(i){y.value=i}const O=o(()=>{const i=-y.value*100,g=c?b.value/c*100:0;return{transform:`translate3d(${i+g}%, 0, 0)`,transition:k.value?"none":void 0}});return me(()=>{if(d!==null&&p.value)try{p.value.releasePointerCapture(d)}catch{}}),(i,g)=>(l(),n("div",{ref_key:"root",ref:p,class:$(["gs",{"is-dragging":k.value}]),onPointerdown:H,onPointermove:J,onPointerup:m,onPointercancel:N,onClick:D},[t("div",{class:"gs__track",style:qe(O.value)},[(l(!0),n(W,null,Q(_.slides,T=>(l(),n("div",{key:T,class:"gs__cell"},[t("img",{src:T,alt:_.alt,class:$(["gs__img",F.value]),draggable:"false"},null,10,He)]))),128))],4),_.showCounter&&_.slides.length>1?(l(),n("div",Je,u(y.value+1)+"/"+u(_.slides.length),1)):r("",!0),Ve(i.$slots,"dots",{index:y.value,go:X},void 0,!0)],34))}}),ge=ke(Ye,[["__scopeId","data-v-0e0334e8"]]);function Ze(_){const I=C(!1),w=C(!1),y=C(!1),S=C(null);return{loading:I,flag:w,notFound:y,productRef:S,load:async()=>{I.value=!0;try{const k=(await Me.listProducts()).find(b=>b.id===_)??null;S.value=k,y.value=!k,w.value=!0}catch(p){console.log(p)}finally{I.value=!1}}}}const et=Be("favorites",{state:()=>({ids:[]}),actions:{toggle(_){const I=this.ids.indexOf(_);I===-1?this.ids.push(_):this.ids.splice(I,1)},isFavorite(_){return this.ids.includes(_)}}});function tt(){return localStorage.getItem("appToken")}const st={class:"pd"},lt={class:"pd__gallery"},at={key:0,class:"pd__counter"},nt={key:1,class:"pd__dots"},ot=["aria-label","onClick"],it={key:1,class:"pd__stage pd__stage--empty"},ut={class:"pd__sheet"},rt={class:"pd__head"},dt={class:"pd__headMain"},ct={class:"pd__title"},vt={class:"pd__sub"},_t={key:0,class:"pd__code"},pt={key:1,class:"pd__dotSep"},ft={key:2},gt={class:"pd__figures"},yt={class:"pd__figure"},bt={class:"pd__figureValue"},mt={key:0,class:"pd__figure"},kt={class:"pd__figureValue"},ht={key:0,class:"pd__block"},xt={class:"pd__variants"},Ct=["disabled","onClick"],wt=["src","alt"],Pt={class:"pd__variantTitle"},It={class:"pd__variantWeight"},Tt={class:"pd__block"},$t={class:"pd__specs"},St={class:"pd__spec"},Ot={key:0,class:"pd__spec"},zt={key:1,class:"pd__spec"},Rt={key:2,class:"pd__spec"},qt={key:3,class:"pd__spec"},Vt={key:1,class:"pd__block"},Mt={class:"pd__trust"},Bt={class:"pd__bar"},Ft={key:0,class:"pd__qty"},Dt=["disabled"],Ut={class:"pd__qtyValue"},At=["aria-label"],Lt=["disabled"],Nt={key:0,class:"pd__previewCounter"},Xt={key:1,class:"pd__previewThumbs no-scrollbar"},jt=["aria-label","onClick"],Et=["src","alt"],Gt=["src"],ye=6,Wt=be({__name:"SingleProduct",props:{id:{}},emits:["closeDrawer"],setup(_,