index.3ab6a6a2.js 5.6 KB

1
  1. import{s as d}from"./index.module.08b7a095.js";import{O as L}from"./index.b491c24a.js";import{t as j,w as G,z as J,d as V,R as S,r as W,aq as M,y as O,a1 as D,W as z,as as Q,a0 as H,c as o,an as I,a4 as F,aU as X,aR as K,D as Z,ag as _,$,q as v,a5 as tt,B as N,ak as et,al as st,b9 as at,m as U,o as ot}from"./index.1c621181.js";import{L as nt}from"./index.d5ee0b18.js";import{C as it}from"./index.fd5ae97b.js";import{T as lt}from"./index.4e64eb97.js";import"./use-tab-status.40058c51.js";const[rt,k]=j("swipe-cell"),ct={name:G(""),disabled:Boolean,leftWidth:J,rightWidth:J,beforeClose:Function,stopPropagation:Boolean};var ut=V({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=W({offset:0,dragging:!1}),g=M(),E=t=>t.value?I(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}))},B=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)&&F(t,a.stopPropagation),i.offset=X(l.value+p,-C.value,m.value))},T=()=>{i.dragging&&(i.dragging=!1,B(i.offset>0?"left":"right"),setTimeout(()=>{c=!1},0))},y=(t="outside")=>{e("click",t),r&&!c&&K(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 z({open:w,close:A}),Q(n,()=>y("outside"),{eventName:"touchstart"}),H("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=Z(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]"&&!st(a)}var kt=V({name:"shop-address",setup(){const a=_(),e=W({isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},selectItem:{}}),h=({position:n},s)=>{if(n==="right")at({title:"\u786E\u5B9A\u5220\u9664\u5417\uFF1F"}).then(async()=>(await U.post("/api-student/userReceiveAddress/remove",{requestType:"form",data:{id:s.id}}),setTimeout(()=>{ot("\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 U.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(tt,{name:ft,size:"18",onClick:f=>{f.stopPropagation(),r(s)}},null)}),right:()=>o(N,{type:"danger"},{default:()=>[v("\u5220\u9664")]})})))?n:{default:()=>[n]}):o(et,{btnStatus:!1,tips:"\u6682\u65E0\u6536\u8D27\u5730\u5740"},null),o(L,{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};