web-base-h5/pages/selfService/realName/realName.vue

693 lines
33 KiB
Vue
Raw Normal View History

2025-03-23 09:29:40 +08:00
<template>
<view class="content">
<div class="img_cen" v-if="hasRegin">
2025-03-23 09:29:40 +08:00
<div class="status-img">
<img src="@/static/images/status3.png" />
</div>
<div class="status-size bolds">{{ '已认证' }}</div>
2025-03-23 09:29:40 +08:00
</div>
<view class="theform" v-else>
<u--form
labelPosition="left"
:model="dataForm"
:rules="rules"
ref="uForm"
>
<u-form-item required label-width="180rpx" :label="'证件(正面)'">
<uploadImg
:ifsfz="true"
@imageUploaded="imageUploaded1"
prop="idFront"
ref="uploadImg1"
style="margin-right: 30rpx"
:bgimg="`../../../static/images/idCard1.png`"
v-model="dataForm.idFront"
></uploadImg>
2025-04-09 11:10:35 +08:00
</u-form-item>
<u-form-item required label-width="180rpx" :label="'证件(反面)'">
<uploadImg
:ifsfz="true"
@imageUploaded="imageUploaded2"
prop="idBack"
ref="uploadImg2"
style="margin-right: 30rpx"
:bgimg="`../../../static/images/idCard2.png`"
v-model="dataForm.idBack"
></uploadImg>
2025-04-09 11:10:35 +08:00
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'真实姓名'"
prop="accountName"
ref="item1"
>
<u--input
:placeholder="'请输入'"
v-model="dataForm.accountName"
></u--input>
2025-03-23 09:29:40 +08:00
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'性别'"
prop="sex"
ref="item1"
>
<u-radio-group v-model="dataForm.sex" @change="radioGroupChange">
<u-radio
:customStyle="{ marginRight: '16rpx' }"
v-for="(item, index) in sexList"
:key="index"
:name="item.value"
>{{ item.label }}</u-radio
>
2025-03-23 09:29:40 +08:00
</u-radio-group>
</u-form-item>
<!-- </u-form-item> -->
<u-form-item
required
label-width="180rpx"
:label="'证件类型'"
prop="idName"
@click="showCtype = true"
ref="item1"
>
<u--input
suffixIcon="arrow-right"
readonly
v-model="dataForm.idName"
disabled
:placeholder="'请选择'"
>
2025-03-23 09:29:40 +08:00
</u--input>
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'证件号码'"
prop="idCard"
ref="item1"
>
<u--input
:placeholder="'请输入'"
v-model="dataForm.idCard"
></u--input>
2025-03-23 09:29:40 +08:00
</u-form-item>
<!-- <u-form-item
required
label-width="180rpx"
:label="'银行名称'"
@click="showAmount = true"
prop="bankName"
ref="item1"
>
<u--input
suffixIcon="arrow-right"
readonly
v-model="dataForm.bankName"
disabledColor="#ffffff"
:placeholder="'请选择'"
>
2025-03-23 09:29:40 +08:00
</u--input>
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'银行卡号'"
prop="cardNumber"
ref="item1"
>
<u--input
:placeholder="'请输入'"
v-model="dataForm.cardNumber"
disabledColor="#F5F5F5;"
></u--input>
2025-03-23 09:29:40 +08:00
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'开户支行'"
prop="subBankName"
ref="item1"
>
<u--input
:placeholder="'请输入'"
v-model="dataForm.subBankName"
disabledColor="#F5F5F5;"
></u--input>
</u-form-item> -->
<!-- <u-form-item
required
@click="getDiqu"
:label="'所在地区'"
label-width="180rpx"
prop="theaddress"
>
<u--input
v-model="dataForm.theaddress"
readonly
suffixIcon="arrow-right"
disabledColor="#ffffff"
:placeholder="'请选择'"
>
2025-03-23 09:29:40 +08:00
</u--input>
</u-form-item> -->
2025-03-23 09:29:40 +08:00
<view class="view-class">
<u-form-item
required
:label="'详细地址'"
class="label-style"
label-width="180rpx"
prop="address"
>
<u-textarea
v-model="dataForm.address"
placeholder-class="place-class"
class="border-color"
maxlength="200"
:placeholder="'请输入'"
/>
2025-03-23 09:29:40 +08:00
</u-form-item>
</view>
<u-form-item
required
label-width="180rpx"
:label="'联系方式'"
prop="phone"
ref="item1"
>
<u--input v-model="dataForm.phone" :placeholder="'请输入'"></u--input>
2025-03-23 09:29:40 +08:00
</u-form-item>
<u-form-item
required
label-width="180rpx"
:label="'验证码'"
prop="verificationCode"
ref="item1"
>
<u--input v-model="dataForm.verificationCode" :placeholder="'请输入'">
2025-03-23 09:29:40 +08:00
<template slot="suffix">
<text style="color: #18acff" @tap="getCode">{{ tips }}</text>
2025-03-23 09:29:40 +08:00
</template>
</u--input>
</u-form-item>
2025-03-23 09:29:40 +08:00
<u-code
:seconds="seconds"
@end="end"
@start="start"
ref="uCode"
@change="codeChange"
></u-code>
<u-picker
@cancel="showAmount = false"
:show="showAmount"
ref="uPicker"
:columns="bankCardChioceList"
@confirm="confirm"
keyName="bankName"
></u-picker>
2025-03-23 09:29:40 +08:00
<!-- <u-picker @cancel='showCtype=false' :show="showCtype" ref="uPicker2" :columns="cardTypeList"
@confirm="confirm2" keyName='label'></u-picker> -->
</u--form>
<!-- <view class="footer_l">
2025-03-23 09:29:40 +08:00
<u-checkbox-group v-model="agreementShow"
shape="circle"
2025-04-22 17:47:02 +08:00
activeColor="#005BAC">
2025-03-23 09:29:40 +08:00
<u-checkbox @change="toCheck"
:name="1">
</u-checkbox>
</u-checkbox-group>
<view class="tit3">{{'我已阅读并同意以上协议'}}</view>
2025-03-23 09:29:40 +08:00
<view class="tit2"
@click="toAgree"> 推广人员服务协议</view>
</view> -->
<view class="btnbox" style="padding-bottom: 180rpx">
<u-button class="subbtn" @click="submit">{{ '确定' }}</u-button>
2025-03-23 09:29:40 +08:00
</view>
</view>
<u-popup
:show="agreeMent"
:closeable="true"
@close="agreeMent = false"
:round="10"
class="popAll"
mode="center"
>
2025-03-23 09:29:40 +08:00
<view class="popList">
<view class="pop_box">
<view v-html="context"></view>
<view class="disflx">
<u-button
type="success"
class="uBtn"
shape="circle"
2025-04-22 17:47:02 +08:00
color="linear-gradient(to right, #005BAC, #005BAC )"
@tap="((agreeMent = false), (isRead = 1))"
>{{ '我已阅读并同意以上协议' }}</u-button
>
2025-03-23 09:29:40 +08:00
</view>
</view>
<!-- <view class="footer">
2025-03-23 09:29:40 +08:00
</view> -->
</view>
</u-popup>
<u-toast ref="uToast"></u-toast>
<v-address
ref="address"
@getAddressData="AddressData"
:defaultCode="defaultCode"
@addressData="addressData"
></v-address>
2025-03-23 09:29:40 +08:00
</view>
</template>
<script>
import * as ban from '@/config/balance.js'
import address from '@/components/address.vue'
import uploadImg from '@/components/uploadImg.vue'
export default {
components: {
'v-address': address,
uploadImg,
},
data() {
return {
isRead: 0,
agreeMent: false,
agreementShow: [],
showAmount: false,
showCtype: false,
dataForm: {
// bankName: '',
// cardNumber: '',
// pkBank: '',
// subBankName: '',
2025-03-23 09:29:40 +08:00
accountName: '',
idCard: '',
pkProvince: '',
pkCity: '',
pkCounty: '',
theaddress: '',
idFront: '',
idBack: '',
idName: '身份证',
idType: 1,
sex: 1,
2025-03-23 09:29:40 +08:00
},
sexRadio: 1,
address: '',
defaultCode: [],
bankCardChioceList: [], //银行选择
cardTypeList: [], //证件类型
sexList: [
{
label: '男',
2025-03-23 09:29:40 +08:00
value: 1,
},
{
label: '女',
2025-03-23 09:29:40 +08:00
value: 2,
},
],
rules: {
accountName: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
sexRadio: [
{
required: true,
message: '请选择',
2025-03-23 09:29:40 +08:00
trigger: 'change',
},
],
idName: [
{
type: 'string',
required: true,
message: '请选择',
2025-03-23 09:29:40 +08:00
trigger: ['change'],
},
],
idCard: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
pkBank: [
{
type: 'string',
required: true,
message: '请选择',
2025-03-23 09:29:40 +08:00
trigger: ['change'],
},
],
address: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
cardNumber: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
subBankName: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
theaddress: [
{
type: 'string',
required: true,
message: '请选择',
2025-03-23 09:29:40 +08:00
trigger: ['change'],
},
],
idFront: [
{
required: true,
message: '请上传',
2025-03-23 09:29:40 +08:00
},
],
idBack: [
{
required: true,
message: '请上传',
2025-03-23 09:29:40 +08:00
},
],
phone: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
verificationCode: [
{
type: 'string',
required: true,
message: '请输入',
2025-03-23 09:29:40 +08:00
trigger: ['blur', 'change'],
},
],
},
tips: '',
// refCode: null,
seconds: 60,
hasRegin: false,
context:
'<p>\t</p><p class="ql-align-center" style="text-align:center;font-size:18px"><span class="ql-size-large">\t</span><strong style="color: rgb(35, 31, 32);text-align:center" class="ql-size-large">推广服务协议</strong></p><p>&nbsp;</p><p><br></p><p><strong style="color: rgb(35, 31, 32);">甲方青岛海之圣生物工程有限公司</strong></p><p><strong style="color: rgb(35, 31, 32);">乙方</strong></p><p><strong style="color: rgb(35, 31, 32);">身份证号: </strong></p><p><strong style="color: rgb(35, 31, 32);">手机号:</strong></p><p><br></p><p><span style="color: rgb(35, 31, 32);">甲乙双方经平等协商一致乙方愿意就甲方所有或经销的产品批发及&nbsp;/ 广</span></p><p><strong style="color: rgb(35, 31, 32);">&nbsp;</strong></p><p><span style="color: rgb(35, 31, 32);"> </span></p><p><span style="color: rgb(35, 31, 32);"></span></p><p><strong> </strong>&nbsp;&nbsp;<span style="color: rgb(35, 31, 32);">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p><span style="color: rgb(35, 31, 32);">1.</span></p><p><span style="color: rgb(35, 31, 32);">2.</span></p><p>\t<span style="color: rgb(35, 31, 32);"></span></p><p><span style="color: rgb(35, 31, 32);">3.广退退退</span></p><p>\t<span style="color: rgb(35, 31, 32);"></span></p><p><strong style="color: rgb(35, 31, 32);">&nbsp;</strong></p><p><span style="color: rgb(35, 31, 32);">使使广 </span></p><p><strong style="color: rgb(35, 31, 32);">&nbsp;</strong><strong></strong></p><p><span style="color: rgb(35, 31, 32);">1. </span></p><p><span style="color: rgb(35, 31, 32);">2. </span></p><p><span style="color: rgb(35, 31, 32);"></span></p><p><span style="color: rgb(35, 31, 32);">3. </span></p><p><strong style="color: rgb(35, 31, 32);">
}
},
onLoad() {
this.getDetail()
this.getList()
},
onReady() {
this.$refs.uForm.setRules(this.rules)
},
methods: {
toAgree() {
this.agreeMent = true
},
getDetail() {
ban.authenticationDetails().then(res => {
2025-03-23 09:29:40 +08:00
if (res.data) {
this.hasRegin = true
} else {
this.hasRegin = false
}
})
},
2025-03-23 09:29:40 +08:00
getIdCardInfo(n) {
ban
.ocrIdCard({
idCardUrl: n,
})
.then(res => {
2025-03-23 09:29:40 +08:00
if (res.code == 200) {
this.$set(this.dataForm, 'accountName', res.data.name)
this.$set(this.dataForm, 'idCard', res.data.idCard)
this.$set(this.dataForm, 'sex', res.data.sex)
this.$set(this.dataForm, 'address', res.data.address)
2025-03-23 09:29:40 +08:00
} else {
this.$nextTick(() => {
this.$refs.uploadImg1.deletePic({ index: 0 })
this.$set(this.dataForm, 'accountName', '')
this.$set(this.dataForm, 'idCard', '')
this.$set(this.dataForm, 'sex', '')
this.$set(this.dataForm, 'idFront', '')
})
}
})
},
idBackChange(e) {
if (e) {
ban
.ocrIdCardBack({
idCardBackUrl: e,
})
.then(res => {
2025-03-23 09:29:40 +08:00
if (res.code == 200) {
} else {
this.$nextTick(() => {
this.$refs.uploadImg2.deletePic({ index: 0 })
this.$set(this.dataForm, 'idBack', '')
})
}
})
}
},
imageUploaded1(url) {
if (!url) return
2025-03-23 09:29:40 +08:00
this.dataForm.idFront = url
this.getIdCardInfo(url)
2025-03-23 09:29:40 +08:00
},
imageUploaded2(url) {
this.dataForm.idBack = url
this.idBackChange(url)
2025-03-23 09:29:40 +08:00
},
// radio选择发生变化
radioGroupChange(e) {
this.dataForm.sex = e
// console.log('🌈eeee',e)
},
AddressData(name) {
this.dataForm.theaddress = name
},
getDiqu() {
this.$refs.address.setShow()
},
addressData(diqu, obj) {
this.dataForm.theaddress = diqu
this.dataForm.pkProvince = obj.province
this.dataForm.pkCity = obj.city
this.dataForm.pkCounty = obj.county
this.$forceUpdate()
},
codeChange(text) {
this.tips = text
},
getCode() {
2025-05-22 18:00:50 +08:00
if (this.dataForm.phone && this.$u.test.mobile(this.dataForm.phone)) {
2025-03-23 09:29:40 +08:00
if (this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码',
2025-03-23 09:29:40 +08:00
})
ban
.getVerification({
phone: this.dataForm.phone,
})
.then(res => {
2025-03-23 09:29:40 +08:00
uni.hideLoading()
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送')
2025-03-23 09:29:40 +08:00
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start()
})
} else {
uni.$u.toast('倒计时结束后再发送')
2025-03-23 09:29:40 +08:00
}
} else {
uni.$u.toast(
this.dataForm.phone ? '手机号格式不正确' : '请先输入手机号'
)
2025-03-23 09:29:40 +08:00
return
}
},
end() {},
start() {},
getList() {
ban.getBankCardChoiceList().then(res => {
2025-03-23 09:29:40 +08:00
this.bankCardChioceList = [res.data]
})
//证件类型
ban.getCardType().then(res => {
2025-03-23 09:29:40 +08:00
this.cardTypeList = [res.data]
})
},
submit() {
this.$refs.uForm
.validate()
.then(res => {
ban
.addAuthentication(this.dataForm)
.then(res => {
if (res.code == 200) {
uni.$u.toast(res.msg)
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.$u.toast(res.msg)
}
})
.catch(err => {})
})
.catch(errors => {
uni.$u.toast('校验失败')
return false
2025-03-23 09:29:40 +08:00
})
},
confirm2(e) {
this.dataForm.idName = e.value[0].label
this.dataForm.idType = e.value[0].value
this.showCtype = false
},
confirm(e) {
this.dataForm.bankName = e.value[0].bankName
this.dataForm.pkBank = e.value[0].pkId
this.showAmount = false
},
},
}
</script>
<style lang="scss" scoped>
::v-deep .u-input--radius,
.u-input--square {
border-radius: 12rpx;
// border:2rpx solid #cccccc;
}
.content {
padding: 0 20rpx;
background: #fff;
2025-03-23 09:29:40 +08:00
.uni-textarea {
height: 100rpx;
}
.theform {
margin-top: 6rpx;
background: #ffffff;
padding: 20rpx 23rpx 48rpx 23rpx;
.contentye {
font-size: 28rpx;
margin-left: 200rpx;
font-family: Source Han Sans CN;
font-weight: 400;
}
}
.btnbox {
margin-top: 38rpx;
padding: 0 20rpx;
.subbtn {
background: #005bac;
2025-03-23 09:29:40 +08:00
border-radius: 46rpx;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #ffffff;
}
}
.getcodes {
background: #2fbc42;
border-radius: 38rpx;
color: #fff;
}
}
.img_cen {
padding: 100px 0;
margin: 0 auto;
text-align: center;
}
.status-img img {
width: 80px;
height: 80px;
}
.footer_l {
display: flex;
justify-content: center;
.tit2 {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #005bac;
2025-03-23 09:29:40 +08:00
}
.tit3 {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #999999;
}
margin: 30rpx 0 40rpx 0;
}
.popAll ::v-deep .u-popup__content {
width: 90%;
}
.pop_box {
max-height: 70vh;
overflow-y: scroll;
padding: 40rpx;
img {
width: 100%;
margin-bottom: 20px;
}
}
.footer {
margin-bottom: 40rpx;
padding: 20rpx;
}
.disflx {
margin-top: 10px;
}
</style>