停用账户优化

This commit is contained in:
mengxiaolong
2021-03-11 11:03:17 +08:00
parent bbc0ae04c8
commit b1a2fa9ccd
2 changed files with 15 additions and 156 deletions

View File

@@ -61,7 +61,7 @@ export default [
name: 'LogoutAgent',
component: LogoutAgent,
meta: {
title: '注销账户',
title: '停用账户',
index: 1
}
},

View File

@@ -1,57 +1,20 @@
<template>
<div class="insured-info-container">
<van-cell-group>
<van-field
v-if="clickMobileDisabled"
:value="logoutDTO.mobile | dataMaskingMobile"
clearable
required
label="电话号码"
name="联系电话"
placeholder="请输入"
v-validate="'required|mobile'"
:disabled="true"
/>
<van-field
v-if="clickMobileDisabled"
v-model="logoutDTO.smsCode"
required
center
label="验证码"
clearable
placeholder="请输入短信验证码"
@input="validateNext"
>
<van-button type="danger" slot="button" size="small" @click="getCode" :disabled="codeDisabled" v-no-more-click="1000">
{{ codeDisabled ? `${countDown}s后重新获取` : '获取验证码' }}
</van-button>
</van-field>
<van-field v-model="logoutDTO.pwd" clearable required type="password" label="密码" name="密码" placeholder="请输入密码" @input="validateNext" />
<van-field
v-model="logoutDTO.confirmPwd"
clearable
required
type="password"
label="确认密码"
name="确认密码"
placeholder="请输入密码"
@input="validateNext"
/>
</van-cell-group>
<van-field v-model="pwd" clearable required type="password" label="登陆密码" name="密码" placeholder="请输入登陆密码" />
<p style="color: #ff0000; font-size: 14px;" class="bg-white p10">温馨提示 此账号为公司员工内部账号一旦注销将无法再次登陆该账号</p>
<p style="color: #ff0000; font-size: 14px;" class="bg-white p10 pb0 mb0">温馨提示</p>
<p style="color: #ff0000; font-size: 14px;" class="bg-white pl10">停用账号将无法再次登陆使用请您谨慎操作</p>
<van-button type="danger" size="large" class="logout_button mt30" :disabled="checkNextDisabled" @click="logoutAgent">注销账户 </van-button>
<van-button type="danger" size="large" class="logout_button mt10" :disabled="!Boolean(pwd)" @click="logoutAgent">停用账户 </van-button>
<van-dialog v-model="show" title="提示" @confirm="logoutAgentInfo" show-cancel-button>
是否注销用户
<p style="text-align: center" class="p10">是否停用账户?</p>
</van-dialog>
</div>
</template>
<script>
import { Field, CellGroup, Popup, Picker, Checkbox, Area, Dialog } from 'vant'
import { getAgentInfo, logoutAgent } from '@/api/ebiz/my/my.js'
import { getAuthCode } from '@/api/ebiz/sale/sale'
import { logoutAgent } from '@/api/ebiz/my/my.js'
export default {
name: 'logoutAgent',
@@ -66,40 +29,12 @@ export default {
},
data() {
return {
logoutDTO: {
smsId: null,
smsCode: null,
mobile: null,
pwd: null,
confirmPwd: null
},
show: false,
timeId: null, // 计时器ID
countDown: 60, // 倒计时
codeDisabled: true, // 获取验证码按钮是否禁用
branchType: null,
checkNextDisabled: true, // 禁用修改
clickMobileDisabled: false // 手机号是否存在
}
},
async mounted() {
this.codeDisabled = false
// 获取代理人信息
const res = await getAgentInfo({ '89': '890' })
if (res.result == 0) {
if (/^[0-9][0-9]*$/.test(res.branchType)) {
// 内勤 手机号格式正确
this.logoutDTO.mobile = res.phoneNo
this.codeDisabled = false
this.clickMobileDisabled = true
}
} else {
return this.$toast(res.resultMessage)
pwd: '',
show: false
}
},
created() {
if (this.$CacheUtils.getLocItem('businessNo') && this.$CacheUtils.getLocItem('claimsClear')) {
this.init()
this.$CacheUtils.getLocItem('claimsClear', '')
} else {
this.$CacheUtils.setLocItem('businessNo', '')
@@ -107,95 +42,17 @@ export default {
},
methods: {
init() {},
//获取验证码
getCode() {
if (!this.logoutDTO.mobile || this.logoutDTO.mobile == '') {
return this.$toast('代理人信息异常请联系管理员')
}
this.codeDisabled = true
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.logoutDTO.mobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
getAuthCode(data).then(res => {
if (res.result == 0) {
this.logoutDTO.smsId = res.sessionId
this.logoutDTO.smsCode = null
//倒计时
this.timeId = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
window.clearInterval(this.timeId)
this.codeDisabled = false
this.countDown = 60
}
}, 1000)
} else {
this.$toast(res.resultMessage)
}
})
},
//操作下一步按钮状态
validateNext() {
if (this.clickMobileDisabled) {
if (!this.logoutDTO.smsCode || this.logoutDTO.smsCode == '') {
this.checkNextDisabled = true
return
}
}
// 2、判断密码是否一致
if (!this.logoutDTO.pwd || this.logoutDTO.pwd == '') {
this.checkNextDisabled = true
return
}
if (!this.logoutDTO.confirmPwd || this.logoutDTO.confirmPwd == '') {
this.checkNextDisabled = true
return
}
if (this.logoutDTO.pwd.length < 6 || this.logoutDTO.confirmPwd.length < 6) {
this.checkNextDisabled = true
return
}
this.checkNextDisabled = false
return
},
// 注销
logoutAgent() {
// 1、判断计时器
if (this.clickMobileDisabled) {
if (!this.codeDisabled) {
return this.$toast('请先获取验证码')
}
//
if (!this.logoutDTO.smsCode || this.logoutDTO.smsCode == '') {
return this.$toast('请输入短信验证码')
}
}
// 2、判断密码是否一致
if (!this.logoutDTO.pwd || this.logoutDTO.pwd == '') {
if (!this.pwd || this.pwd.trim() === '') {
this.pwd = ''
return this.$toast('请输入密码')
}
if (!this.logoutDTO.confirmPwd || this.logoutDTO.confirmPwd == '') {
return this.$toast('请输入确认密码')
}
if (!(this.logoutDTO.pwd == this.logoutDTO.confirmPwd)) {
return this.$toast('两次输入密码不一致')
}
this.logoutAgentInfo()
this.show = true
},
logoutAgentInfo() {
let req = {
smsId: this.logoutDTO.smsId,
smsCode: this.logoutDTO.smsCode,
mobile: this.logoutDTO.mobile,
password: this.$MD5(this.logoutDTO.pwd),
confirmPwd: this.$MD5(this.logoutDTO.confirmPwd)
password: this.$MD5(this.pwd)
}
// 调用注销接口
logoutAgent(req).then(res => {
@@ -217,6 +74,8 @@ export default {
<style lang="scss" scoped>
.insured-info-container {
height: 100vh;
background-color: #fff;
/deep/ .van-checkbox {
margin-left: auto;
}