"use strict";var e=(e,o,n)=>new Promise(((l,i)=>{var t=e=>{try{a(n.next(e))}catch(o){i(o)}},r=e=>{try{a(n.throw(e))}catch(o){i(o)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(t,r);a((n=n.apply(e,o)).next())}));const o=require("../../../common/vendor.js"),n=require("../../../sheep/index.js"),l=require("../../../sheep/hooks/useModal.js"),i=require("../../../sheep/api/infra/file.js"),t=require("../../../sheep/api/member/user.js");if(!Array){(o.resolveComponent("su-image")+o.resolveComponent("uni-easyinput")+o.resolveComponent("uni-forms-item")+o.resolveComponent("su-radio")+o.resolveComponent("uni-list-item")+o.resolveComponent("uni-list")+o.resolveComponent("uni-forms")+o.resolveComponent("su-fixed")+o.resolveComponent("s-layout")+o.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../sheep/ui/su-image/su-image.js")+(()=>"../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js")+(()=>"../../../sheep/ui/su-radio/su-radio.js")+(()=>"../../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js")+(()=>"../../../uni_modules/uni-list/components/uni-list/uni-list.js")+(()=>"../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js")+(()=>"../../../sheep/ui/su-fixed/su-fixed.js")+(()=>"../../../sheep/components/s-layout/s-layout.js"))();const r={__name:"info",setup(r){const a=o.reactive({model:{},rules:{},thirdInfo:{}}),s=[{name:"男",value:"1"},{name:"女",value:"2"}],u=o.computed((()=>n.sheep.$store("user").userInfo));function p(e){a.model.sex=e.detail.value}const m=()=>{l.showAuthModal("changeMobile")};function d(o){!function(o){e(this,null,(function*(){if(!o)return;const{data:e}=yield i.FileApi.uploadFile(o);a.model.avatar=e}))}(o.detail.avatarUrl||"")}function c(){l.showAuthModal("changePassword")}function f(){return e(this,null,(function*(){(yield n.sheep.$platform.useProvider("wechat").bind())&&(yield y())}))}function h(){o.index.showModal({title:"解绑提醒",content:"解绑后您将无法通过微信登录此账号",cancelText:"再想想",confirmText:"确定",success:function(o){return e(this,null,(function*(){if(!o.confirm)return;(yield n.sheep.$platform.useProvider("wechat").unbind(a.thirdInfo.openid))&&(yield y())}))}})}function v(){return e(this,null,(function*(){const{code:e}=yield t.UserApi.updateUser({avatar:a.model.avatar,nickname:a.model.nickname,sex:a.model.sex});0===e&&(yield y())}))}const y=()=>e(this,null,(function*(){const e=yield n.sheep.$store("user").getInfo();if(a.model=o.clone(e),"H5"!==n.sheep.$platform.name){const e=yield n.sheep.$platform.useProvider("wechat").getInfo();a.thirdInfo=e||{}}}));return o.onBeforeMount((()=>{y()})),(e,l)=>{var i,t,r,y,b;return o.e({a:o.p({isPreview:!0,current:0,src:null==(i=a.model)?void 0:i.avatar,height:160,width:160,radius:80,mode:"scaleToFill"}),b:o.o(d),c:o.o((e=>a.model.nickname=e)),d:o.p({type:"nickname",placeholder:"设置昵称",inputBorder:!1,placeholderStyle:e.placeholderStyle,modelValue:a.model.nickname}),e:o.p({name:"nickname",label:"昵称"}),f:o.f(s,((e,n,l)=>{var i;return{a:e.value,b:parseInt(e.value)===(null==(i=a.model)?void 0:i.sex),c:o.t(e.name),d:e.value}})),g:o.o(p),h:o.p({name:"sex",label:"性别"}),i:null==(t=u.value.verification)?void 0:t.mobile},(null==(r=u.value.verification)?void 0:r.mobile)?{j:o.p({modelValue:!0})}:{},{k:o.o((e=>u.value.mobile=e)),l:o.p({placeholder:"请绑定手机号",inputBorder:!1,disabled:!0,styles:{disableColor:"#fff"},placeholderStyle:e.placeholderStyle,clearable:!1,modelValue:u.value.mobile}),m:o.o(m),n:o.p({name:"mobile",label:"手机号"}),o:null==(y=u.value.verification)?void 0:y.password},(null==(b=u.value.verification)?void 0:b.password)?{p:o.p({modelValue:!0})}:{},{q:o.o((e=>u.value.password=e)),r:o.p({placeholder:"点击修改登录密码",inputBorder:!1,styles:{disableColor:"#fff"},disabled:!0,placeholderStyle:"color:#BBBBBB;font-size:28rpx;line-height:normal",clearable:!1,modelValue:u.value.password}),s:o.o(c),t:o.p({name:"password",label:"登录密码"}),v:o.o((e=>o.unref(n.sheep).$router.go("/modules/mall/user/address/list"))),w:o.p({clickable:!0,title:"地址管理",showArrow:!0,border:!1}),x:o.p({model:a.model,rules:a.rules,labelPosition:"left",border:!0}),y:"H5"!==o.unref(n.sheep).$platform.name},"H5"!==o.unref(n.sheep).$platform.name?o.e({z:"WechatOfficialAccount"===o.unref(n.sheep).$platform.name},"WechatOfficialAccount"===o.unref(n.sheep).$platform.name?{A:o.unref(n.sheep).$url.static("/static/img/shop/platform/WechatOfficialAccount.png")}:{},{B:"WechatMiniProgram"===o.unref(n.sheep).$platform.name},"WechatMiniProgram"===o.unref(n.sheep).$platform.name?{C:o.unref(n.sheep).$url.static("/static/img/shop/platform/WechatMiniProgram.png")}:{},{D:"App"===o.unref(n.sheep).$platform.name},"App"===o.unref(n.sheep).$platform.name?{E:o.unref(n.sheep).$url.static("/static/img/shop/platform/wechat.png")}:{},{F:a.thirdInfo},a.thirdInfo?{G:o.unref(n.sheep).$url.cdn(a.thirdInfo.avatar),H:o.t(a.thirdInfo.nickname)}:{},{I:a.thirdInfo.openid},a.thirdInfo.openid?{J:o.o(h)}:{K:o.o(f)}):{},{L:o.o(v),M:o.p({bottom:!0,placeholder:!0,bg:"none"}),N:o.p({title:"用户信息"})})}}},a=o._export_sfc(r,[["__scopeId","data-v-198aae1d"]]);wx.createPage(a);