|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="page">
|
|
<div class="page">
|
|
|
- <div class="kyc-form" v-if="isShow">
|
|
|
|
|
|
|
+ <div class="kyc-form" v-if="isShow && countryOptions.length > 0">
|
|
|
<remit-input
|
|
<remit-input
|
|
|
v-model:value="infoForm.lastName"
|
|
v-model:value="infoForm.lastName"
|
|
|
fkey="lastName"
|
|
fkey="lastName"
|
|
@@ -28,6 +28,7 @@
|
|
|
/>
|
|
/>
|
|
|
<remit-input
|
|
<remit-input
|
|
|
v-model:value="infoForm.areaCode"
|
|
v-model:value="infoForm.areaCode"
|
|
|
|
|
+ v-if="phoneCodes.length > 0"
|
|
|
fkey="areaCode"
|
|
fkey="areaCode"
|
|
|
:required="true"
|
|
:required="true"
|
|
|
type="select"
|
|
type="select"
|
|
@@ -105,42 +106,6 @@
|
|
|
:label="t('improve-info.p30')"
|
|
:label="t('improve-info.p30')"
|
|
|
@change="handleChange"
|
|
@change="handleChange"
|
|
|
/>
|
|
/>
|
|
|
- <!-- <div class="form-item phone-input">
|
|
|
|
|
- <div :class="{ 'phone-code': true, 'phone-code-active': form.phoneCode }">
|
|
|
|
|
- <van-field
|
|
|
|
|
- is-link
|
|
|
|
|
- readonly
|
|
|
|
|
- @click="showPicker = true"
|
|
|
|
|
- v-model="form.phoneCode"
|
|
|
|
|
- :placeholder="t('improve-info.phoneCode')"
|
|
|
|
|
- :rules="[{ required: true, message: t('improve-info.phoneCode') }]"
|
|
|
|
|
- autocomplete="off"
|
|
|
|
|
- />
|
|
|
|
|
- <van-popup v-model:show="showPicker" destroy-on-close round position="bottom">
|
|
|
|
|
- <van-picker
|
|
|
|
|
- v-model="form.phoneCode1"
|
|
|
|
|
- :visible-option-num="8"
|
|
|
|
|
- show-toolbar
|
|
|
|
|
- :title="t('improve-info.country')"
|
|
|
|
|
- :columns="[phoneCodes]"
|
|
|
|
|
- :cancel-button-text="t('common.cancel')"
|
|
|
|
|
- :confirm-button-text="t('common.confirm')"
|
|
|
|
|
- @cancel="showPicker = false"
|
|
|
|
|
- @confirm="onConfirm"
|
|
|
|
|
- />
|
|
|
|
|
- </van-popup>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="phone-divider"></div>
|
|
|
|
|
- <div class="phone-number">
|
|
|
|
|
- <van-field
|
|
|
|
|
- v-model="form.phone"
|
|
|
|
|
- :placeholder="t('improve-info.phone')"
|
|
|
|
|
- :rules="[{ required: true, message: t('improve-info.phone') }]"
|
|
|
|
|
- autocomplete="off"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- </div> -->
|
|
|
|
|
-
|
|
|
|
|
<div class="kyc-button">
|
|
<div class="kyc-button">
|
|
|
<van-button type="primary" block @click="kycSubmit">{{ t('improve-info.p33') }}</van-button>
|
|
<van-button type="primary" block @click="kycSubmit">{{ t('improve-info.p33') }}</van-button>
|
|
|
</div>
|
|
</div>
|
|
@@ -160,10 +125,11 @@ const userStore = useUserStore()
|
|
|
const userInfo = computed(() => userStore.userInfo)
|
|
const userInfo = computed(() => userStore.userInfo)
|
|
|
const { t } = useI18n()
|
|
const { t } = useI18n()
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
-
|
|
|
|
|
|
|
+const route = useRoute()
|
|
|
|
|
+const { type } = route.query as { type: string }
|
|
|
const sexOptions = ref([
|
|
const sexOptions = ref([
|
|
|
- { text: t('improve-info.p15'), value: 1 },
|
|
|
|
|
- { text: t('improve-info.p16'), value: 2 },
|
|
|
|
|
|
|
+ { text: t('improve-info.p15'), value: '1' },
|
|
|
|
|
+ { text: t('improve-info.p16'), value: '2' },
|
|
|
])
|
|
])
|
|
|
const idTypeOptions = ref([
|
|
const idTypeOptions = ref([
|
|
|
{ text: t('improve-info.p25'), value: 'EUROPEAN_ID' },
|
|
{ text: t('improve-info.p25'), value: 'EUROPEAN_ID' },
|
|
@@ -229,7 +195,6 @@ const getCityListForSelect = async (countryCode: string) => {
|
|
|
value: item.code,
|
|
value: item.code,
|
|
|
}))
|
|
}))
|
|
|
cityOptions.value = cityList
|
|
cityOptions.value = cityList
|
|
|
- isShow.value = true
|
|
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
cityOptions.value = []
|
|
cityOptions.value = []
|
|
@@ -254,18 +219,17 @@ const kycSubmit = async () => {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
let res
|
|
let res
|
|
|
-
|
|
|
|
|
if (formData.value.uniqueId) {
|
|
if (formData.value.uniqueId) {
|
|
|
res = await ucardApi.merchantUpdate(formData.value as any)
|
|
res = await ucardApi.merchantUpdate(formData.value as any)
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
showToast(t('improve-info.kycSuccess'))
|
|
showToast(t('improve-info.kycSuccess'))
|
|
|
|
|
+ router.push('/mine')
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
res = await ucardApi.merchantRegister(formData.value as any)
|
|
res = await ucardApi.merchantRegister(formData.value as any)
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
showToast(t('improve-info.kycSuccess'))
|
|
showToast(t('improve-info.kycSuccess'))
|
|
|
userInfo.value.customInfo.uniqueId = res.data
|
|
userInfo.value.customInfo.uniqueId = res.data
|
|
|
- console.log(userInfo.value)
|
|
|
|
|
userStore.saveUserInfo(userInfo.value)
|
|
userStore.saveUserInfo(userInfo.value)
|
|
|
router.push('/')
|
|
router.push('/')
|
|
|
}
|
|
}
|
|
@@ -307,16 +271,16 @@ const getInfoForm = () => {
|
|
|
for (const key of fields) {
|
|
for (const key of fields) {
|
|
|
data[key] = customInfo[key] ?? undefined
|
|
data[key] = customInfo[key] ?? undefined
|
|
|
}
|
|
}
|
|
|
- for (const key of fields) {
|
|
|
|
|
- data[key] = formDatas.value[key] ?? undefined
|
|
|
|
|
- console.log(data[key],formDatas.value,112);
|
|
|
|
|
|
|
+ if (customInfo.uniqueId) {
|
|
|
|
|
+ for (const key of fields) {
|
|
|
|
|
+ data[key] = formDatas.value[key] ?? undefined
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
data.lastName = convertToPinyin(data.lastName)
|
|
data.lastName = convertToPinyin(data.lastName)
|
|
|
data.firstName = convertToPinyin(data.firstName)
|
|
data.firstName = convertToPinyin(data.firstName)
|
|
|
infoForm.value = { ...data }
|
|
infoForm.value = { ...data }
|
|
|
formData.value = { ...formData.value, ...data }
|
|
formData.value = { ...formData.value, ...data }
|
|
|
|
|
+ console.log(formData.value, 1222)
|
|
|
}
|
|
}
|
|
|
const getUserInfo = async () => {
|
|
const getUserInfo = async () => {
|
|
|
if (!userToken.value) {
|
|
if (!userToken.value) {
|
|
@@ -325,26 +289,24 @@ const getUserInfo = async () => {
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
const res = await userApi.getUserSingle()
|
|
const res = await userApi.getUserSingle()
|
|
|
-
|
|
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- console.log(res,1111);
|
|
|
|
|
|
|
+ if (res.code === 200 && res.data.uniqueId) {
|
|
|
formDatas.value = res.data
|
|
formDatas.value = res.data
|
|
|
getInfoForm()
|
|
getInfoForm()
|
|
|
- // userStore.saveUserInfo(res.data)
|
|
|
|
|
}
|
|
}
|
|
|
- } catch (error: any) {
|
|
|
|
|
- showToast(error.message || '失败')
|
|
|
|
|
- } finally {
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } catch (error: any) {}
|
|
|
}
|
|
}
|
|
|
-onMounted(() => {
|
|
|
|
|
- getUserInfo()
|
|
|
|
|
- // getInfoForm()
|
|
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ if (type == '1') {
|
|
|
|
|
+ getUserInfo()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ getInfoForm()
|
|
|
|
|
+ }
|
|
|
isShow.value = false
|
|
isShow.value = false
|
|
|
- getCountryListForSelect()
|
|
|
|
|
- getCountry()
|
|
|
|
|
|
|
+ await getCountry()
|
|
|
|
|
+ await getCountryListForSelect()
|
|
|
if (infoForm.value.nationality) {
|
|
if (infoForm.value.nationality) {
|
|
|
- getCityListForSelect(infoForm.value.nationality)
|
|
|
|
|
|
|
+ await getCityListForSelect(infoForm.value.nationality)
|
|
|
|
|
+ isShow.value = true
|
|
|
} else {
|
|
} else {
|
|
|
isShow.value = true
|
|
isShow.value = true
|
|
|
}
|
|
}
|
|
@@ -380,7 +342,7 @@ onMounted(() => {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
max-width: 350px;
|
|
max-width: 350px;
|
|
|
border-radius: 20px;
|
|
border-radius: 20px;
|
|
|
- padding: 28px 18px 18px 18px;
|
|
|
|
|
|
|
+ /* padding: 28px 18px 18px 18px; */
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
gap: 18px;
|
|
gap: 18px;
|