feat: 上线前修改

This commit is contained in:
anonymous
2025-01-08 08:30:28 +08:00
parent 71862ec3d5
commit 853f679d0b
50 changed files with 427 additions and 402 deletions
+57 -83
View File
@@ -9,91 +9,51 @@
<template>
<view class="withdrawal-type-edit-page pb-100 min-h-screen">
<template v-if="!realnameInfo">
<view class="p-15 m-15 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-type.png" class="w-20 h-20" />
<view class="ml-8">件类型</view>
<view class="flex-1 text-right text-14">身份证</view>
</view>
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-name.png" class="w-20 h-20" />
<view class="ml-8">真实姓名</view>
<input
class="flex-1 text-right text-14"
placeholder-class=" text-#889BC6 text-right"
type="text"
placeholder="请输入真实姓名"
v-model="form.realname"
/>
</view>
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-number.png" class="w-20 h-20" />
<view class="ml-8">身份证号</view>
<input
class="flex-1 text-right text-14"
placeholder-class=" text-#889BC6 text-right"
type="text"
placeholder="请输入身份证号"
v-model="form.cardnum"
/>
</view>
<view class="p-15 m-15 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-type.png" class="w-20 h-20" />
<view class="ml-8">证件类型</view>
<view class="flex-1 text-right text-14">身份</view>
</view>
<view class="fixed bottom-0 left-0 right-0 pb-safe">
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onSubmit">
提交
</button>
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-name.png" class="w-20 h-20" />
<view class="ml-8">真实姓名</view>
<input
class="flex-1 text-right text-14"
placeholder-class=" text-#889BC6 text-right"
type="text"
placeholder="请输入真实姓名"
v-model="form.realname"
/>
</view>
</template>
<view v-else class="flex flex-col items-center">
<template v-if="Number(realnameInfo.status) === 1">
<image
src="@/static/images/page-sub/realname/realname-checking.png"
class="w-150 mx-auto h-150 block"
mode="aspectFit"
<view class="flex items-center py-15 text-14">
<image src="@/static/images/page-sub/realname/realname-number.png" class="w-20 h-20" />
<view class="ml-8">身份证号</view>
<input
class="flex-1 text-right text-14"
placeholder-class=" text-#889BC6 text-right"
type="text"
placeholder="请输入身份证号"
v-model="form.cardnum"
/>
<view class="text-center mt-15 text-14 text-#999">您的实名认证正在审核中请耐心等待</view>
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
返回
</button>
</template>
<template v-else-if="Number(realnameInfo.status) === 2">
<image
src="@/static/images/page-sub/realname/realname-success.png"
class="w-150 h-150 block"
mode="aspectFit"
/>
<view class="text-center mt-15 text-14 text-#999">恭喜您实名认证成功</view>
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
返回
</button>
</template>
<template v-else>
<image
src="@/static/images/page-sub/realname/realname-checking.png"
class="w-150 h-150 block"
mode="aspectFit"
/>
<view class="text-center mt-15 text-14 text-#999">您的实名认证审核未通过请重新提交</view>
<button
@click="() => (realnameInfo = null)"
class="btn-gradient px-30 text-white rounded-full m-15 text-16"
>
重新提交
</button>
</template>
</view>
</view>
<view class="fixed bottom-0 left-0 right-0 pb-safe">
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onSubmit">
{{ realnameInfo ? '修改' : '提交' }}
</button>
</view>
</view>
</template>
<script setup lang="ts">
import { getRealNameAuthAPI, realNameAuthAPI } from '@/service'
import { editRealNameAuthAPI, getRealNameAuthAPI, realNameAuthAPI } from '@/service'
import { useUserStore } from '@/store'
import { showModal } from '@/utils'
import { ref } from 'vue'
const form = ref({
id: '',
realname: '',
cardnum: '',
})
@@ -102,24 +62,38 @@ const onBack = () => {
uni.navigateBack()
}
const realnameInfo = ref(null)
const loadRealnameInfo = async () => {
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
return res.data
})
if (realnameInfo.value) {
form.value.realname = realnameInfo.value.realname
form.value.cardnum = realnameInfo.value.cardnum
form.value.id = realnameInfo.value.id
}
}
const onSubmit = async () => {
if (!form.value.realname || !form.value.cardnum) {
await showModal('请填写完整信息')
return
}
await realNameAuthAPI(form.value)
await showModal('提交成功,请耐心等待审核!')
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
return res.data
})
if (!/^\d{17}[\d|x]$/.test(form.value.cardnum)) {
await showModal('身份证号格式错误')
return
}
if (form.value.id) {
await editRealNameAuthAPI(form.value)
await showModal('修改成功')
} else {
await realNameAuthAPI(form.value)
await showModal('实名认证成功')
}
loadRealnameInfo()
}
const realnameInfo = ref(null)
onLoad(async () => {
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
return res.data
})
})
onLoad(loadRealnameInfo)
</script>
<style lang="scss" scoped>
.withdrawal-type-edit-page {