"use strict";const e=require("../../common/vendor.js"),a=require("../../api/index.js");if(!Array){(e.resolveComponent("wd-navbar")+e.resolveComponent("wd-input")+e.resolveComponent("wd-switch"))()}Math||((()=>"../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js")+(()=>"../../uni_modules/wot-design-uni/components/wd-input/wd-input.js")+(()=>"../../uni_modules/wot-design-uni/components/wd-switch/wd-switch.js"))();const r=e.defineComponent({__name:"add",setup(r){e.onLoad((e=>{e.id&&a.api.addressInfo({id:e.id}).then((e=>{const a=e||{};a.isDefault=!!a.isDefault;const r=Object.keys(o.value),n={};r.forEach((e=>{a.hasOwnProperty(e)&&(n[e]=a[e])})),Object.assign(o.value,n)}))}));const o=e.ref({receiverName:"",receiverPhone:"",receiverArea:"",receiverAddress:"",isDefault:!0,status:0,id:""}),n=()=>{let r=JSON.parse(JSON.stringify(o.value));r.isDefault=r.isDefault?1:0,r.id?a.api.addressUp(r).then((a=>{e.index.navigateBack()})):a.api.addressAdd(r).then((a=>{e.index.navigateBack()}))},t=()=>{e.index.navigateBack()};return(a,r)=>({a:e.o(t),b:e.p({title:"新增地址",safeAreaInsetTop:!0,"left-arrow":!0}),c:e.o((e=>o.value.receiverName=e)),d:e.p({type:"text","no-border":!0,placeholder:"请输入收货人姓名",modelValue:o.value.receiverName}),e:e.o((e=>o.value.receiverPhone=e)),f:e.p({type:"number","no-border":!0,placeholder:"请输入手机号",modelValue:o.value.receiverPhone}),g:e.o((e=>o.value.receiverArea=e)),h:e.p({type:"text","no-border":!0,placeholder:"请输入省市区",modelValue:o.value.receiverArea}),i:e.o((e=>o.value.receiverAddress=e)),j:e.p({type:"text","no-border":!0,placeholder:"请输入详细地址",modelValue:o.value.receiverAddress}),k:e.o((e=>o.value.isDefault=e)),l:e.p({size:"20px",modelValue:o.value.isDefault}),m:e.o(n)})}}),o=e._export_sfc(r,[["__scopeId","data-v-1285ff06"]]);wx.createPage(o);
