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.
219 lines
4.7 KiB
Vue
219 lines
4.7 KiB
Vue
<template>
|
|
<view class="main">
|
|
<view class='module' v-if="userInfo.user==0">
|
|
<view class='cu-form-group'>
|
|
<view class='title'>会员编号</view>
|
|
{{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 {
|
|
userInfo: null,
|
|
form: {
|
|
memberNum: '00100003',
|
|
mobilePhone: null,
|
|
password: null,
|
|
newPassword: null,
|
|
PassWord: null,
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
|
|
submit: function() {
|
|
|
|
if (!this.form.mobilePhone) {
|
|
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.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 {
|
|
if (this.userInfo.user == 0) {
|
|
this.$api.changepassword(this.form).then(res => {
|
|
console.log(res);
|
|
if (res.code == '000000') {
|
|
uni.showToast({
|
|
title: '密码修改成功',
|
|
icon: "none",
|
|
duration: 1000
|
|
})
|
|
setTimeout(function() {
|
|
uni.reLaunch({
|
|
url: "../../../../login/login"
|
|
})
|
|
}, 1000);
|
|
}else{
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: "none",
|
|
duration: 1000
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
delete this.form.memberNum
|
|
this.$api.staffchangePassword(this.form).then(res => {
|
|
console.log(res);
|
|
if (res.code == '000000') {
|
|
uni.showToast({
|
|
title: '密码修改成功',
|
|
icon: "none",
|
|
duration: 1000
|
|
})
|
|
setTimeout(function() {
|
|
uni.reLaunch({
|
|
url: "../../../../login/login"
|
|
})
|
|
}, 1000);
|
|
}else{
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: "none",
|
|
duration: 1000
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
},
|
|
created() {
|
|
this.userInfo = uni.getStorageSync('userInfo')
|
|
}
|
|
}
|
|
</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>
|