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

206 lines
4.5 KiB
Vue

<template>
<view class="main">
<view class='module'>
<view class='cu-form-group'>
<view class='title'>会员编号</view>
{{form.memberNum!=undefined?form.memberNum:'请先登录'}}
</view>
<view class='common-hr'></view>
</view>
<!-- <view class='module'>
<view class='cu-form-group'>
<view class='title'>手机号码</view>
<input v-model="form.mobilePhone" maxlength="11" type='number' placeholder='请输入手机号码'></input>
</view>
<view class='common-hr'></view>
</view> -->
<view class='module'>
<view class='cu-form-group'>
<view class='title'>原始密码</view>
<input v-model="form.password" type='password' placeholder='请输入原始密码'></input>
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class='cu-form-group'>
<view class='title'>新的密码</view>
<input v-model="form.newPassword" type='password' placeholder='请输入新的密码'></input>
</view>
<view class='common-hr'></view>
</view>
<view class='module'>
<view class='cu-form-group'>
<view class='title'>确认密码</view>
<input v-model="form.PassWord" type='password' placeholder='请再次输入新密码'></input>
</view>
<view class='common-hr'></view>
</view>
<button @click='submit()' class="bg-green confirmChange"></button>
<view class='footer'>
<view class='footer-hr'></view>
<view class='company-name'>德财美业</view>
<view class='footer-hr'></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
memberNum: null,
mobilePhone: null,
password: null,
newPassword: null,
PassWord: null,
},
userInfo: {},
}
},
methods: {
submit: function() {
if (!this.form.memberNum) {
uni.showToast({
title: '请输入会员编码',
icon: "none",
duration: 1000
});
return;
} else if (!this.form.newPassword) {
uni.showToast({
title: '请输入新密码密码',
icon: "none",
duration: 1000
});
return;
} else if (!this.form.PassWord) {
uni.showToast({
title: '请再次输入密码',
icon: "none",
duration: 1000
});
return;
} else if (this.form.newPassword != this.form.PassWord) {
uni.showToast({
title: '两次输入的密码不符',
icon: "none",
duration: 1000
})
return;
} else {
let params = {
id:this.form.id,
password:this.form.password,
newPassword:this.form.newPassword
}
this.$api.changepassword(this.form).then(res => {
console.log(res);
if (res.code == '000000') {
uni.showModal({
title: '提示',
content: '密码修改成功 , 请重新登录',
showCancel: false,
success: function(res) {
setTimeout(function() {
uni.reLaunch({
url: "../../../../login/login"
})
}, 1000);
}
})
} else {
uni.showModal({
title: '提示',
content:res.message,
showCancel: false,
success: function(res) {
}
})
}
})
}
}
},
onShow: function() {
this.userInfo = uni.getStorageSync('userInfo')
this.form.memberNum = this.userInfo.memberNum
this.form.storeId = this.userInfo.storeId
this.form.id = this.userInfo.id
},
onPullDownRefresh: function() {
setTimeout(function() {
uni.redirectTo({
url:'./change-password'
})
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 2000
});
uni.stopPullDownRefresh();
}, 1000);
}
}
</script>
<style>
.module {
background-color: white;
padding: 10rpx 30rpx;
}
.main {
width: 100%;
}
.title>image {
width: 58rpx;
height: 58rpx;
margin-left: 30rpx;
margin-right: 30rpx;
}
.main .common-hr {
height: 1upx;
width: 100%;
background-color: #f5f5f5;
}
/* ============================= footer ============================== */
.footer {
position: absolute;
bottom: 30rpx;
left: 100rpx;
}
.footer-hr {
display: inline-block;
width: 200rpx;
height: 1rpx;
background-color: #CCC;
margin: 0 10rpx 10rpx 10rpx;
}
.company-name {
color: #CCC;
display: inline;
font-size: 30rpx;
}
/* ============================= 确定修改密码按钮 ============================== */
.confirmChange {
width: 92%;
height: 80rpx;
margin: 0 auto;
margin-top: 30rpx;
}
</style>