import{_ as e}from"./el-navbar.DVIyjZEN.js";import{r as a,E as s,b as t,d as l,e as o,f as d,w as u,g as n,j as r,h as i,i as c,F as p,l as f,t as _,v as m,p as h,aj as y,A as b,_ as v,y as g}from"./index-DVkgSHpn.js";import{_ as k}from"./el-empty.CMLN1lgh.js";import{_ as x}from"./el-checkbox.DqvOzTsU.js";import{_ as $,b as w,a as j}from"./el-layout._U-vZTft.js";const C=$({__name:"index",setup($){const C=a([]);s((()=>{V()}));const V=()=>{uni.$http.get("ucenter.address/index").then((e=>{e.code&&(C.value=e.data)}))},T=()=>{_("pages/index/ucenter")};return(a,s)=>{const $=t(l("el-navbar"),e),z=t(l("el-empty"),k),U=g,A=h,B=t(l("el-checkbox"),x),E=t(l("uni-icons"),w),F=y,I=t(l("el-layout"),j);return o(),d(I,null,{default:u((()=>[n($,{placeholder:!0,fixed:!0,onLeft:T,autoBack:!1,border:!0,title:"地址列表"}),n(A,{class:"wrapper"},{default:u((()=>[C.value.length<=0?(o(),d(z,{key:0,mode:"address"})):r("",!0),C.value.length>0?(o(!0),i(p,{key:1},c(C.value,((e,a)=>(o(),d(A,{class:"item-box"},{default:u((()=>[n(A,{class:"item-wrap"},{default:u((()=>[n(A,{class:"top"},{default:u((()=>[n(U,null,{default:u((()=>[m(b(e.accept_name||""),1)])),_:2},1024),n(U,null,{default:u((()=>[m(b(e.mobile||""),1)])),_:2},1024)])),_:2},1024),n(A,{class:"content"},{default:u((()=>[n(A,null,{default:u((()=>[m(b(e.address||""),1)])),_:2},1024)])),_:2},1024),n(A,{class:"bottom"},{default:u((()=>[n(A,{class:"default"},{default:u((()=>[n(B,{modelValue:e.is_default,"onUpdate:modelValue":a=>e.is_default=a,onChange:a=>{return s=e,void uni.$http.post("ucenter.address/status",{id:s.id,status:s.is_default?1:0}).then((e=>{e.code?(V(),uni.$layer.showToast("设置成功")):uni.$layer.showToast(e.msg)}));var s},shape:"circle",size:18},null,8,["modelValue","onUpdate:modelValue","onChange"]),n(U,null,{default:u((()=>[m(b(e.is_default?"默认":"选择"),1)])),_:2},1024)])),_:2},1024),n(A,{class:"operate"},{default:u((()=>[n(A,{onClick:v((a=>f(_)(`pages/ucenter/address/editor?id=${e.id}`)),["stop"])},{default:u((()=>[n(E,{class:"icon",type:"compose",size:"17"}),m(" 编辑 ")])),_:2},1032,["onClick"]),n(A,{onClick:v((a=>{return s=e.id,void uni.$layer.showModal("您确定要删除该内容吗？").then((()=>{uni.$http.post("ucenter.address/delete",{id:s}).then((e=>{e.code?(V(),uni.$layer.showToast("删除成功")):uni.$layer.showToast(e.msg)}))}));var s}),["stop"])},{default:u((()=>[n(E,{class:"icon",type:"trash",size:"17"}),m(" 删除 ")])),_:2},1032,["onClick"])])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),256)):r("",!0)])),_:1}),n(A,{class:"placeholder"}),n(A,{class:"footer"},{default:u((()=>[n(F,{class:"btn",onClick:s[0]||(s[0]=e=>f(_)("pages/ucenter/address/editor"))},{default:u((()=>[m("添加地址")])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-96f2f7b6"]]);export{C as default};
//# sourceMappingURL=pages-ucenter-address-index.joIafGHg.js.map
