Files
airz-uniapp/pages/confirm/confirm.uvue
T

51 lines
6.1 KiB
Plaintext
Raw Normal View History

2026-09-10 10:57:40 +08:00
<template>
<view class="page page-white" :style="pageStyle()">
2026-09-10 10:57:40 +08:00
<AppHeader title="确认信息" />
<view class="confirm-content">
<view class="confirm-tip"><view class="tip-icon"><text>✓</text></view><view><text class="tip-title">信息填写完成</text><text class="tip-desc">请确认以下信息准确无误</text></view></view>
<view class="info-section" v-for="(section, sectionIndex) in sections" :key="section.title"><view class="section-bar"><text>{{ section.title }}</text><text class="edit" @click="edit(sectionIndex)">编辑</text></view><view class="info-row" v-for="row in section.rows" :key="row.label"><text class="info-label">{{ row.label }}</text><text class="info-value">{{ row.value }}</text></view></view>
<button class="primary-button submit-button" :disabled="submitting" @click="submit">{{ submitting ? '提交中...' : '确认提交' }}</button>
2026-09-10 10:57:40 +08:00
</view>
</view>
</template>
<script setup lang="uts">
import { usePageLayout } from '@/services/layout.uts'
const { pageStyle } = usePageLayout()
2026-09-10 10:57:40 +08:00
import AppHeader from '@/components/AppHeader.uvue'
import { submitAssessment } from '@/services/api.uts'
const submitting = ref(false)
type InfoRow = { label: string, value: string }
type InfoSection = { title: string, rows: InfoRow[] }
const sections = ref<InfoSection[]>([{ title: '基本信息', rows: [{ label: '姓名', value: '未填写' }, { label: '身份证号', value: '未填写' }, { label: '手机号', value: '未填写' }, { label: '所在城市', value: '未填写' }, { label: '婚姻状况', value: '未填写' }] }, { title: '经营 / 收入', rows: [{ label: '职业', value: '未填写' }, { label: '工作单位', value: '未填写' }, { label: '月收入', value: '未填写' }, { label: '社保 / 公积金', value: '未填写' }] }, { title: '资产 / 负债', rows: [{ label: '房产情况', value: '未填写' }, { label: '车辆情况', value: '未填写' }, { label: '存款情况', value: '未填写' }, { label: '信用卡', value: '未填写' }, { label: '其他资产', value: '未填写' }] }])
const payload = ref<UTSJSONObject>({ source: 'mobile', confirmed: false })
const mask = (value: string, left: number, right: number): string => { if (value.length <= left + right) return value; return value.substring(0, left) + '****' + value.substring(value.length - right) }
const read = (saved: UTSJSONObject, key: string): string => { const value = saved[key]; return value == null ? '' : value as string }
const loadDraft = () => {
const storedDraft = uni.getStorageSync('assessmentDraft')
if (storedDraft == null || typeof storedDraft != 'object') return
const saved = storedDraft as UTSJSONObject
const name = read(saved, 'name'); const idCard = read(saved, 'idCard'); const phone = read(saved, 'phone'); const city = read(saved, 'city'); const marital = read(saved, 'maritalStatus'); const occupation = read(saved, 'occupation'); const company = read(saved, 'company'); const income = read(saved, 'monthlyIncome'); const social = read(saved, 'socialSecurity'); const fund = read(saved, 'housingFund'); const house = read(saved, 'house'); const car = read(saved, 'car'); const savings = read(saved, 'savings'); const card = read(saved, 'creditCard'); const other = read(saved, 'otherAssets')
sections.value = [{ title: '基本信息', rows: [{ label: '姓名', value: name.length > 0 ? name : '未填写' }, { label: '身份证号', value: idCard.length > 0 ? mask(idCard, 4, 4) : '未填写' }, { label: '手机号', value: phone.length > 0 ? mask(phone, 3, 4) : '未填写' }, { label: '所在城市', value: city.length > 0 ? city : '未填写' }, { label: '婚姻状况', value: marital.length > 0 ? marital : '未填写' }] }, { title: '经营 / 收入', rows: [{ label: '职业', value: occupation.length > 0 ? occupation : '未填写' }, { label: '工作单位', value: company.length > 0 ? company : '未填写' }, { label: '月收入', value: income.length > 0 ? income + '元' : '未填写' }, { label: '社保 / 公积金', value: (social.length > 0 ? social : '未填写') + ' / ' + (fund.length > 0 ? fund : '未填写') }] }, { title: '资产 / 负债', rows: [{ label: '房产情况', value: house.length > 0 ? house : '未填写' }, { label: '车辆情况', value: car.length > 0 ? car : '未填写' }, { label: '存款情况', value: savings.length > 0 ? savings : '未填写' }, { label: '信用卡', value: card.length > 0 ? card : '未填写' }, { label: '其他资产', value: other.length > 0 ? other : '未填写' }] }]
payload.value = { ...saved, source: 'mobile', confirmed: true }
2026-09-10 10:57:40 +08:00
}
onLoad(() => loadDraft())
const edit = (sectionIndex: number) => { uni.setStorageSync('assessmentEditStep', sectionIndex); if (getCurrentPages().length > 1) uni.navigateBack({ delta: 1 }); else uni.navigateTo({ url: '/pages/assessment/assessment' }) }
const submit = async () => { if (submitting.value) return; submitting.value = true; try { await submitAssessment(payload.value); uni.redirectTo({ url: '/pages/analyzing/analyzing' }) } catch (e) { submitting.value = false; uni.showToast({ title: '提交失败,请重试', icon: 'none' }) } }
2026-09-10 10:57:40 +08:00
</script>
<style>
.confirm-content { padding: 26rpx 30rpx 80rpx; }
.confirm-tip { padding: 26rpx; border-radius: 16rpx; background-color: #edf6ff; flex-direction: row; align-items: center; }
.tip-icon { width: 64rpx; height: 64rpx; border-radius: 50%; background-color: #0868f7; color: white; align-items: center; justify-content: center; font-size: 30rpx; margin-right: 20rpx; }
.tip-title { font-size: 28rpx; font-weight: 700; }
.tip-desc { color: #718096; font-size: 22rpx; margin-top: 5rpx; }
.info-section { margin-top: 28rpx; border-top: 1rpx solid #edf1f6; }
.section-bar { height: 82rpx; flex-direction: row; align-items: center; justify-content: space-between; font-size: 28rpx; font-weight: 700; }
.edit { color: #0868f7; font-size: 22rpx; font-weight: 500; }
.info-row { min-height: 72rpx; flex-direction: row; align-items: center; justify-content: space-between; }
.info-label { color: #778499; font-size: 24rpx; }
.info-value { color: #1a273f; font-size: 25rpx; font-weight: 600; }
.submit-button { margin-top: 50rpx; }
2026-09-10 10:57:40 +08:00
</style>