import{s as e,C as a}from"./index.b02432d8.js";import{d as n,D as o,T as s,b as t,q as i,B as r,j as h}from"./vendor.2bcdc9cf.js";import{r as l,C as m}from"./index.3619a7ff.js";import{a as V}from"./address.6eabc372.js";var p="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAmCAMAAACbFsmhAAAAAXNSR0IArs4c6QAAAS9QTFRFAAAAAAAAQEBAQEBAYGBgVVVVTU1NRkZGTk5OSUlJUVFRTU1NSUlJVVVVTk5OTExMTU1NUVFRT09PU1NTUVFRUFBQUlJSUFBQUVFRUlJSUFBQUlJSUVFRUlJSUFBQUlJSUVFRUFBQUVFRUVFRUlJSUlJSUFBQUVFRUFBQUVFRUVFRUVFRUlJSUVFRUlJSUlJSUFBQUFBQUVFRUVFRUFBQUlJSUVFRUVFRUVFRUFBQUVFRUVFRUVFRUlJSUVFRUFBQUVFRUVFRUFBQUlJSUVFRUlJSUVFRUFBQUVFRUVFRUVFRUlJSUVFRUVFRUlJSUlJSUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUFBQUVFRUVFRUVFRUVFRUFBQUVFRUVFRt+udDwAAAGR0Uk5TAAEECAgJCgsNDhMUFRgaHiEpLS4vMDU2PD5DREVLUFFSU1hlZmdpa29ydXh6e32AgoOEhYaGh4iLj5CYm5ykpaanqK+0uLq7vL2+vr/AxcjJytDS19na3+Dn6Onq6+v4+f3+/tcaOFUAAAETSURBVDjL3dPHUgJBEIDhFhOyBjArBsw55ywGXLNiwhXQlf/9n8GDS7FsmPHsf+qp+g5dNdUigaUePq29ZlG2BMBbXGWWgccC5OJKY0+IkVWpFbDHRSSmUKuOcVSb2vyquwCz5jIisVfo0hiROUh5zbrH1N1Dt8dseEx9BrI11WYzwOQTGnMB+Y5qsxVgCh6z6DWm3wzYehN5hhnXu+HSb2QIMjojaeh1masgIzksl7mGot9EvjEr5gaKnf6/b4Hj8twYYqQddp2x6TbESD8sONNLmJFRmE30jUxuPwHvwUamqGS2hhzIdFl8nQ2GXppxdH64Mz823FMr/6vkyammdFI+0GbJfklnSgciUUNT9G97/wC7I3bdIhJGhwAAAABJRU5ErkJggg==",S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAAXNSR0IArs4c6QAAAPNQTFRFAAAAAAAARkZGVVVVTk5OSUlJUFBQWlpaUVFRTk5OTExMVVVVUFBQTU1NUFBQU1NTU1NTUVFRUlJSUFBQUVFRTk5OUlJSUFBQUVFRUVFRUFBQUVFRUFBQUlJSUlJSU1NTUVFRUVFRUlJSUlJSUFBQUVFRUVFRUlJSUFBQUVFRUFBQUlJSUlJSUlJSUlJSUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUFBQUVFRUVFRUFBQUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUFBQUVFRUVFRUVFRUFBQUVFRUVFRUVFRUFBQUVFRUVFRUVFRUVFRcjP+dgAAAFB0Uk5TAAELDA0OEBEWGhsbICEjJS4vNTY/QUFDRUhJUlNUV1xeYWNkbG5yc4+RkpOVlpmanqCpqrG0t7m7v8DOz9HS1Nnc5+3u7/Dx9PX3+Pv7/P7dnb/OAAAA00lEQVQ4y+2TxQ4CMRRFi7u7u7u7Dq73/7+GdAikMwMhJLCCszl5r6fdlZAbkfEBDMdJlEhIQ0JG3Cg3WFVyDOUltipR5ATiwk0McIoiP+ATbnyA/63Inc1TmkAzL+C+yboIh5dwpHZ61Zxq5MMYEmrejoCMSha086M8rGWiPqpUmj0C1CHs+Esl9JhoijaVBUhSpwAzdQuzf/RzkWJx9lB7z5z8aUT01uts05HnkYhvRUOMHkUDjJmpAHRzEjpAkYl088efd65nHzbWV9Jk3TBdTy/uwn7sp9f1zwAAAABJRU5ErkJggg==",J=n({name:"address-list",data(){return{dataShow:!0,list:[]}},async mounted(){try{const{data:U}=await l.get("/api-mall-portal/member/address/list");this.list=U,this.dataShow=this.list.length>0}catch{}},methods:{onEdit(U,F){U.stopPropagation(),this.$router.push({path:"/editAddress",query:{id:F==null?void 0:F.id}})},async onDelete(U,F){U.stopPropagation();try{o.confirm({title:"\u63D0\u793A",message:"\u786E\u8BA4\u5220\u9664\u6536\u8D27\u5730\u5740\u5417\uFF1F",confirmButtonColor:"var(--van-primary)"}).then(async()=>{await l.post(`/api-mall-portal/member/address/delete/${F.id}`),setTimeout(()=>{s("\u5220\u9664\u6210\u529F");const R=this.list.findIndex(A=>A.id===F.id);this.list.splice(R||this.list.length-1,1),this.dataShow=this.list.length>0},100)})}catch{}},onDetail(U){const{type:F}=this.$route.query;F==="getAddress"&&(console.log(U,"onDetail"),V.id=U.id,V.defaultStatus=U.defaultStatus?1:0,V.province=U.province,V.city=U.city,V.region=U.region,V.name=U.name,V.phoneNumber=U.phoneNumber,V.detailAddress=U.detailAddress,V.memberId=U.memberId,V.postCode=U.postCode,this.$router.back())}},render(){return t("div",{class:e.addressList},[this.list.map(U=>t("div",{class:e.address,onClick:()=>this.onDetail(U)},[t("div",{class:e.content},[t("p",null,[t("span",{class:e.name},[U.name]),t("span",null,[U.phoneNumber&&U.phoneNumber.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")])]),t("p",{class:e.addressContent},[U.province,U.city,U.region,U.detailAddress])]),t("div",{class:e.icon},[t(i,{name:p,size:18,onClick:F=>this.onEdit(F,U)},null),t(i,{name:S,size:18,style:{marginLeft:"16px"},onClick:F=>this.onDelete(F,U)},null)])])),!this.dataShow&&t(m,{tips:"\u6682\u65E0\u6570\u636E",classImgSize:"SMALL",btnStatus:!1},null),t(a,{position:"bottom",background:"white"},{default:()=>[t("div",{class:["btnGroup"],style:{paddingTop:"12px"}},[t(r,{block:!0,round:!0,type:"primary",onClick:this.onEdit},{default:()=>[h("\u6DFB\u52A0\u65B0\u5730\u5740")]})])]})])}});export{J as default};
