You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
14 KiB

2 weeks ago
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-my-index"],{"029e":function(e,t,i){"use strict";var a=i("4ca4"),n=i.n(a);n.a},"4ca4":function(e,t,i){var a=i("8a78");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var n=i("967d").default;n("3dfd83c6",a,!0,{sourceMap:!1,shadowMode:!1})},"4d9e":function(e,t,i){"use strict";i("6a54");var a=i("f5bd").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(i("2634")),o=a(i("9b1b")),r=a(i("2fdc"));i("5c47"),i("0506"),i("64aa"),i("bf0f"),i("c223"),i("4626");var s=i("bd31"),d={data:function(){return{isWeixinBrowser:!1,userInfo:null,editForm:{name:"",payer_type:1,phone:"",id_card:""},showEditPopup:!1,mainList:[{text:"我的预约",icon:"/static/icon_my1.png"},{text:"我的发票",icon:"/static/icon_my3.png"},{text:"船舶信息",icon:"/static/icon_my4.png"}],helpList:[{text:"联系客服",icon:"/static/icon_my5.png"},{text:"帮助中心",icon:"/static/icon_my6.png"},{text:"关于我们",icon:"/static/icon_my7.png"}]}},onLoad:function(){this.isWeixinBrowser=/MicroMessenger/i.test(navigator.userAgent)},computed:{displayName:function(){return this.userInfo&&this.userInfo.name?this.userInfo.name:"微信用户"},payerTypeLabel:function(){var e,t=Number(this.userInfo?null!==(e=this.userInfo.payer_type)&&void 0!==e?e:this.userInfo.payerType:void 0);return{1:"个人",2:"单位"}[t]||"-"}},onShow:function(){this.fetchUserInfo()},methods:{fetchUserInfo:function(){var e=this;return(0,r.default)((0,n.default)().mark((function t(){var i,a,r,d,c,l;return(0,n.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(i=uni.getStorageSync("token"),i){t.next=4;break}return e.userInfo=null,t.abrupt("return");case 4:return t.prev=4,t.next=7,new Promise((function(e,t){uni.request({url:"".concat(s.API.GET_USER_INFO,"?token=").concat(i),method:"POST",success:e,fail:t})}));case 7:a=t.sent,console.log(a),a.data?(c=a.data||{},l=Number(null!==(r=null!==(d=c.payer_type)&&void 0!==d?d:c.payerType)&&void 0!==r?r:1),e.userInfo=(0,o.default)((0,o.default)({},c),{},{payerType:l,payer_type:l}),e.editForm={name:c.name||"",payer_type:l,phone:c.phone||"",id_card:c.id_card||""}):(e.userInfo=null,e.resetEditForm()),t.next=17;break;case 12:t.prev=12,t.t0=t["catch"](4),console.error("获取用户信息失败:",t.t0),e.userInfo=null,e.resetEditForm();case 17:case"end":return t.stop()}}),t,null,[[4,12]])})))()},resetEditForm:function(){this.editForm={name:"",payer_type:1,phone:"",id_card:""}},openEditPopup:function(){var e;this.userInfo&&(this.editForm={name:this.userInfo.name||"",payer_type:Number(null!==(e=this.userInfo.payer_type)&&void 0!==e?e:this.userInfo.payerType)||1,phone:this.userInfo.phone||"",id_card:this.userInfo.id_card||""});this.showEditPopup=!0},closeEditPopup:function(){this.showEditPopup=!1},validateForm:function(){if(!this.editForm.name)return uni.showToast({title:"请输入姓名",icon:"none"}),!1;if(![1,2].includes(Number(this.editForm.payer_type)))return uni.showToast({title:"请选择交款人类型",icon:"none"}),!1;if(!/^1\d{10}$/.test(this.editForm.phone))return uni.showToast({title:"请输入正确的手机号",icon:"none"}),!1;return!!/^(?:\d{15}|\d{17}[\dXx])$/.test(this.editForm.id_card)||(uni.showToast({title:"请输入正确的证件号",icon:"none"}),!1)},submitUserInfo:function(){var e=this;return(0,r.default)((0,n.default)().mark((function t(){var i,a;return(0,n.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.validateForm()){t.next=2;break}return t.abrupt("return");case 2:if(i=uni.getStorageSync("token"),i){t.next=6;break}return uni.showToast({title:"请先登录",icon:"none"}),t.abrupt("return");case 6:return t.prev=6,uni.showLoading({title:"提交中..."}),t.next=10,new Promise((function(t,a){uni.request({url:"".concat(s.API.UPDATE_USER_INFO,"?token=").concat(i),method:"POST",data:{name:e.editForm.name,payer_type:Number(e.editForm.payer_type),phone:e.editForm.phone,id_card:e.editForm.id_card},success:t,fail:a})}));case 10:a=t.sent,uni.hideLoading(),a.data&&0