"use strict";var e=require("../common/vendor.js"),d=require("../api/userAddress.js");require("../common/request.js");const s={data:()=>({address:[]}),onLoad(){var d=this;e.index.$on("refreshAddress",(()=>{d.getAddressList()}))},onShow(){this.getAddressList()},methods:{selectAddress(d){e.index.$emit("updateAddress",d),e.index.navigateBack({delta:1})},editAddress(d){e.index.navigateTo({url:"./addEditAddress?type=edit&addressId="+d.addressId})},delAddress(s){e.index.showModal({title:"提示",content:"确认删除此地址吗?",showCancel:!0,cancelText:"取消",confirmText:"确定",success:t=>{if(t.confirm){var r={addressId:s.addressId};d.delAddress(r).then((d=>{200==d.code?(e.index.showToast({icon:"success",title:"操作成功"}),this.getAddressList()):e.index.showToast({icon:"none",title:"请求失败"})}),(e=>{}))}}})},getAddressList(){d.getAddressList().then((d=>{200==d.code?this.address=d.data:e.index.showToast({icon:"none",title:"请求失败"})}),(e=>{}))},addAddress(){e.index.navigateTo({url:"./addEditAddress?type=add"})}}};var t=e._export_sfc(s,[["render",function(d,s,t,r,i,a){return e.e({a:e.f(i.address,((s,t,r)=>e.e({a:1==s.isDefault},(s.isDefault,{}),{b:e.t(s.province),c:e.t(s.city),d:e.t(s.district),e:e.t(s.detail),f:e.t(s.realName),g:e.t(d.$parsePhone(s.phone)),h:e.o((e=>a.delAddress(s))),i:e.o((e=>a.editAddress(s))),j:t,k:e.o((e=>a.selectAddress(s)),t)}))),b:0==i.address.length},0==i.address.length?{c:e.o((e=>a.getAddressList()))}:{},{d:e.o((e=>a.addAddress()))})}]]);wx.createPage(t);