new_app/pages/me/withdraw/realName.vue

168 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="containerView">
<up-cell-group label-width="80" :border="false">
<up-cell :label-style="{ width: '100rpx' }" title="姓名">
<template #right-icon> <up-input border="none" v-model="data.certName" placeholder="请输入姓名"></up-input> </template>
</up-cell>
<up-cell title="身份证号码">
<template #right-icon> <up-input border="none" v-model="data.certNum" placeholder="请输入身份证号码"></up-input> </template>
</up-cell>
<up-cell title="银行卡号码">
<template #right-icon> <up-input border="none" v-model="data.accountNo" placeholder="请输入银行卡号码"></up-input> </template>
</up-cell>
<up-cell title="手机号">
<template #right-icon> <up-input border="none" v-model="data.mobile" placeholder="请输入银行预留号码"></up-input> </template>
</up-cell>
</up-cell-group>
<button v-if="!data.isAccountNo" class="confirm-btn" @click="toLogin" :disabled="data.logining">认证</button>
<view style="font-size: 24upx;color: #999999;padding: 0 15rpx;margin-top: 32rpx;margin-bottom: 10rpx;">请正确填写收款人的银行卡号和真实的收款人姓名</view>
<view style="font-size: 24upx;color: #999999;padding: 0 15rpx;;margin-bottom: 10rpx;">手机号需是银行卡银行卡预留手机号</view>
<view style="font-size: 24upx;color: #999999;padding: 0 15rpx;;margin-bottom: 10rpx;">银行卡号需与收款人姓名一致</view>
<view style="font-size: 24upx;color: #999999;padding: 0 15rpx;;margin-bottom: 10rpx;">身份证信息仅可使用一次</view>
<view style="font-size: 24upx;color: #999999;padding: 0 15rpx">否则将无法正常收款请须知</view>
</view>
</template>
<script setup>
import { reactive, nextTick, ref } from 'vue';
import { onReady,onLoad,onShow } from '@dcloudio/uni-app'
import { updateUser } from '@/api/me/withdraw.js';
import { selectUserById } from '@/api/user/user.js';
import { commonType } from '@/api/init.js';
let data = reactive({
certName: null,
mobile: null,
certNum: null,
accountNo: null,
isAccountNo: null,
logining: false
})
onLoad(() => {
getUserInfo()
})
function getUserInfo () {
selectUserById().then(res=>{
if(res){
data.certName = res.certName;
data.mobile = res.mobile;
if ( res.accountNo ) {
data.accountNo = res.accountNo;
data.certNum = res.certNo;
}
data.isAccountNo = res.accountNo;
}
})
}
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
async function toLogin() {
if (!data.certName) {
uni.showToast({
title: '请设置收款人姓名',
icon: 'none'
})
} else if (!data.mobile) {
uni.showToast({
title: '请设置收款人支付宝账号',
icon: 'none'
})
} else if (!data.certNum) {
uni.showToast({
title: '请设置收款人支付宝账号',
icon: 'none'
})
} else if (!data.accountNo) {
uni.showToast({
title: '请设置收款人支付宝账号',
icon: 'none'
})
} else {
data.logining = true
let res = await updateUser({
certName: data.certName,
mobile: data.mobile,
certNum: data.certNum,
accountNo: data.accountNo.replace(/\s+/g, ''),
})
if( res) {
data.logining = false
let userInfo = uni.getStorageSync('userInfo')
userInfo.mobile = data.mobile
userInfo.mobile = data.mobile
userInfo.certNo = data.certNum
userInfo.accountNo = data.accountNo
uni.setStorageSync('userInfo', userInfo)
uni.showToast({
title: '修改成功',
icon: 'none',
complete() {
setTimeout(function() {
uni.navigateBack();
}, 1000)
}
})
}
}
}
</script>
<style lang='scss'>
page {
background: #FFFFFF;
}
.containerView {
padding:30rpx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #ffffff;
}
.confirm-btn1 {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70upx;
/* background: whitesmoke; */
background: #ff7581;
color: #FFFFFF;
font-size: 32rpx;
&:after {
border: none;
}
}
.confirm-btn {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70upx;
background: #ff7581;
color: #ffffff;
font-size: 32rpx;
border: none;
&:after {
border: none;
}
}
</style>