123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- <template>
- <view class="container register">
- <view class="register-main first clearfix">
- <view class="register-row clearfix">
- <view class="register-from">
- <view class="label">原手机号:</view>
- <view class="row-input">{{ params.mobile }}</view>
- </view>
- </view>
- <view class="register-row clearfix">
- <view class="register-from code">
- <input class="row-input" type="number" v-model="params.smsCode" placeholder="请输入原手机号的验证码" placeholder-class="place-holder" maxlength="6"/>
- </view>
- <view class="register-from btn" :class="[isMobileDisabled ? 'disabled' : '']">
- <button class="row-input" type="button" @click.stop="getMobileCodeFn" :disabled="isMobileDisabled">{{ mobileCodeText }}</button>
- </view>
- </view>
- <view class="register-row clearfix">
- <view class="register-from">
- <input class="row-input" type="number" v-model="params.newMobile" placeholder="请输入新手机号" placeholder-class="place-holder" maxlength="11"/>
- </view>
- </view>
- <view class="register-row clearfix">
- <view class="register-from code">
- <input class="row-input" type="number" v-model="params.newSmsCode" placeholder="请输入新手机号的验证码" placeholder-class="place-holder" maxlength="6"/>
- </view>
- <view class="register-from btn" :class="[isNewMobileDisabled ? 'disabled' : '']" >
- <button class="row-input" type="button" @click.stop="getNewMobileCodeFn" :disabled="isNewMobileDisabled">{{ newMobileCodeText }}</button>
- </view>
- </view>
- <view class="register-row clearfix" style="border: 0;">
- <view class="register-btn" @click="bindMobileCheck">确定</view>
- </view>
- <view class="register-text clearfix">
- <view >注意:本操作更换的是机构联系人的手机号,不是运营人员的手机号!</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapMutations } from 'vuex';
- var self;
- export default{
- data() {
- return{
- count: '', //倒计时
- newCount: '', //倒计时
- codeTime: null,
- codeTimeNew: null,
- mobileCodeText: '获取验证码',
- newMobileCodeText: '获取验证码',
- isMobileDisabled: false, //手机验证码按钮控制
- isNewMobileDisabled: false, //手机验证码按钮控制
- params:{
- mobile:'', //旧联系人手机号
- newMobile:'', //新联系人手机号
- smsCode:'', //原手机号验证码
- newSmsCode:'',//新手机号手机验证码
- userId:0
- },
- }
- },
- onLoad(option) {
- this.params.mobile = option.phone
- },
- methods:{
- bindMobileCheck(){
- if( this.params.newMobile == ''){
- this.$util.msg('请输入新的手机号码',2000);
- return
- }
- if(!this.$reg.isMobile(this.params.newMobile)){
- this.$util.msg('请输入正确的手机号码',2000);
- return
- }
- if( this.params.smsCode == ''){
- this.$util.msg('请输入旧手机验证码',2000);
- return
- }
- if(!this.$reg.isMobileCode(this.params.smsCode)){
- this.$util.msg('旧手机验证码格式不正确',2000);
- return
- }
- if( this.params.newSmsCode == ''){
- this.$util.msg('请输入新手机验证码',2000);
- return
- }
- if(!this.$reg.isMobileCode(this.params.newSmsCode)){
- this.$util.msg('新手机验证码格式不正确',2000);
- return
- }
- this.UserService.UserUpdateMobile(this.params).then(response =>{
- this.$util.msg('修改成功',1500,true,'success')
- setTimeout(()=>{
- uni.navigateBack({delta: 1})
- },2000)
- }).catch( error =>{
- this.$util.msg(error.msg,2000);
- })
- },
- getMobileCodeFn(){
- if( this.params.mobile == ''){
- this.$util.msg('请输入手机号',2000);
- return
- }
- if(!this.$reg.isMobile(this.params.mobile)){
- this.$util.msg('请输入正确的手机号',2000);
- return
- }
- this.isMobileDisabled = true;
- this.PublicService.GetRegisterMobileCode(
- {
- mobile:this.params.mobile,
- isCheckCaptcha:1,
- activateCodeType:4,
- platformType:0
- }
- ).then(response =>{
- this.$util.msg('验证短信已发送',2000);
- const TIME_COUNT = 60;
- if (!this.codeTime) {
- this.count = TIME_COUNT;
- this.isMobileDisabled = true;
- this.codeTime = setInterval(() => {
- if (this.count > 1 && this.count <= TIME_COUNT) {
- this.count--
- this.mobileCodeText = this.count +'s重新发送'
- } else {
- this.isMobileDisabled = false;
- clearInterval(this.codeTime)
- this.codeTime = null
- this.mobileCodeText = '获取验证码'
- }
- },1000)
- }
- }).catch( error =>{
- this.$util.msg(error.msg,2000);
- this.isMobileDisabled = false;
- })
- },
- getNewMobileCodeFn(){
- if( this.params.newMobile == ''){
- this.$util.msg('请输入手机号',2000);
- return
- }
- if(!this.$reg.isMobile(this.params.newMobile)){
- this.$util.msg('请输入正确的手机号',2000);
- return
- }
- this.isNewMobileDisabled = true;
- this.PublicService.GetRegisterMobileCode(
- {
- mobile:this.params.newMobile,
- isCheckCaptcha:1,
- activateCodeType:5,
- platformType:0
- }
- ).then(response =>{
- this.$util.msg('验证短信已发送',2000);
- const TIME_COUNT = 60;
- if (!this.codeTimeNew) {
- this.newCount = TIME_COUNT;
- this.isNewMobileDisabled = true;
- this.codeTimeNew = setInterval(() => {
- if (this.newCount > 1 && this.newCount <= TIME_COUNT) {
- this.newCount--
- this.newMobileCodeText = this.newCount +'s重新发送'
- } else {
- this.isNewMobileDisabled = false;
- clearInterval(this.codeTimeNew)
- this.codeTimeNew = null
- this.newMobileCodeText = '获取验证码'
- }
- },1000)
- }
- }).catch( error =>{
- this.$util.msg(error.msg,2000);
- this.isNewMobileDisabled = false;
- })
- }
- },
- onShow() {
- this.$api.getStorage().then((resolve) =>{
- this.params.userId = resolve.userId ? resolve.userId : 0
- })
- }
- }
- </script>
- <style lang="scss">
- .register{
- width: 100%;
- height: auto;
- border-top: 1px solid #F7F7F7;
- .model-warp.none{
- display: none;
- }
- .model-warp.show{
- display: block;
- }
- .register-main{
- width: 100%;
- height: auto;
- &.detailed{
- padding-bottom: 300rpx;
- }
- &.first{
- padding-top: 40rpx;
- }
- .register-tips{
- display: flex;
- flex-direction: column;
- align-items: center;
- line-height: 44rpx;
- font-size: $font-size-24;
- color: #FF0000;
- margin-bottom: 40rpx;
- .iconfont{
- font-size: $font-size-24;
- }
- }
- .register-row{
- width: 702rpx;
- height: auto;
- margin: auto;
- // margin-bottom: 20rpx;
- border-bottom: 2rpx solid #e1e1e1;
- .register-title{
- line-height: 60rpx;
- font-size: $font-size-32;
- color: $text-color;
- text-align: left;
- padding-left: 20rpx;
- .txt{
- font-size: $font-size-26;
- font-weight: normal;
- }
- }
- .row-btn{
- position: absolute;
- right: 24rpx;
- top: 0;
- line-height: 88rpx;
- text-align: center;
- font-size: $font-size-28;
- color: $color-system;
- }
- .register-from{
- width: 702rpx;
- height: 64rpx;
- padding: 24rpx 0;
- position: relative;
- .label{
- text-align: left;
- font-size: $font-size-28;
- color: #666666;
- line-height: 64rpx;
- float: left;
- }
- .row-input{
- width: 440rpx;
- padding-left:10rpx;
- font-size: $font-size-28;
- color: $text-color;
- line-height: 64rpx;
- float: left;
- height: 64rpx;
- &.none{
- color: #999999;
- }
- }
- &.code{
- width: 410rpx;
- float: left;
- margin-right: 20rpx;
- .row-input{
- width: 390rpx;
- }
- }
- &.btn{
- width: 180rpx;
- height:64rpx;
- float: right;
- padding: 0;
- border: 2rpx solid #e15616;
- border-radius: 45rpx;
- .row-input{
- width: 180rpx;
- height: 64rpx;
- line-height: 64rpx;
- padding: 0;
- color:#E15616;
- text-align: center;
- border-radius: 45rpx;
- font-size: $font-size-24;
- &.none{
- background: #F7F7F7;
- }
- }
- &.disabled{
- background: #F7F7F7;
- border: 2rpx solid #F7F7F7;
- .row-input{
- background: #F7F7F7;
- color: #999999;
- }
- }
- }
- &.btn{
- margin-top: 20rpx;
- }
- }
-
- }
- .register-btn{
- width: 600rpx;
- height: 90rpx;
- border-radius: 45rpx;
- font-size: $font-size-28;
- line-height: 88rpx;
- color: #FFFFFF;
- margin: 0 auto;
- text-align: center;
- background: $btn-confirm;
- margin-top: 96rpx;
- &.sub{
- margin-top: 0;
- }
- }
- }
- }
- .register-text{
- width: 506rpx;
- color: #fea785;
- font-size: 22rpx;
- line-height: 32rpx;
- margin: 30rpx auto;
- text-align: center
- }
- .place-holder{
- color: #b2b2b2;
- }
- </style>
|