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