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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(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===a.data.errcode?(uni.showToast({title:"更新成功",icon:"success"}),e.closeEditPopup(),e.fetchUserInfo()):uni.showToast({title:a.data.errmsg||"更新失败",icon:"none"}),t.next=20;break;case 15:t.prev=15,t.t0=t["catch"](6),uni.hideLoading(),console.error("更新用户信息失败:",t.t0),uni.showToast({title:"更新失败",icon:"none"});case 20:case"end":return t.stop()}}),t,null,[[6,15]])})))()},onItemClick:function(e){"船舶信息"===e.text?uni.navigateTo({url:"/pages/index/ship_manage"}):"我的预约"===e.text||"我的购票"===e.text?uni.switchTab({url:"/pages/order/index"}):"我的发票"===e.text?uni.navigateTo({url:"/pages/index/invoice_manage"}):"关于我们"===e.text?uni.navigateTo({url:"/pages/my/about"}):uni.showToast({title:e.text,icon:"none"})}}};t.default=d},"8a78":function(e,t,i){var a=i("c86c");t=a(!1),t.push([e.i,'@charset "UTF-8";\n/* 颜色变量 */\n/* 行为相关颜色 */\n/* 文字基本颜色 */\n/* 背景颜色 */\n/* 边框颜色 */\n/* 尺寸变量 */\n/* 文字尺寸 */\n/* 图片尺寸 */\n/* Border Radius */\n/* 水平间距 */\n/* 垂直间距 */\n/* 透明度 */\n/* 文章场景相关 */\n/* uni.scss */.profile-container[data-v-57eae0e8]{min-height:100vh;background:linear-gradient(180deg,#cbe6ff,#f6faff);padding-top:%?88?%;padding-bottom:%?100?%}.wechat-browser[data-v-57eae0e8]{margin-top:%?-88?%}.profile-header[data-v-57eae0e8]{display:flex;align-items:center;padding:%?40?% %?30?% %?20?% %?30?%;position:relative;margin-top:%?44?%}.profile-avatar uni-image[data-v-57eae0e8]{width:%?120?%;height:%?120?%;border-radius:50%;background:#fff;border:%?2?% solid #e0e0e0}.profile-info[data-v-57eae0e8]{flex:1;margin-left:%?24?%}.profile-name[data-v-57eae0e8]{font-size:%?36?%;font-weight:700;color:#222}.profile-id[data-v-57eae0e8]{font-size:%?24?%;color:#7a8599;margin-top:%?8?%}.profile-contact[data-v-57eae0e8]{font-size:%?24?%;color:#7a8599;margin-top:%?8?%}.profile-setting[data-v-57eae0e8]{position:absolute;right:%?30?%;top:%?40?%}.setting-placeholder[data-v-57eae0e8]{width:%?80?%;height:%?80?%;border-radius:50%;background:#e0e0e0;display:flex;align-items:center;justify-content:center;color:#888;font-size:%?28?%;font-weight:700;margin-top:%?25?%}.profile-card[data-v-57eae0e8]{background:#fff;border-radius:%?24?%;margin:%?20?% %?20?% 0 %?20?%;box-shadow:0 %?4?% %?16?% rgba(0,0,0,.03);overflow:hidden}.profile-item[data-v-57eae0e8]{display:flex;align-items:center;padding:%?32?% %?24?%;border-bottom:%?1?% solid #f0f0f0;font-size:%?30?%;color:#222;position:relative}.profile-item[data-v-57eae0e8]:last-child{border-bottom:none}.profile-item .iconfont[data-v-57eae0e8]{font-size:%?40?%;margin-right:%?24?%;color:#3b82f6}.profile-item .icon-arrow-right[data-v-57eae0e8]{margin-left:auto;color:#c0c4cc;font-size:%?32?%}.item-text[data-v-57eae0e8]{flex:1}.tabbar[data-v-57eae0e8]{position:fixed;left:0;right:0;bottom:0;height:%?100?%;background:#fff;display:flex;border-top:%?1?% solid #f0f0f0;z-index:10}.tabbar-item[data-v-57eae0e8]{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#888;font-size:%?24?%}.tabbar-item .iconfont[data-v-57eae0e8]{font-size:%?40?%;margin-bottom:%?4?%}.tabbar-item.active[data-v-57eae0e8]{color:#3b82f6}.setting-icon[data-v-57eae0e8]{width:%?80?%;height:%?80?%;border-radius:50%;background:#e0e0e0;margin-top:%?25?%}.profile-list-icon[data-v-57eae0e8]{width:%?40?%;height:%?40?%;margin-right:%?24?%;vertical-align:middle}.first-card[data-v-57eae0e8]{margin-bottom:%?38?%}.profile-arrow-icon[data-v-57eae0e8]{width:%?38?%;height:%?38?%;margin-left:auto;display:block}.edit-popup-mask[data-v-57eae0e8]{position:fixed;left:0;right:0;top:0;bottom:0;background:rgba(0,0,0,.45);display:flex;justify-content:center;align-items:flex-end;z-index:9999}.edit-popup[data-v-57eae0e8]{background:#fff;width:100%;border-top-left-radius:%?24?%;border-top-right-radius:%?24?%;padding:%?32?%;box-sizing:border-box;max-height:80vh;overflow-y:auto}.edit-popup-header[data-v-57eae0e8]{display:flex;justify-content:center;position:relative;font-size:%?32?%;font-weight:600;color:#222}.edit-popup-close[data-v-57eae0e8]{position:absolute;right:0;top:0;font-size:%?44?%;color:#999;padding:0 %?16?%}.edit-popup-content[data-v-57eae0e8]{margin-top:%?32?%}.edit-field[data-v-57eae0e8]{margin-bottom:%?28?%}.edit-label[data-v-57eae0e8]{display:block;font-size:%?28?%;color:#666;margin-bottom:%?12?%}.edit-input[data-v-57eae0e8]{width:100%;height:%?80?%;border-radius:%?12?%;border:%?1?% solid #e5e6eb;padding:0 %?24?%;font-size:%?28?%;box-sizing:border-box;background:#fafafa}.payer-type-group[data-v-57eae0e8]{display:flex;gap:%?20?%}.payer-type-item[data-v-57eae0e8]{flex:1;height:%?80?%;border-radius:%?12?%;border:%?1?% solid #e5e6eb;display:flex;align-items:center;justify-content:center;font-size:%?28?%;color:#666}.payer-type-item.active[data-v-57eae0e8]{border-color:#3b7cff;color:#3b7cff;background:#edf3ff}.edit-popup-footer[data-v-57eae0e8]{margin-top:%?12?%}.edit-submit-btn[data-v-57eae0e8]{width:100%;height:%?88?%;line-height:%?88?%;border-radius:%?44?%;background:linear-gradient(90deg,#3b7cff,#5bb6ff);color:#fff;font-size:%?32?%;font-weight:500;border:none}.edit-submit-btn[data-v-57eae0e8]::after{border:none}',""]),e.exports=t},"955f":function(e,t,i){"use strict";i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return n})),i.d(t,"a",(function(){}));var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("v-uni-view",{staticClass:"profile-container",class:{"wechat-browser":e.isWeixinBrowser}},[i("v-uni-view",{staticClass:"profile-header"},[i("v-uni-view",{staticClass:"profile-avatar"},[i("v-uni-image",{attrs:{src:"/static/avatar.png",mode:"aspectFill"}})],1),i("v-uni-view",{staticClass:"profile-info",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.openEditPopup.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"profile-name"},[e._v("Hi, "+e._s(e.displayName))]),i("v-uni-view",{staticClass:"profile-contact"},[e._v("手机号:"+e._s(e.userInfo&&e.userInfo.phone?e.userInfo.phone:"-"))])],1),i("v-uni-view",{staticClass:"profile-setting",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.openEditPopup.apply(void 0,arguments)}}},[i("v-uni-image",{staticClass:"setting-icon",attrs:{src:"/static/icon_setting.png",mode:"aspectFit"}})],1)],1),i("v-uni-view",{staticClass:"profile-card first-card"},e._l(e.mainList,(function(t){return i("v-uni-view",{key:t.text,staticClass:"profile-item",on:{click:function(i){arguments[0]=i=e.$handleEvent(i),e.onItemClick(t)}}},[i("v-uni-image",{staticClass:"profile-list-icon",attrs:{src:t.icon,mode:"aspectFit"}}),i("v-uni-text",{staticClass:"item-text"},[e._v(e._s(t.text))]),i("v-uni-image",{staticClass:"profile-arrow-icon",attrs:{src:"/static/right_arrow.png",mode:"aspectFit"}})],1)})),1),i("v-uni-view",{staticClass:"profile-card"},e._l(e.helpList,(function(t){return i("v-uni-view",{key:t.text,staticClass:"profile-item",on:{click:function(i){arguments[0]=i=e.$handleEvent(i),e.onItemClick(t)}}},[i("v-uni-image",{staticClass:"profile-list-icon",attrs:{src:t.icon,mode:"aspectFit"}}),i("v-uni-text",{staticClass:"item-text"},[e._v(e._s(t.text))]),i("v-uni-image",{staticClass:"profile-arrow-icon",attrs:{src:"/static/right_arrow.png",mode:"aspectFit"}})],1)})),1),e.showEditPopup?i("v-uni-view",{staticClass:"edit-popup-mask",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.closeEditPopup.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"edit-popup",on:{click:function(t){t.stopPropagation(),arguments[0]=t=e.$handleEvent(t)}}},[i("v-uni-view",{staticClass:"edit-popup-header"},[i("v-uni-text",[e._v("更新信息")]),i("v-uni-text",{staticClass:"edit-popup-close",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.closeEditPopup.apply(void 0,arguments)}}},[e._v("×")])],1),i("v-uni-view",{staticClass:"edit-popup-content"},[i("v-uni-view",{staticClass:"edit-field"},[i("v-uni-text",{staticClass:"edit-label"},[e._v("姓名")]),i("v-uni-input",{staticClass:"edit-input",attrs:{placeholder:"请输入姓名"},model:{value:e.editForm.name,callback:function(t){e.$set(e.editForm,"name",t)},expression:"editForm.name"}})],1),i("v-uni-view",{staticClass:"edit-field"},[i("v-uni-text",{staticClass:"edit-label"},[e._v("交款人类型")]),i("v-uni-view",{staticClass:"payer-type-group"},[i("v-uni-view",{staticClass:"payer-type-item",class:{active:1===Number(e.editForm.payer_type)},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.editForm.payer_type=1}}},[e._v("个人")]),i("v-uni-view",{staticClass:"payer-type-item",class:{active:2===Number(e.editForm.payer_type)},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.editForm.payer_type=2}}},[e._v("单位")])],1)],1),i("v-uni-view",{staticClass:"edit-field"},[i("v-uni-text",{staticClass:"edit-label"},[e._v("手机号")]),i("v-uni-input",{staticClass:"edit-input",attrs:{type:"number",maxlength:"11",placeholder:"请输入手机号"},model:{value:e.editForm.phone,callback:function(t){e.$set(e.editForm,"phone",t)},expression:"editForm.phone"}})],1),i("v-uni-view",{staticClass:"edit-field"},[i("v-uni-text",{staticClass:"edit-label"},[e._v("证件号")]),i("v-uni-input",{staticClass:"edit-input",attrs:{placeholder:"请输入身份证号",maxlength:"18"},model:{value:e.editForm.id_card,callback:function(t){e.$set(e.editForm,"id_card",t)},expression:"editForm.id_card"}})],1)],1),i("v-uni-view",{staticClass:"edit-popup-footer"},[i("v-uni-button",{staticClass:"edit-submit-btn",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.submitUserInfo.apply(void 0,arguments)}}},[e._v("保存")])],1)],1)],1):e._e()],1)},n=[]},a87a:function(e,t,i){"use strict";i.r(t);var a=i("955f"),n=i("f6c7");for(var o in n)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(o);i("029e");var r=i("828b"),s=Object(r["a"])(n["default"],a["b"],a["c"],!1,null,"57eae0e8",null,!1,a["a"],void 0);t["default"]=s.exports},f6c7:function(e,t,i){"use strict";i.r(t);var a=i("4d9e"),n=i.n(a);for(var o in a)["default"].indexOf(o)<0&&function(e){i.d(t,e,(function(){return a[e]}))}(o);t["default"]=n.a}}]);