index.e493db9e.js 5.6 KB

1
  1. import{t as L,w as j,z as J,d as W,R as S,r as B,aq as G,y as O,a1 as D,W as M,as as z,a0 as Q,c as o,an as H,a4 as I,aZ as F,aR as X,D as K,ag as Z,$ as _,q as v,a5 as $,B as N,ak as tt,al as et,bd as st,m as V,o as at}from"./index.5f7ffb46.js";import{s as d}from"./index.module.08b7a095.js";import{O as ot}from"./index.7790de2a.js";import{L as nt}from"./index.9ef28852.js";import{C as it}from"./index.abd668f7.js";import{T as lt}from"./index.ab2541bb.js";import"./use-tab-status.69b57a37.js";const[rt,k]=L("swipe-cell"),ct={name:j(""),disabled:Boolean,leftWidth:J,rightWidth:J,beforeClose:Function,stopPropagation:Boolean};var ut=W({name:rt,props:ct,emits:["open","close","click"],setup(a,{emit:e,slots:h}){let r,c,p;const n=S(),s=S(),f=S(),i=B({offset:0,dragging:!1}),g=G(),E=t=>t.value?H(t).width:0,m=O(()=>D(a.leftWidth)?+a.leftWidth:E(s)),C=O(()=>D(a.rightWidth)?+a.rightWidth:E(f)),w=t=>{i.offset=t==="left"?m.value:-C.value,r||(r=!0,e("open",{name:a.name,position:t}))},A=t=>{i.offset=0,r&&(r=!1,e("close",{name:a.name,position:t}))},U=t=>{const l=Math.abs(i.offset),u=.15,x=r?1-u:u,P=t==="left"?m.value:C.value;P&&l>P*x?w(t):A(t)},Y=t=>{a.disabled||(p=i.offset,g.start(t))},q=t=>{if(a.disabled)return;const{deltaX:l}=g;g.move(t),g.isHorizontal()&&(c=!0,i.dragging=!0,(!r||l.value*p<0)&&I(t,a.stopPropagation),i.offset=F(l.value+p,-C.value,m.value))},T=()=>{i.dragging&&(i.dragging=!1,U(i.offset>0?"left":"right"),setTimeout(()=>{c=!1},0))},y=(t="outside")=>{e("click",t),r&&!c&&X(a.beforeClose,{args:[{name:a.name,position:t}],done:()=>A(t)})},R=(t,l)=>u=>{l&&u.stopPropagation(),y(t)},b=(t,l)=>{const u=h[t];if(u)return o("div",{ref:l,class:k(t),onClick:R(t,!0)},[u()])};return M({open:w,close:A}),z(n,()=>y("outside"),{eventName:"touchstart"}),Q("touchmove",q,{target:n}),()=>{var t;const l={transform:`translate3d(${i.offset}px, 0, 0)`,transitionDuration:i.dragging?"0s":".6s"};return o("div",{ref:n,class:k(),onClick:R("cell",c),onTouchstartPassive:Y,onTouchend:T,onTouchcancel:T},[o("div",{class:k("wrapper"),style:l},[b("left",s),(t=h.default)==null?void 0:t.call(h),b("right",f)])])}}});const dt=K(ut);var ft="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAA15JREFUWEft2E+ME2UYx/HvMxJhu0ZMWJAbwUTihRgucjDKn13+XEhQsp0uRuPJRDkAwSgK275Tl4UTSmIkcPK2O2nCv10SE9iEg9EDF8GDR5EEhXQPBg7ALjuPmXa2NLXzr50mHJhT23n7vp/+5nneaSs8Y4f0yqPGfh/kS9A3gX+BCzz2RuV4pRq1Zk9A6hQMqqU2C9/iibdVxip/hqEyB6nJl0FGGwsq1xHWAgPBa3/xxNsShsoUpE6+jDYwHsJnUnLPqBkZQLyrKP7l849QVGYgNYVvQI8GC3pYfCpF9+xiUjr+3grmX5yJQ2UCUmOPAUfCMJEo9d4Vp3J7cUzXoKSYCNQvYty3MwGpyR8D+ToumdaOql++pb+i+nr9nLdBTOU3/1HHCXWKaSRVtg/jcTx4vkeMe65jkJrCOOhXaZNpYMzHy+DhNWBj7TWLt6ToXu8IpE5hHO0Cc3C4j+VyEWRbDSPcoOhuEEFTg9TYfsSHO07Gx7zywkVUFzFV5tkkY+4fqYs6E8xy6xIwFCRTRa0hMRM3m4s+UVGryZ+o3yjrLdG66bV20f+66uRwH/ebMDAL1mArJtElU6cwimq5S8wUMBjMEYqJBakzsg31fqr1QafJPLCm0GSYSJCazUvg1d+BN4JPdkiMezLu8jxt7V056JsC2ZokmdiiVpPfDXK+PlCuiJncng7TPwWaChOTkD0BFGoI9d4Rp/JzEpCaXTk0N42wJU0yCRKybwFrEO5JyV2dGCO5abQzTGhC9fpZNQfibwszYtz63hFx1JIhdxnY3EjGYkiK7o249zafb7sPqRleDdY/Qf1MiJncG4n5/MN+Xpqb7hYTnlB5eD2eVd9BhVNScg+EgdR88DIsXALd1E0ykTWkTmEQ1asB6KiU3GPtQMG4H4B1WWAiasj2u8vvMj+hL5hnmiW6EmElC7IKS14D3QGsb4LexWJn2ppp/aDta8jJ70Pl+xTFOAPykZjJv1O8p+3Q9qCivR+L72ImnwO9gqenpVzxuyuTI6TLRgbAOwWsoHZnpopKFQv/Z/AsunAH+m+K+fFRJoqmSRJ9/ch60aj5noPi0n72Egq+K/s78bI4fY/PPwL5VtTYfucs/lXS4zVjp58VdQo26n0CsjR2eE8H6GPEOvsf2eN7gbiHuWgAAAAASUVORK5CYII=";function ht(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!et(a)}var kt=W({name:"shop-address",setup(){const a=Z(),e=B({isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},selectItem:{}}),h=({position:n},s)=>{if(n==="right")st({title:"\u786E\u5B9A\u5220\u9664\u5417\uFF1F"}).then(async()=>(await V.post("/api-student/userReceiveAddress/remove",{requestType:"form",data:{id:s.id}}),setTimeout(()=>{at("\u5220\u9664\u6210\u529F")},100),setTimeout(()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,c()},1100),!0));else return!0},r=n=>{a.push({path:"/addressOperation",query:{id:n.id}})},c=async()=>{try{if(e.isClick)return;e.isClick=!0;const n=await V.post("/api-student/userReceiveAddress/page",{data:{...e.params}});e.listState.loading=!1;const s=n.data||{};if(e.list.length>0&&s.current===1)return;e.list=e.list.concat(s.rows||[]),e.listState.finished=s.current>=s.pages,e.params.page=s.current+1,e.listState.dataShow=e.list.length>0,e.isClick=!1}catch{e.listState.dataShow=!1,e.listState.finished=!0,e.isClick=!1}},p=n=>{sessionStorage.setItem("addressDetails",JSON.stringify(n)),a.back()};return _(()=>{c()}),()=>{let n;return o("div",{class:[d.shopAddress,!e.listState.dataShow&&"emptyRootContainer"]},[e.listState.dataShow?o(nt,{finished:e.listState.finished,finishedText:" ",class:[d.liveList],onLoad:c,immediateCheck:!1},ht(n=e.list.map(s=>o(dt,{class:d.swipeCell,beforeClose:f=>h(f,s)},{default:()=>o(it,{center:!0,onClick:()=>p(s)},{title:()=>o("div",{class:d.title},[o("span",{class:d.name},[s.name]),o("span",{class:d.phone},[s.phoneNumber]),s.defaultStatus&&o(lt,{round:!0,color:"#FF8057"},{default:()=>[v("\u9ED8\u8BA4")]})]),label:()=>o("div",{class:d.content},[s.provinceName,s.cityName,s.regionName,s.detailAddress]),"right-icon":()=>o($,{name:ft,size:"18",onClick:f=>{f.stopPropagation(),r(s)}},null)}),right:()=>o(N,{type:"danger"},{default:()=>[v("\u5220\u9664")]})})))?n:{default:()=>[n]}):o(tt,{btnStatus:!1,tips:"\u6682\u65E0\u6536\u8D27\u5730\u5740"},null),o(ot,{position:"bottom"},{default:()=>[o("div",{class:"btnGroup"},[o(N,{type:"primary",round:!0,block:!0,onClick:()=>{a.push("addressOperation")}},{default:()=>[v("\u65B0\u5EFA\u6536\u8D27\u5730\u5740")]})])]})])}}});export{kt as default};