web-africa-h5/pages/user/set/bind/real-name.vue

692 lines
15 KiB
Vue
Raw Permalink Normal View History

2025-03-21 14:49:01 +08:00
<template>
<view class="pb100">
<form @submit="formSubmit" @reset="formReset">
<view class="form-title">{{$t('CK_KS_27')}}</view>
<view class="form-group">
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('MY_WAL_33')}}
</view>
<input v-model="form.accountName" class="form-input" type="text" value="" placeholder="请输入" />
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('MY_WAL_34')}}
</view>
<radio-group class="flex-1">
<view class="flex-1 d-s-c" @click="form.sex = 1">
<view class="d-c-c">
<radio color="#FB3024" style="transform:scale(0.7)" value="1" :checked="form.sex == '1'" />
{{$t('MY_WAL_44')}}
</view>
<view class="d-c-c" @click="form.sex = 2">
<radio color="#FB3024" style="transform:scale(0.7)" value="2" :checked="form.sex == '2'" />
{{$t('MY_WAL_45')}}
</view>
</view>
</radio-group>
</view>
<picker :range="list" @change="changeCardType" range-key="cardName">
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('MY_WAL_35')}}
</view>
<input class="form-input" disabled type="text" :value="card_index == -1 ? $t('CK_KS_38') : list[card_index].cardName" placeholder="" />
<text class="icon iconfont icon-jiantou"></text>
</view>
</picker>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('MY_WAL_36')}}
</view>
<input v-model="form.idCard" class="form-input" type="text" value="" :placeholder="$t('S_C_70')" />
</view>
<picker :range="accountList" :value="bank_index" @change="bindPickerChange" range-key="bankName">
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('CK_KS_41')}}
</view>
<input class="form-input" disabled type="text" :value="bank_index == -1 ? $t('CK_KS_38') : accountList[bank_index].bankName" placeholder="" />
<text class="icon iconfont icon-jiantou"></text>
</view>
</picker>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('CK_KS_42')}}
</view>
<input v-model="form.cardNumber" class="form-input" type="text" value="" :placeholder="$t('S_C_70')" />
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('CK_KS_43')}}
</view>
<input v-model="form.subBankName" class="form-input" type="text" value="" :placeholder="$t('S_C_70')" />
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('MY_WAL_37')}}
</view>
<input class="form-input" type="text" :placeholder="$t('CK_KS_38')" v-model="selectCity" disabled="true" @click="showMulLinkageThreePicker" />
<text class="icon iconfont icon-jiantou"></text>
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('S_C_27')}}
</view>
<textarea v-model="form.address" auto-height class="form-textarea" value="" placeholder="" />
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('w_0052')}}
</view>
<input v-model="form.phone" class="form-input" type="text" value="" :placeholder="$t('S_C_70')" />
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('w_0043')}}
</view>
<input v-model="form.verificationCode" class="form-input" type="text" value="" :placeholder="$t('S_C_70')" />
<button class="get-code-btn" type="default" @click="sendCode" :disabled="is_send">{{ send_btn_txt }}</button>
</view>
</view>
<view class="form-group">
<view class="form-upload">
<view class="form-upload-name">
<text class="domation mr10">*</text>
{{$t('MY_ORD_60')}}
</view>
<view class="d-s-c f-w" @click="openUpload('front')">
<view>
<image class="upload-add" v-if="form.idFront" :src="form.idFront" mode=""></image>
<image v-else class="upload-add" src="/static/icon/upload-add.png" mode=""></image>
</view>
</view>
</view>
<view class="form-upload">
<view class="form-upload-name">
<text class="domation mr10">*</text>
{{$t('MY_ORD_61')}}
</view>
<view class="d-s-c f-w" @click="openUpload('back')">
<view>
<image class="upload-add" v-if="form.idBack" :src="form.idBack" mode=""></image>
<image v-else class="upload-add" src="/static/icon/upload-add.png" mode=""></image>
</view>
</view>
</view>
</view>
<button class="normal-sub-btn" form-type="submit" style="margin-top: 37rpx;">{{$t('CK_KS_72')}}</button>
</form>
<mpvue-city-picker
v-if="is_load"
ref="mpvueCityPicker"
:province="province"
:city="city"
:area="area"
:pickerValueDefault="cityPickerValueDefault"
@onConfirm="onConfirm"
></mpvue-city-picker>
<!--上传图片-->
<Upload v-if="isUpload" @getImgs="getImgsFunc"></Upload>
</view>
</template>
<script>
import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
import Upload from '@/components/upload/upload.vue';
export default {
components: {
mpvueCityPicker,
Upload
},
data() {
return {
accountList: [],
list: [
{
cardName: this.$t('ENU_I_T_1'),
id: 1
},
{
cardName: this.$t('w_0419'),
id: 2
}
],
gender: 0,
typeIndex: -1,
/*是否已发验证码*/
is_send: false,
/*发送按钮文本*/
send_btn_txt: this.$t('w_0055'),
/*当前秒数*/
second: 60,
form: {
sex: '1',
idType: 1,
pkBank: '',
accountName: '',
subBankName: '',
cardNumber: '',
idCard: '',
phone: '',
verificationCode: '',
pkProvince: '',
pkCity: '',
pkCounty: '',
idFront: '',
idBack: '',
address: ''
},
card_index: -1,
bank_index: -1,
account_info: {
bankName:this.$t('CK_KS_38'),
enableState: '',
pkCountry: '',
pkCreator: '',
pkId: '',
pkModified: '',
pkTransaction: ''
},
cityPickerValueDefault: [0, 0, 0],
selectCity: '',
recProvince: 0,
recCity: 0,
recCounty: 0,
// address: {},
delta: 1,
province: [],
city: [],
area: [],
is_load: false,
card_info: {
cardName: this.$t('ENU_I_T_1'),
id: 1
},
/*是否打开上传图片*/
isUpload: false,
upload_type: ''
};
},
onLoad(e) {
this.getBankData();
this.getAreaData();
},
methods: {
/*提交*/
formSubmit: function(e) {
let self = this;
var formdata = self.form;
// // console.log(formdata);
// formdata.pkBank = self.account_info.pkId;
if (formdata.accountName == '') {
uni.showToast({
title: self.$t('w_0189'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.sex == '') {
uni.showToast({
title: self.$t('CK_KS_38'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.idType == '') {
uni.showToast({
title: self.$t('w_0301'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.idCard == '') {
uni.showToast({
title: self.$t('w_0269'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.pkBank == '') {
uni.showToast({
title: self.$t('w_0270'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.cardNumber == '') {
uni.showToast({
title: self.$t('w_0271'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.subBankName == '') {
uni.showToast({
title: self.$t('w_0271'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.pkProvince == '') {
uni.showToast({
title:self.$t('CK_KS_38')+self.$t('MY_WAL_37'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.verificationCode == '') {
uni.showToast({
title: self.$t('w_0057'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.idFront == '') {
uni.showToast({
title: self.$t('MY_WAL_42'),
duration: 1000,
icon: 'none'
});
return false;
}
if (formdata.idFront == '') {
uni.showToast({
title: self.$t('MY_WAL_43'),
duration: 1000,
icon: 'none'
});
return false;
}
self._post('member/api/authentication/add', formdata, function(res) {
self.showSuccess(res.msg, function() {
// #ifndef H5
uni.navigateBack({
delta: parseInt(self.delta)
});
// #endif
// #ifdef H5
history.go(-self.delta);
// #endif
});
});
},
// 获取省市区
getAreaData() {
let self = this;
self._get('system/api/area/tree', {}, function(res) {
self.province = res.data;
// self.city = res.data.regionData[1];
// self.area = res.data.regionData[2];
self.is_load = true;
});
},
/*三级联动选择*/
showMulLinkageThreePicker() {
this.$refs.mpvueCityPicker.show();
},
/*确定选择的省市区*/
onConfirm(e) {
console.log(e);
this.selectCity = e.label;
this.form.pkProvince = e.cityCode[0];
this.form.pkCity = e.cityCode[1];
this.form.pkCounty = e.cityCode[2];
},
bindPickerChange: function(e) {
this.bank_index = e.detail.value;
// console.log(this.bank_index);
this.account_info = this.accountList[this.bank_index];
this.form.pkBank = this.account_info.pkId;
},
changeCardType: function(e) {
this.card_index = e.detail.value;
// console.log(this.bank_index);
this.card_info = this.list[this.bank_index];
this.form.idType = this.card_info.id;
},
/*获取数据*/
getBankData() {
let self = this;
self.loadding = true;
self._get('system/api/bank/list', {}, function(res) {
self.accountList = res.data;
self.loadding = false;
uni.hideLoading();
});
},
changeType(e) {
this.typeIndex = e.detail.value;
},
/*发送短信*/
sendCode() {
let self = this;
var formdata = self.form;
if (formdata.phone == '') {
uni.showToast({
title: self.$t('w_0053'),
duration: 1000,
icon: 'none'
});
return false;
}
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(formdata.phone)) {
uni.showToast({
title: self.$t('w_0134')+'!',
duration: 2000,
icon: 'none'
});
return;
}
self._get(
'member/api/sms/verification',
{
phone: self.form.phone
},
result => {
uni.showToast({
title: self.$t('MY_WAL_49')
});
self.is_send = true;
self.changeMsg();
}
);
},
/*改变发送验证码按钮文本*/
changeMsg() {
if (this.second > 0) {
this.send_btn_txt = this.second + this.$t('ENU_SETTLE_P_1');
this.second--;
setTimeout(this.changeMsg, 1000);
} else {
this.send_btn_txt = this.$t('w_0055');
this.second = 60;
this.is_send = false;
}
},
/*打开上传图片*/
openUpload(type) {
this.isUpload = true;
this.upload_type = type;
},
/*获取上传的图片*/
getImgsFunc(e) {
let self = this;
self.isUpload = false;
if (e && typeof e != 'undefined') {
if (self.upload_type == 'front') {
self.form.idFront = e[0].url;
} else {
self.form.idBack = e[0].url;
}
}
}
}
};
</script>
<style lang="scss">
.agreement-box {
width: 750rpx;
background: #ffffff;
padding: 28rpx 22rpx;
box-sizing: border-box;
margin-top: 2rpx;
margin-bottom: 20rpx;
.agreement-content {
font-size: 24rpx;
font-family: SourceHanSansCN;
font-weight: 400;
color: #999999;
line-height: 32rpx;
word-break: break-all;
margin-bottom: 32rpx;
}
.agreement-btn {
min-width: 320rpx;
height: 76rpx;
line-height: 1.5;
display: flex;
justify-content: center;
align-items: center;
padding: 0 20rpx;
box-sizing: border-box;
background: #282828;
border-radius: 38rpx;
color: #ffffff;
font-size: 24rpx;
}
}
.form-title {
width: 750rpx;
height: 106rpx;
background: #fb3024;
padding-left: 44rpx;
position: relative;
box-sizing: border-box;
font-size: 28rpx;
color: #ffffff;
line-height: 106rpx;
font-weight: bold;
z-index: 1;
}
.form-title::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
margin: auto;
left: 25rpx;
width: 6rpx;
height: 24rpx;
background-color: #fb3024;
z-index: 1;
}
.form-group {
padding: 0 22rpx;
background: #ffffff;
.form-item {
min-height: 104rpx;
box-sizing: border-box;
padding: 15rpx 0;
line-height: 1.5;
display: flex;
justify-content: center;
align-items: center;
border-bottom: 1rpx solid #eee;
.icon-jiantou {
font-size: 32rpx;
color: 090000;
}
.form-tips {
font-size: 24rpx;
color: #999;
}
.form-label {
width: 255rpx;
flex-shrink: 0;
word-break: break-all;
margin-right: 20rpx;
}
.disabled-input {
width: 450rpx;
height: 78rpx;
padding: 0 18rpx;
line-height: 78rpx;
background: #eee;
font-size: 28rpx;
color: #333;
flex: 1;
}
.form-textarea {
width: 450rpx;
padding: 0 18rpx;
line-height: 1.5;
font-size: 28rpx;
color: #333;
flex: 1;
background: #fff;
}
.form-input {
width: 450rpx;
height: 78rpx;
padding: 0 18rpx;
line-height: 78rpx;
background: #fff;
font-size: 28rpx;
color: #333;
flex: 1;
}
.form-item:last-child {
border: none;
}
}
}
.form-upload {
padding: 30rpx 23rpx;
}
.form-upload-name {
font-size: 28rpx;
color: #333;
margin-bottom: 20rpx;
}
.form-upload-tips {
font-size: 24rpx;
color: #999;
margin-bottom: 20rpx;
}
.form-upload-tips2 {
font-size: 24rpx;
color: #fb3024;
line-height: 1.5;
}
.upload-add {
width: 142rpx;
height: 142rpx;
margin-right: 18rpx;
margin-bottom: 18rpx;
}
.get-code-btn {
min-width: 72rpx;
height: 62rpx;
background: #333333;
line-height: 62rpx;
padding: 0rpx 20rpx;
border-radius: 40rpx;
white-space: nowrap;
// border: 1rpx solid $dominant-color;
color: #ffffff;
box-sizing: border-box;
margin-left: 46rpx;
font-size: 24rpx;
}
.get-code-btn[disabled='true'] {
// border: 1rpx solid #cccccc;
color: #333;
background-color: #ffffff;
}
</style>
<style lang="scss">
.address-form {
padding: 0;
border-radius: 0;
}
.address-box {
padding: 0 31rpx 0 27rpx;
}
.address-form .key-name {
width: 180rpx;
height: 90rpx;
line-height: 90rpx;
font-size: 28rpx;
}
.address-form .btn-red {
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
box-shadow: 0 8rpx 16rpx 0 rgba(226, 35, 26, 0.6);
}
.addBtn {
position: fixed;
bottom: 60rpx;
left: 0rpx;
margin: 0 auto;
width: 750rpx;
display: flex;
justify-content: center;
align-items: center;
}
.address-input {
line-height: 90rpx;
height: 90rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.addtextarea {
font-size: 28rpx;
line-height: 1.5;
padding: 25rpx 0;
}
.icon.icon-icon1 {
font-size: 28rpx;
color: #999;
}
</style>