address-operation-legacy.587b9c0a.js 9.2 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.48c8d62c.js","./index-legacy.8cf5f94f.js","./index.module-legacy.6a8a5be9.js","./area-legacy.b541a943.js","./toolsValidate-legacy.95a8e7c1.js","./index-legacy.269a0b91.js","./index-legacy.55fe5b03.js","./index-legacy.087e0425.js","./index-legacy.384d768f.js","./index-legacy.ef66d7bb.js","./use-tab-status-legacy.6949b1de.js","./index-legacy.71047e87.js","./index-legacy.a2ac81dd.js"],(function(e){"use strict";var n,a,i,u,c,l,s,d,f,p,m,b,g,v,h,y,k,x,w,j,S,O,C,V,A,P,N,R,T,q,z;return{setters:[function(e){n=e.t,a=e.z,i=e.O,u=e.d,c=e.b1,l=e.U,s=e.c,d=e.L,f=e.D,p=e.r,m=e.bk,b=e.bl,g=e.bm,v=e.be,h=e.o,y=e.e,k=e.k,x=e.aV,w=e.ag,j=e.$,S=e.B,O=e.q,C=e.P},function(e){V=e.O},function(e){A=e.s},function(e){P=e.a},function(e){N=e.v},function(e){R=e.C},function(e){T=e.F},function(e){q=e.C},function(e){z=e.P},function(){},function(){},function(){},function(){}],execute:function(){var E,U=o(n("switch"),2),D=U[0],L=U[1],B={size:a,loading:Boolean,disabled:Boolean,modelValue:i,activeColor:String,inactiveColor:String,activeValue:{type:i,default:!0},inactiveValue:{type:i,default:!1}},I=u({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 s(d,{class:L("loading"),color:t},null)}if(r.node)return r.node()};return c((function(){return e.modelValue})),function(){var t,n=e.size,u=e.loading,c=e.disabled,d=e.activeColor,f=e.inactiveColor,p=a(),m={fontSize:l(n),backgroundColor:p?d:f};return s("div",{role:"switch",class:L({on:p,loading:u,disabled:c}),style:m,tabindex:c?void 0:0,"aria-checked":p,onClick:o},[s("div",{class:L("node")},[i()]),null==(t=r.background)?void 0:t.call(r)])}}}),$=f(I),F=p({user:{status:"init",data:{}}}),M=function(){F.user.status="logout",F.user.data=null},G=m({timeout:2e4,timeoutMessage:"请求超时"}),H=!1;G.interceptors.request.use((function(e,t){t.hideLoading||(clearTimeout(E),b({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:g(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(){v()}),100),!(t.status>299||t.status<200)){e.next=6;break}throw clearTimeout(E),n="服务器错误,状态码"+t.status,h(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),h(a)),o=y(),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",u({name:"address-operation",setup:function(){var e=x(),n=w(),a=p({isClick:!1,showPicker:!1,defaultStatus:!1,phoneNumber:null,province:null,city:null,region:null,pcrStr:"",name:null,detailAddress:null}),o=function(e){return e&&e>=1?N(e):""},i=function(){var o=t(regeneratorRuntime.mark((function t(){var o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,a.name){t.next=4;break}return h("请选择收货人"),t.abrupt("return");case 4:if(a.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(a.phoneNumber)){t.next=7;break}return h("手机号输入有误"),t.abrupt("return");case 7:if(a.pcrStr){t.next=10;break}return h("请选择所在地区"),t.abrupt("return");case 10:if(a.detailAddress){t.next=13;break}return h("请输入详细地址"),t.abrupt("return");case 13:if(a.isClick=!0,o={name:a.name,phoneNumber:a.phoneNumber,province:a.province,city:a.city,region:a.region,detailAddress:a.detailAddress,defaultStatus:a.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},o)});case 18:t.next=22;break;case 20:return t.next=22,G.post("/api-student/userReceiveAddress/save",{hideLoading:!1,data:r({},o)});case 22:a.isClick=!1,n.back(),t.next=29;break;case 26:t.prev=26,t.t0=t.catch(0),a.isClick=!1;case 29:case"end":return t.stop()}}),t,null,[[0,26]])})));return function(){return o.apply(this,arguments)}}(),u=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,a.name=r.name,a.phoneNumber=r.phoneNumber,a.province=r.province,a.city=r.city,a.region=r.region?r.region:"",a.pcrStr=(r.provinceName||"")+(r.cityName||"")+(r.regionName||""),a.detailAddress=r.detailAddress,a.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 j((function(){e.query.id&&u()})),function(){return s("div",{class:A.operation},[s(R,{inset:!0,class:A.form},{default:function(){return[s(T,{label:"收货人",placeholder:"请输入收货人姓名",modelValue:a.name,"onUpdate:modelValue":function(e){return a.name=e}},null),s(T,{label:"手机号",placeholder:"请输入收货人手机号",modelValue:a.phoneNumber,"onUpdate:modelValue":function(e){return a.phoneNumber=e},maxlength:11,type:"tel",formatter:o},null),s(T,{label:"所在地区",placeholder:"省/市/区",readonly:!0,isLink:!0,modelValue:a.pcrStr,onClick:function(){a.showPicker=!0}},null),s(T,{label:"详细地址",placeholder:"街道/小区楼栋/乡村名称",type:"textarea",rows:3,modelValue:a.detailAddress,"onUpdate:modelValue":function(e){return a.detailAddress=e},maxlength:100},null)]}}),s(R,{inset:!0,style:{marginTop:"12px"}},{default:function(){return[s(q,{title:"设置为默认地址",center:!0,class:A.default},{value:function(){return s($,{modelValue:a.defaultStatus,"onUpdate:modelValue":function(e){return a.defaultStatus=e},size:"23px"},null)}})]}}),s(V,{position:"bottom"},{default:function(){return[s("div",{class:"btnGroup"},[s(S,{type:"primary",block:!0,round:!0,onClick:i,disabled:a.isClick},{default:function(){return[O("确认")]}})])]}}),s(C,{show:a.showPicker,"onUpdate:show":function(e){return a.showPicker=e},position:"bottom",round:!0,class:"popupBottomSearch"},{default:function(){return[s(z,{showToolbar:!0,columns:P,columnsFieldNames:{text:"name",value:"code",children:"areas"},onCancel:function(){return a.showPicker=!1},onConfirm:function(e){console.log(e,"val");var t=e.selectedOptions||[];a.pcrStr="",2===t.length?t.forEach((function(e,t){a.pcrStr+=e.name,0===t?a.province=e.code:1===t&&(a.city=e.code)})):t.forEach((function(e,t){a.pcrStr+=e.name,0===t?a.province=e.code:1===t?a.city=e.code:2===t&&(a.region=e.code)})),a.showPicker=!1}},null)]}})])}}}))}}}))}();