import{d as e,o as a,s,b as t,w as r,i as l,g as o,f as n,h as d,u as i,n as u,F as m,p as c,k as p,j as f,y as _,m as g,t as y}from"./index-QG-actth.js";import{u as v}from"./useResource.BCE3CdNn.js";import{g as x}from"./format.CS68-v_Q.js";import{I as j}from"./IdentityGuard.CPl6yQiQ.js";import{P as h}from"./PageState.DaVcUVl0.js";import"./_plugin-vue_export-helper.BCo6x5W8.js";const k=e({__name:"index",setup(e){const{data:k,loading:w,error:R,load:b}=v(()=>o("/addresses"));function I(e){var a;return"enterprise_admin"===(null==(a=s.active)?void 0:a.role)&&s.active.resource_id===e}return a(()=>{s.token&&b()}),(e,a)=>{const s=p,o=_,v=l;return n(),t(v,{class:"page"},{default:r(()=>[d(j,null,{default:r(()=>{var e,l;return[d(h,{loading:i(w),error:i(R),empty:!(null==(e=i(k))?void 0:e.items.length),"empty-text":"暂无已授权企业地址",onRetry:i(b)},null,8,["loading","error","empty","onRetry"]),(n(!0),u(m,null,c(null==(l=i(k))?void 0:l.items,e=>(n(),t(v,{key:e.id,class:"card"},{default:r(()=>[d(v,{class:"row"},{default:r(()=>[d(s,{class:"tag"},{default:r(()=>[f("企业供水地址")]),_:1}),I(e.id)?(n(),t(o,{key:0,class:"text-button",onClick:a[0]||(a[0]=e=>i(x)("/pages/addresses/edit"))},{default:r(()=>[f(" 编辑 ")]),_:1})):g("",!0)]),_:2},1024),d(v,{class:"title",style:{"margin-top":"18rpx"}},{default:r(()=>[f(y(e.name),1)]),_:2},1024),d(v,{style:{margin:"16rpx 0","line-height":"1.7"}},{default:r(()=>[f(y(e.address||"地址待完善"),1)]),_:2},1024),d(v,{class:"muted"},{default:r(()=>[f(y(e.contact)+" · "+y(e.phone),1)]),_:2},1024),e.region?(n(),t(v,{key:0,class:"muted"},{default:r(()=>[f("服务区域:"+y(e.region),1)]),_:2},1024)):g("",!0)]),_:2},1024))),128)),d(v,{class:"notice"},{default:r(()=>[f(" 每个企业使用一个供水地址。仅当前企业管理员可以修改;存在未完成配送时请先处理配送任务。 ")]),_:1})]}),_:1})]),_:1})}}});export{k as default};