address-operation-legacy.86dc6541.js 9.3 KB

1
  1. !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;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],i=!0,u=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(c){u=!0,a=c}finally{try{i||null==n.return||n.return()}finally{if(u)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}System.register(["./index-legacy.697c501a.js","./index-legacy.47bc1690.js","./index.module-legacy.d054e180.js","./area-legacy.b541a943.js","./toolsValidate-legacy.95a8e7c1.js","./index-legacy.bab9fe30.js","./index-legacy.569a2858.js","./index-legacy.92a01198.js","./index-legacy.62a334e5.js","./Picker-legacy.cd27e6c1.js","./index-legacy.00966b07.js","./use-tab-status-legacy.7bf91b8c.js","./index-legacy.18044794.js","./index-legacy.21964237.js"],(function(e){"use strict";var n,a,i,u,c,l,s,d,f,p,m,b,g,v,h,y,x,k,w,j,S,O,C,A,P,V,N,R,q,T,z;return{setters:[function(e){n=e.O},function(e){a=e.t,i=e.z,u=e.O,c=e.d,l=e.b4,s=e.U,d=e.c,f=e.L,p=e.D,m=e.r,b=e.bp,g=e.bq,v=e.br,h=e.bf,y=e.o,x=e.f,k=e.e,w=e.ah,j=e.ag,S=e.$,O=e.B,C=e.q,A=e.P},function(e){P=e.s},function(e){V=e.a},function(e){N=e.v},function(e){R=e.C},function(e){q=e.F},function(e){T=e.C},function(e){z=e.P},function(){},function(){},function(){},function(){},function(){}],execute:function(){var E,U=o(a("switch"),2),D=U[0],L=U[1],B={size:i,loading:Boolean,disabled:Boolean,modelValue:u,activeColor:String,inactiveColor:String,activeValue:{type:u,default:!0},inactiveValue:{type:u,default:!1}},I=c({name:D,props:B,emits:["change","update:modelValue"],setup:function(e,t){var n=t.emit,r=t.slots,a=function(){return e.modelValue===e.activeValue},o=function(){if(!e.disabled&&!e.loading){var t=a()?e.inactiveValue:e.activeValue;n("update:modelValue",t),n("change",t)}},i=function(){if(e.loading){var t=a()?e.activeColor:e.inactiveColor;return d(f,{class:L("loading"),color:t},null)}if(r.node)return r.node()};return l((function(){return e.modelValue})),function(){var t,n=e.size,u=e.loading,c=e.disabled,l=e.activeColor,f=e.inactiveColor,p=a(),m={fontSize:s(n),backgroundColor:p?l:f};return d("div",{role:"switch",class:L({on:p,loading:u,disabled:c}),style:m,tabindex:c?void 0:0,"aria-checked":p,onClick:o},[d("div",{class:L("node")},[i()]),null==(t=r.background)?void 0:t.call(r)])}}}),$=p(I),F=m({user:{status:"init",data:{}}}),M=function(){F.user.status="logout",F.user.data=null},G=b({timeout:2e4,timeoutMessage:"请求超时"}),H=!1;G.interceptors.request.use((function(e,t){t.hideLoading||(clearTimeout(E),g({message:"加载中...",forbidClick:!0,loadingType:"spinner",duration:0})),H=t.initRequest||!1;var n=sessionStorage.getItem("Authorization")||"",a={};return n&&!["/api-oauth/userlogin","/api-oauth/open/sendSms"].includes(e)&&(a.Authorization=n),{url:e,options:r(r({},t),{},{params:v(t.params),headers:r(r({},t.headers),a)})}}),{global:!1}),G.interceptors.response.use(function(){var e=t(regeneratorRuntime.mark((function e(t){var n,r,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(E=setTimeout((function(){h()}),100),!(t.status>299||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)]}})])}}}))}}}))}();