index-4d77877a.js 5.6 KB

1
  1. import{c as L,b as j,n as J,d as B,r as S,x as N,u as q,e as D,Y as O,Z as G,f as F,_ as I,a as o,$ as Q,p as z,a0 as H,a1 as X,k as K,q as Z,y as _,A as v,I as $,C as V,a2 as ee,a3 as te,V as se,D as x,E as ae}from"./index-521a9826.js";import{s as d}from"./index.module-12f0c168.js";import{M as oe}from"./index-c0ea6da9.js";import{L as ie}from"./index-b1810e0a.js";import{C as ne}from"./index-1ad6a58d.js";import{T as le}from"./index-544f4e19.js";import"./index-fdaad3c0.js";import"./use-tab-status-da6d8e9f.js";const[re,E]=L("swipe-cell"),ce={name:j(""),disabled:Boolean,leftWidth:J,rightWidth:J,beforeClose:Function,stopPropagation:Boolean};var ue=B({name:re,props:ce,emits:["open","close","click"],setup(a,{emit:t,slots:h}){let r,c,p;const i=S(),s=S(),f=S(),n=N({offset:0,dragging:!1}),g=q(),k=e=>e.value?Q(e).width:0,m=D(()=>O(a.leftWidth)?+a.leftWidth:k(s)),C=D(()=>O(a.rightWidth)?+a.rightWidth:k(f)),y=e=>{n.offset=e==="left"?m.value:-C.value,r||(r=!0,t("open",{name:a.name,position:e}))},A=e=>{n.offset=0,r&&(r=!1,t("close",{name:a.name,position:e}))},Y=e=>{const l=Math.abs(n.offset),u=.15,W=r?1-u:u,P=e==="left"?m.value:C.value;P&&l>P*W?y(e):A(e)},M=e=>{a.disabled||(p=n.offset,g.start(e))},U=e=>{if(a.disabled)return;const{deltaX:l}=g;g.move(e),g.isHorizontal()&&(c=!0,n.dragging=!0,(!r||l.value*p<0)&&z(e,a.stopPropagation),n.offset=H(l.value+p,-C.value,m.value))},T=()=>{n.dragging&&(n.dragging=!1,Y(n.offset>0?"left":"right"),setTimeout(()=>{c=!1},0))},w=(e="outside")=>{t("click",e),r&&!c&&X(a.beforeClose,{args:[{name:a.name,position:e}],done:()=>A(e)})},b=(e,l)=>u=>{l&&u.stopPropagation(),w(e)},R=(e,l)=>{const u=h[e];if(u)return o("div",{ref:l,class:E(e),onClick:b(e,!0)},[u()])};return G({open:y,close:A}),F(i,()=>w("outside"),{eventName:"touchstart"}),I("touchmove",U,{target:i}),()=>{var e;const l={transform:`translate3d(${n.offset}px, 0, 0)`,transitionDuration:n.dragging?"0s":".6s"};return o("div",{ref:i,class:E(),onClick:b("cell",c),onTouchstartPassive:M,onTouchend:T,onTouchcancel:T},[o("div",{class:E("wrapper"),style:l},[R("left",s),(e=h.default)==null?void 0:e.call(h),R("right",f)])])}}});const de=K(ue),fe="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 he(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!te(a)}const ke=B({name:"shop-address",setup(){const a=Z(),t=N({isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},selectItem:{}}),h=({position:i},s)=>{if(i==="right")se({title:"确定删除吗?",confirmButtonColor:"#FF8021"}).then(async()=>(await x.post("/edu-app/userReceiveAddress/remove",{requestType:"form",data:{id:s.id}}),setTimeout(()=>{ae("删除成功")},100),setTimeout(()=>{t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,c()},1100),!0));else return!0},r=i=>{a.push({path:"/addressOperation",query:{id:i.id}})},c=async()=>{try{if(t.isClick)return;t.isClick=!0;const i=await x.post("/edu-app/userReceiveAddress/page",{data:{...t.params}});t.listState.loading=!1;const s=i.data||{};if(t.list.length>0&&s.current===1)return;t.list=t.list.concat(s.rows||[]),t.listState.finished=s.current>=s.pages,t.params.page=s.current+1,t.listState.dataShow=t.list.length>0,t.isClick=!1}catch(i){t.listState.dataShow=!1,t.listState.finished=!0,t.isClick=!1}},p=i=>{sessionStorage.setItem("addressDetails",JSON.stringify(i)),a.back()};return _(()=>{c()}),()=>{let i;return o("div",{class:[d.shopAddress]},[t.listState.dataShow?o(ie,{finished:t.listState.finished,finishedText:" ",class:[d.liveList],onLoad:c,immediateCheck:!1},he(i=t.list.map(s=>o(de,{class:d.swipeCell,beforeClose:f=>h(f,s)},{default:()=>o(ne,{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(le,{plain:!0,color:"#FF8057"},{default:()=>[v("默认")]})]),label:()=>o("div",{class:d.content},[s.provinceName,s.cityName,s.regionName,s.detailAddress]),"right-icon":()=>o($,{name:fe,size:"18",onClick:f=>{f.stopPropagation(),r(s)}},null)}),right:()=>o(V,{type:"danger"},{default:()=>[v("删除")]})})))?i:{default:()=>[i]}):o("div",{style:{"min-height":"calc(100vh - var(--header-height))",display:"flex","align-items":"center"}},[o(ee,{description:"暂无收货地址"},null)]),o(oe,{position:"bottom"},{default:()=>[o("div",{class:"btnGroup"},[o(V,{type:"primary",round:!0,block:!0,class:d.createBtn,onClick:()=>{a.push("addressOperation")}},{default:()=>[v("新建收货地址")]})])]})])}}});export{ke as default};