!function(){function e(e,t,n,r,a,o,i){try{var u=e[o](i),c=u.value}catch(l){return void n(l)}u.done?t(c):Promise.resolve(c).then(r,a)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(a,o){var i=t.apply(n,r);function u(t){e(i,a,o,u,c,"next",t)}function c(t){e(i,a,o,u,c,"throw",t)}u(void 0)}))}}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function r(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n299||t.status<200)){e.next=6;break}throw clearTimeout(E),n="服务器错误,状态码"+t.status,y(n),new Error(n);case 6:return e.next=8,t.clone().json();case 8:if(200===(r=e.sent).code||0===r.errCode){e.next=17;break}throw a=r.msg||r.message||"处理失败,请重试",H&&(403===r.code||5e3===r.code?M():(F.user.status="error",F.user.data=null)),console.log(r.code,"5104"),403!==r.code&&5e3!==r.code&&(clearTimeout(E),y(a)),o=x(),5e3===r.code&&(a+="5000",o.isApp?k({api:"login"}):M()),new Error(a);case 17:return e.abrupt("return",t);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{global:!1});e("default",c({name:"address-operation",setup:function(){var e=w(),a=j(),o=m({isClick:!1,showPicker:!1,defaultStatus:!1,phoneNumber:null,province:null,city:null,region:null,pcrStr:"",name:null,detailAddress:null}),i=function(e){return e&&e>=1?N(e):""},u=function(){var n=t(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,o.name){t.next=4;break}return y("请选择收货人"),t.abrupt("return");case 4:if(o.phoneNumber&&/^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/.test(o.phoneNumber)){t.next=7;break}return y("手机号输入有误"),t.abrupt("return");case 7:if(o.pcrStr){t.next=10;break}return y("请选择所在地区"),t.abrupt("return");case 10:if(o.detailAddress){t.next=13;break}return y("请输入详细地址"),t.abrupt("return");case 13:if(o.isClick=!0,n={name:o.name,phoneNumber:o.phoneNumber,province:o.province,city:o.city,region:o.region,detailAddress:o.detailAddress,defaultStatus:o.defaultStatus},!e.query.id){t.next=20;break}return t.next=18,G.post("/api-student/userReceiveAddress/update",{hideLoading:!1,data:r({id:e.query.id},n)});case 18:t.next=22;break;case 20:return t.next=22,G.post("/api-student/userReceiveAddress/save",{hideLoading:!1,data:r({},n)});case 22:o.isClick=!1,a.back(),t.next=29;break;case 26:t.prev=26,t.t0=t.catch(0),o.isClick=!1;case 29:case"end":return t.stop()}}),t,null,[[0,26]])})));return function(){return n.apply(this,arguments)}}(),c=function(){var n=t(regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,G.get("/api-student/userReceiveAddress/detail/"+e.query.id);case 3:n=t.sent,r=n.data,o.name=r.name,o.phoneNumber=r.phoneNumber,o.province=r.province,o.city=r.city,o.region=r.region?r.region:"",o.pcrStr=(r.provinceName||"")+(r.cityName||"")+(r.regionName||""),o.detailAddress=r.detailAddress,o.defaultStatus=r.defaultStatus,t.next=17;break;case 15:t.prev=15,t.t0=t.catch(0);case 17:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return n.apply(this,arguments)}}();return S((function(){e.query.id&&c()})),function(){return d("div",{class:P.operation},[d(R,{inset:!0,class:P.form},{default:function(){return[d(q,{label:"收货人",placeholder:"请输入收货人姓名",modelValue:o.name,"onUpdate:modelValue":function(e){return o.name=e}},null),d(q,{label:"手机号",placeholder:"请输入收货人手机号",modelValue:o.phoneNumber,"onUpdate:modelValue":function(e){return o.phoneNumber=e},maxlength:11,type:"tel",formatter:i},null),d(q,{label:"所在地区",placeholder:"省/市/区",readonly:!0,isLink:!0,modelValue:o.pcrStr,onClick:function(){o.showPicker=!0}},null),d(q,{label:"详细地址",placeholder:"街道/小区楼栋/乡村名称",type:"textarea",rows:3,modelValue:o.detailAddress,"onUpdate:modelValue":function(e){return o.detailAddress=e},maxlength:100},null)]}}),d(R,{inset:!0,style:{marginTop:"12px"}},{default:function(){return[d(T,{title:"设置为默认地址",center:!0,class:P.default},{value:function(){return d($,{modelValue:o.defaultStatus,"onUpdate:modelValue":function(e){return o.defaultStatus=e},size:"23px"},null)}})]}}),d(n,{position:"bottom"},{default:function(){return[d("div",{class:"btnGroup"},[d(O,{type:"primary",block:!0,round:!0,onClick:u,disabled:o.isClick},{default:function(){return[C("确认")]}})])]}}),d(A,{show:o.showPicker,"onUpdate:show":function(e){return o.showPicker=e},position:"bottom",round:!0,class:"popupBottomSearch"},{default:function(){return[d(z,{showToolbar:!0,columns:V,columnsFieldNames:{text:"name",value:"code",children:"areas"},onCancel:function(){return o.showPicker=!1},onConfirm:function(e){console.log(e,"val");var t=e.selectedOptions||[];o.pcrStr="",2===t.length?t.forEach((function(e,t){o.pcrStr+=e.name,0===t?o.province=e.code:1===t&&(o.city=e.code)})):t.forEach((function(e,t){o.pcrStr+=e.name,0===t?o.province=e.code:1===t?o.city=e.code:2===t&&(o.region=e.code)})),o.showPicker=!1}},null)]}})])}}}))}}}))}();