2023-05-15 14:13:36 +08:00

1 line
10 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";require("./sub-common/2b286cb83c3ba825c8232e7f0e8d98e4.js");require("./sub-common/e2481df95dcfca6405afd70563fc6267.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[797],{1096:function(e,n,a){var s=a(2180),t=a(4165),i=a(5861),r=a(1413),o=a(9439),c=a(1515),l=a(2954),u=a.n(l),d=a(7294),m=a(4184),f=a.n(m),_={common_safe_area_y:"index-module__common_safe_area_y___RZd4J",hoverClass:"index-module__hoverClass___XWB5l","full-100":"index-module__full-100___c7OHu","modify-ickname-content":"index-module__modify-ickname-content___rdxDk","modify-ickname-input":"index-module__modify-ickname-input___WFraT","modify-ickname-tips":"index-module__modify-ickname-tips___RTvqv","modify-ickname-operation":"index-module__modify-ickname-operation___KPRwc",button:"index-module__button___qu4xj","modify-ickname-operation-save":"index-module__modify-ickname-operation-save___whPw7","modify-ickname-operation-IKnown":"index-module__modify-ickname-operation-IKnown___bo94H","user-edit-logout":"index-module__user-edit-logout___K3aD2","warn-tips":"index-module__warn-tips___Ow2qg"},h=a(5679),x=a(9179),p=a(6028),v=a(9194),y=a(5893),j=function ModifyModal(e,n){var a=e.title,s=void 0===a?"修改昵称":a,t=e.value,i=void 0===t?"":t,r=e.isCompanyName,l=void 0!==r&&r,u=(0,d.useState)(""),m=(0,o.Z)(u,2),j=m[0],k=m[1],Z=(0,v.v)((function(e){return e.userInfo})),g=(0,d.useRef)(!0),N=(0,d.useState)(null),C=(0,o.Z)(N,2),w=C[0],b=C[1],G=(0,d.useMemo)((function(){var e=!1;return/^[a-zA-Z0-9\u4E00-\u9FA5]+$/.test(j)?(l&&(Z.adminUserInfo.first_change_name?(g.current=!0,e=!1,b((function(){return(0,y.jsx)(c.G7,{className:_["warn-tips"],children:(0,y.jsxs)(c.G7,{style:{display:"flex"},children:[(0,y.jsx)(p.Z,{customStyle:{marginRight:"8rpx"},name:"icon-tips",size:36,color:"#f79b31"}),(0,y.jsx)(c.G7,{children:"公司名称是辨识您身份的重要依据,请谨慎修改。(仅支持修改一次)"})]})})}))):(e=!0,g.current=!1,b((function(){return(0,y.jsx)(c.G7,{className:_["warn-tips"],children:(0,y.jsxs)(c.G7,{style:{display:"flex"},children:[(0,y.jsx)(p.Z,{customStyle:{marginRight:"8rpx"},name:"icon-tips",size:36,color:"#f79b31"}),(0,y.jsx)(c.G7,{children:"您修改的次数已达到上限!如需修改,请联系业务经理修改。"})]})})})))),e):(e=!0,b((function(){return(0,y.jsx)(c.G7,{className:_["warn-tips"],children:(0,y.jsxs)(c.G7,{style:{display:"flex",alignItems:"center"},children:[(0,y.jsx)(p.Z,{customStyle:{marginRight:"8rpx"},name:"icon-tips",size:36,color:"#f79b31"}),(0,y.jsx)(c.xv,{children:"仅允许输入数字、英文、中文,禁止输入其他任何字符"})]})})})),e)}),[j,l,Z]);(0,d.useEffect)((function(){k(i)}),[i]);var I=function handleTextareaReset(){k("")},S=(0,d.useState)(0),M=(0,o.Z)(S,2),P=M[0],R=M[1],T=(0,d.useState)(!1),U=(0,o.Z)(T,2),D=U[0],E=U[1];return(0,d.useImperativeHandle)(n,(function(){return{setModalShow:E}})),(0,y.jsx)(h.Z,{onClose:function onClose(){return E(!1)},title:s,show:D,children:(0,y.jsxs)(c.G7,{style:{marginBottom:"".concat(P,"px")},className:_["modify-ickname-content"],children:[w,(0,y.jsxs)(c.G7,{className:_["modify-ickname-input"],children:[(0,y.jsx)(c.gx,{disabled:!g.current,showConfirmBar:!1,"auto-focus":!0,adjustPosition:!1,value:j,onBlur:function handleBlur(){R(0)},onFocus:function handleFocus(e){R(e.detail.height)},onInput:function handleTextareaInput(e){k(e.detail.value.slice(0,20))},maxlength:20}),(0,y.jsxs)(c.xv,{children:[null==j?void 0:j.length,"/20"]})]}),(0,y.jsx)(c.G7,{className:_["modify-ickname-tips"],children:"请设置2-20个字符可由中文、英文、数字组成"}),(0,y.jsx)(c.G7,{className:_["modify-ickname-operation"],children:l?Z.adminUserInfo.first_change_name?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.Z,{round:!0,type:"primary",plain:!0,onClick:I,customClassName:f()(_.button,_["modify-ickname-operation-reset"]),children:"重置"}),(0,y.jsx)(x.Z,{round:!0,disabled:G,onClick:function onClick(){return e.save(j)},type:"primary",customClassName:f()(_.button,_["modify-ickname-operation-save"]),children:"保存"})]}):(0,y.jsx)(x.Z,{round:!0,onClick:function onClick(){return E(!1)},type:"primary",customClassName:f()(_.button,_["modify-ickname-operation-IKnown"]),children:"知道了"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.Z,{round:!0,type:"primary",plain:!0,onClick:I,customClassName:f()(_.button,_["modify-ickname-operation-reset"]),children:"重置"}),(0,y.jsx)(x.Z,{round:!0,disabled:G,onClick:function onClick(){return e.save(j)},type:"primary",customClassName:f()(_.button,_["modify-ickname-operation-save"]),children:"保存"})]})})]})})},k=(0,d.memo)((0,d.forwardRef)(j)),Z=a(1115),g=a(8106),N=a(7380),C=a(4408),w=a(1980),b=a(2495),G=a(3929),I=a(4158),S=a(9498),M=(0,d.memo)((function(e){return(0,y.jsxs)(c.G7,{onClick:e.onClick,className:"user-edit-list",children:[(0,y.jsx)(c.G7,{className:"user-edit-list-left",children:e.label}),(0,y.jsxs)(c.G7,{className:"user-edit-list-right",children:[(0,y.jsx)(c.G7,{children:e.children?e.children:e.data?e.data:(0,y.jsx)(c.G7,{className:"user-edit-list-right-placeholder",children:e.placeholder})}),!e.useIcon&&(0,y.jsx)(c.xv,{className:"iconfont icon-a-moreback"})]})]})})),userEdit=function(){var e,n,a;(0,S.av)("pages/userEdit/index");var s=(0,C.Z)(),l=s.getPhoneNumber,m=s.getAdminUserInfo,f=(0,v.v)((function(e){return e.userInfo})).adminUserInfo,_=(0,d.useRef)(null),h=(0,d.useRef)(null),x=(0,d.useState)(f),j=(0,o.Z)(x,2),P=j[0],R=j[1];(0,d.useEffect)((function(){R((0,r.Z)((0,r.Z)({},P),f))}),[f]);var T=(0,g.o5)().fetchData,U={text:[{message:"请输入"}]},D=(0,N.h)().fetchData,E=(0,N.S)().fetchData,z=function(){var e=(0,i.Z)((0,t.Z)().mark((function _callee2(e,n){return(0,t.Z)().wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:(0,Z.Pc)({text:e},U).then((0,i.Z)((0,t.Z)().mark((function _callee(){var a,s,i,o;return(0,t.Z)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:if("Ickname"!=n){t.next=6;break}return t.next=3,T({real_name:e});case 3:a=t.sent,t.next=12;break;case 6:return t.next=8,E();case 8:return s=t.sent,t.next=11,D((0,r.Z)((0,r.Z)({},s.data),{},{company_name:e}));case 11:a=t.sent;case 12:a.success?(m(),null===(i=_.current)||void 0===i||i.setModalShow(!1),null===(o=h.current)||void 0===o||o.setModalShow(!1),Z.Z9.success("保存成功")):Z.Z9.none(a.msg);case 13:case"end":return t.stop()}}),_callee)})))).catch((function(e){Z.Z9.none(e)}));case 1:case"end":return a.stop()}}),_callee2)})));return function handleTextareaSave(n,a){return e.apply(this,arguments)}}(),K=(0,g.nM)().fetchData,B=(0,w.Z)().getWxPhoto,F=(0,g.ec)(),A=F.fetchData,$=F.state,O=function(){var e=(0,i.Z)((0,t.Z)().mark((function _callee4(){var e,n,a;return(0,t.Z)().wrap((function _callee4$(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,A();case 2:(e=s.sent).success&&(null===(n=e.data)||void 0===n||null===(a=n.list)||void 0===a||a.every((function(e,n){return e.id!=f.purchaser_type||(R((0,r.Z)((0,r.Z)({},f),{},{company_type_index:n})),!1)})));case 4:case"end":return s.stop()}}),_callee4)})));return function getCompanyTypeData(){return e.apply(this,arguments)}}(),q=(0,G.Z)();q.removeToken,q.removeSessionKey,q.removeUserInfo,(0,d.useMemo)((function(){var e;return $.data.list?null===(e=$.data.list)||void 0===e?void 0:e.map((function(e){return 0==e.id&&(e.name="--请选择类型--"),e})):[]}),[$]);(0,d.useEffect)((function(){R((0,r.Z)((0,r.Z)({},f),{},{company_type_index:0})),O()}),[]);var H=(0,v.v)((function(e){return e.userInfo}));return(0,y.jsxs)(c.G7,{className:"user-edit",children:[(0,y.jsxs)(c.G7,{onClick:function handleSelectRortrait(){u().showModal({title:"提示",content:"是否确定更改头像?",showCancel:!0,success:function success(e){return(0,i.Z)((0,t.Z)().mark((function _callee3(){var n,a;return(0,t.Z)().wrap((function _callee3$(s){for(;;)switch(s.prev=s.next){case 0:if(!e.confirm){s.next=8;break}return s.next=3,B("mall");case 3:return n=s.sent,s.next=6,K({avatar_url:b.KC+n.url});case 6:(a=s.sent).success?(m(),Z.Z9.success("保存成功")):Z.Z9.none(a.msg);case 8:case"end":return s.stop()}}),_callee3)})))()}})},className:"user-edit-portrait",children:[(0,y.jsx)(c.Ee,{src:null==P?void 0:P.avatar_url}),(0,y.jsx)(c.G7,{children:"点击编辑头像"})]}),(0,y.jsxs)(c.G7,{className:"user-edit-content",children:[(0,y.jsx)(M,{onClick:function handleClickNickname(){var e;null===(e=_.current)||void 0===e||e.setModalShow(!0)},data:null==P?void 0:P.user_name,label:"昵称",placeholder:"请输入",icon:""}),(0,y.jsx)(M,{label:"手机号",placeholder:"去绑定",icon:"",useIcon:"true",children:null!=P&&P.phone?(0,y.jsx)(c.G7,{className:"user-edit-content-phone",children:(0,y.jsx)(c.G7,{children:null==P?void 0:P.phone})}):(0,y.jsx)(c.zx,{className:"user-edit-content-bindphone",openType:"getPhoneNumber",onGetPhoneNumber:function mGetPhoneNumber(e){var n;null!==(n=e.detail)&&void 0!==n&&n.code?l(e.detail.code):Z.Z9.none("绑定失败!")},children:"去绑定"})}),(0,y.jsx)(M,{onClick:function handleClickCompanyName(){var e;null===(e=h.current)||void 0===e||e.setModalShow(!0)},data:null==P?void 0:P.company_name,label:"公司名称",placeholder:"待绑定",icon:""})]}),!(null==H||null===(e=H.adminUserInfo)||void 0===e||!e.sale_user_id)&&(0,y.jsxs)(c.G7,{className:"customer_service",children:[(0,y.jsx)(c.Ee,{className:"customer_service_image",src:(0,I.z)("/mall/avatar2.png","")}),(0,y.jsxs)(c.G7,{className:"customer_service_name_and_phone",children:[(0,y.jsxs)(c.G7,{className:"customer_service_name",children:[(0,y.jsx)(c.xv,{children:null==H||null===(n=H.adminUserInfo)||void 0===n?void 0:n.sale_user_name}),(0,y.jsx)(c.xv,{children:"专属客户经理"})]}),(0,y.jsx)(c.G7,{className:"customer_service_phone",children:null==H||null===(a=H.adminUserInfo)||void 0===a?void 0:a.sale_user_phone})]}),(0,y.jsxs)(c.G7,{className:"customer_service_button",onClick:function onClick(){return function onPhone(){var e,n;if(null==H||null===(e=H.adminUserInfo)||void 0===e||!e.sale_user_phone)return Z.Z9.error("手机号不能为空");u().makePhoneCall({phoneNumber:null==H||null===(n=H.adminUserInfo)||void 0===n?void 0:n.sale_user_phone})}()},children:[(0,y.jsx)(p.Z,{name:"icon-dianhua",size:43}),(0,y.jsx)(c.xv,{children:"拨打"})]})]}),(0,y.jsx)(k,{title:"修改昵称",ref:_,value:null==P?void 0:P.user_name,save:function save(e){return z(e,"Ickname")}}),(0,y.jsx)(k,{title:"修改名称",isCompanyName:!0,ref:h,value:null==P?void 0:P.company_name,save:function save(e){return z(e,"companyName")}})]})};userEdit.enableShareAppMessage=!0;Page((0,s.createPageConfig)(userEdit,"pages/userEdit/index",{root:{cn:[]}},{navigationBarTitleText:"编辑个人资料",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[3479,4235,2107,1216,8592],(function(){return n=1096,e(e.s=n);var n}));e.O()}]);