2025-01-10 06:00:42 +00:00
|
|
|
<script setup>
|
2025-01-15 05:05:07 +00:00
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2025-01-23 11:43:45 +00:00
|
|
|
import {userUpdate} from "@/api/auth/index.js";
|
2025-01-17 06:07:19 +00:00
|
|
|
import {message} from '@/components/x-message/useMessage.js'
|
|
|
|
import detail from './components/detail.vue'
|
2025-01-23 11:43:45 +00:00
|
|
|
import {authStore} from "@/stores/auth/index.js";
|
2025-02-13 03:53:24 +00:00
|
|
|
import XVanDate from '@/components/x-van-date/index.vue'
|
|
|
|
import XVanSelect from '@/components/x-van-select/index.vue'
|
2025-01-15 05:05:07 +00:00
|
|
|
const router = useRouter();
|
2025-02-13 03:53:24 +00:00
|
|
|
const { locale } = useI18n()
|
2025-01-17 06:07:19 +00:00
|
|
|
const {userInfo}= authStore()
|
2025-02-13 03:53:24 +00:00
|
|
|
const active=ref(locale.value==='zh-CN'?0:1)
|
2025-01-15 05:05:07 +00:00
|
|
|
const { t } = useI18n()
|
2025-01-17 06:07:19 +00:00
|
|
|
const form=ref({
|
|
|
|
realName: "",
|
|
|
|
sex:'',
|
|
|
|
birthDate:'',
|
|
|
|
userExtend: {
|
|
|
|
address: "",
|
|
|
|
bankName: "",
|
|
|
|
bankNo: ""
|
|
|
|
}
|
|
|
|
})
|
|
|
|
const form1=ref({
|
|
|
|
idNum:'',
|
|
|
|
realName:''
|
|
|
|
})
|
|
|
|
const columns=ref([
|
|
|
|
{ text: t('realAuth.male'), value: 1 },
|
|
|
|
{ text: t('realAuth.female'), value: 2 },
|
|
|
|
])
|
|
|
|
function isFormComplete(obj) {
|
|
|
|
for (const key in obj) {
|
|
|
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
|
|
if (!isFormComplete(obj[key])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (obj[key] === "") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
const statusCode=ref(0)
|
|
|
|
const confirm=async ()=>{
|
|
|
|
const thatForm=active.value===0?form1.value:form.value
|
2025-02-13 03:53:24 +00:00
|
|
|
thatForm.userExtend.isMainland=active.value===0?1:0
|
2025-01-17 06:07:19 +00:00
|
|
|
if (isFormComplete(thatForm)){
|
|
|
|
const res=await userUpdate(thatForm)
|
|
|
|
if (res.status===0){
|
|
|
|
userInfo.value=res.data
|
2025-02-12 06:34:05 +00:00
|
|
|
message.success(t('realAuth.success_mess'))
|
2025-01-17 06:07:19 +00:00
|
|
|
statusCode.value=1
|
|
|
|
}
|
|
|
|
}else {
|
2025-02-12 06:34:05 +00:00
|
|
|
message.error(t('realAuth.cnTabDesc'))
|
2025-01-17 06:07:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const goHome=()=>{
|
|
|
|
router.push('/')
|
|
|
|
}
|
2025-01-15 05:05:07 +00:00
|
|
|
definePageMeta({
|
|
|
|
i18n: 'realAuth.title',
|
|
|
|
})
|
2025-01-10 06:00:42 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2025-01-17 06:07:19 +00:00
|
|
|
<div class="px-[31px] bg-[url('@/static/images/asdfsdd.png')] bg-cover w-100vw flex-grow-1 pt-[46px] relative flex flex-col">
|
|
|
|
<van-tabs v-if="statusCode===0" v-model:active="active" animated swipeable>
|
2025-01-15 05:05:07 +00:00
|
|
|
<van-tab :title="$t('realAuth.cnTab')" class="pt-[80px]">
|
2025-01-17 06:07:19 +00:00
|
|
|
<template v-if="statusCode===0">
|
|
|
|
<div class="text-[#BDBDBD] text-[16px] mb-[34px]">{{ $t('realAuth.cnTabDesc') }}</div>
|
|
|
|
<div class="mb-[100px]">
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
|
|
|
<van-field v-model="form1.idNum" :label="$t('realAuth.idCard')" clearable
|
|
|
|
:placeholder="$t('realAuth.idCardPlaceholder')"></van-field>
|
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
|
|
|
<van-field v-model="form1.realName" :label="$t('realAuth.name')" clearable :placeholder="$t('realAuth.namePlaceholder')"></van-field>
|
|
|
|
</div>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
2025-01-17 06:07:19 +00:00
|
|
|
</template>
|
2025-01-15 05:05:07 +00:00
|
|
|
</van-tab>
|
|
|
|
<van-tab :title="$t('realAuth.otherTab')" class="pt-[80px]">
|
|
|
|
<div class="text-[#BDBDBD] text-[16px] mb-[34px]">{{ $t('realAuth.otherTabDesc') }}</div>
|
|
|
|
<div class="mb-[100px]">
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-02-13 03:53:24 +00:00
|
|
|
<van-field v-model="form.realName" :label="$t('realAuth.name')" clearable :placeholder="$t('realAuth.namePlaceholder')"></van-field>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-02-13 03:53:24 +00:00
|
|
|
<x-van-select v-model="form.sex" :placeholder="$t('realAuth.text1')" :label="$t('realAuth.gender')" :columns="columns"/>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-02-13 03:53:24 +00:00
|
|
|
<x-van-date v-model="form.birthDate" :label="$t('realAuth.birthday')" :placeholder="$t('realAuth.birthdayPlaceholder')"/>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-01-17 06:07:19 +00:00
|
|
|
<van-field v-model="form.userExtend.address" :label="$t('realAuth.adress')" clearable
|
2025-01-15 05:05:07 +00:00
|
|
|
:placeholder="$t('realAuth.adressPlaceholder')"></van-field>
|
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-01-17 06:07:19 +00:00
|
|
|
<van-field v-model="form.userExtend.bankName" :label="$t('realAuth.bank')" clearable :placeholder="$t('realAuth.bankPlaceholder')"></van-field>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
|
|
|
<div class="border-b-[1.7px] mt-[8px]">
|
2025-01-17 06:07:19 +00:00
|
|
|
<van-field v-model="form.userExtend.bankNo" :label="$t('realAuth.bankCard')" clearable
|
2025-01-15 05:05:07 +00:00
|
|
|
:placeholder="$t('realAuth.bankCardPlaceholder')"></van-field>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</van-tab>
|
|
|
|
</van-tabs>
|
2025-01-17 06:07:19 +00:00
|
|
|
<van-tabs v-else-if="statusCode===1" v-model:active="active" animated swipeable>
|
|
|
|
<van-tab :title="$t('realAuth.cnTab')" class="pt-[80px]">
|
|
|
|
<detail :type="active"></detail>
|
|
|
|
</van-tab>
|
|
|
|
<van-tab :title="$t('realAuth.otherTab')" class="pt-[80px]">
|
|
|
|
<detail :type="active"></detail>
|
|
|
|
</van-tab>
|
|
|
|
</van-tabs>
|
|
|
|
<div class="flex justify-between" v-if="statusCode===0">
|
|
|
|
<van-button style="width: 151px;height: 48px" color="#E9F1F8">
|
|
|
|
<div class="text-#2B53AC text-16px">{{ $t('realAuth.cancel') }}</div>
|
|
|
|
</van-button>
|
|
|
|
<van-button @click="confirm" style="width: 151px;height: 48px" color="#2B53AC">
|
|
|
|
<div class="text-#FFFFFF text-16px">{{ $t('realAuth.confirm') }}</div>
|
|
|
|
</van-button>
|
|
|
|
</div>
|
|
|
|
<div v-else class="mt-auto pb-94px">
|
2025-02-12 06:34:05 +00:00
|
|
|
<van-button color="#E9F1F8" @click="goHome" style="color: #2B53AC;font-weight: 600" block>{{ $t('home.go_home')}}</van-button>
|
2025-01-17 06:07:19 +00:00
|
|
|
</div>
|
2025-01-15 05:05:07 +00:00
|
|
|
</div>
|
2025-01-10 06:00:42 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
2025-01-15 05:05:07 +00:00
|
|
|
:deep(.van-tabs__line) {
|
2025-01-10 06:00:42 +00:00
|
|
|
height: 2px;
|
|
|
|
width: 107px;
|
|
|
|
}
|
2025-01-15 05:05:07 +00:00
|
|
|
|
|
|
|
:deep(.van-cell) {
|
|
|
|
padding-left: 0;
|
|
|
|
}
|
2025-01-10 06:00:42 +00:00
|
|
|
</style>
|