修复bug

This commit is contained in:
zhouyanli
2026-08-13 17:42:59 +08:00
parent 32765cc004
commit 9e8f5d6acc
11 changed files with 42 additions and 50 deletions

View File

@@ -71,14 +71,14 @@
<text class="item-arrow">\u003E</text>
</view> -->
<!-- 点击这里弹出下拉选择 -->
<view class="form-item" @click="showPopup = true">
<view class="form-item" style="opacity: 0.6;">
<text class="label">房屋状态</text>
<text class="value"
:class="{selected:formData.status}">{{ formData.status.name || '请选择' }}</text>
<text class="item-arrow"></text>
</view>
<view class="form-item switch-item">
<view class="form-item switch-item" v-if="!houseId">
<text class="item-label" style="width: 100px;">设为默认房屋</text>
<switch class="no-cross-switch" :checked="formData.isDefault" color="#1677ff"
@change="onSwitchChange" />
@@ -281,7 +281,7 @@
unitId: uni.getStorageSync('unitId'),
floorId: uni.getStorageSync('floorId'),
houseNumberId: uni.getStorageSync('houseNumberId'),
status: uni.getStorageSync('houseStatus'),
status: uni.getStorageSync('houseStatus') || { id: 0, name: '自住' },
isDefault: uni.getStorageSync('houseIsDefault') == true ? true : false, // 开关默认开启
})
const statusList = ref([{
@@ -499,7 +499,6 @@
})
// 页面显示时从 storage 同步选择数据(从选择小区/楼栋等页面返回时)
// 注意:不用 || 兜底,否则 storage 被清空后旧值会残留导致页面显示与实际数据不一致
const syncFormDataFromStorage = () => {
formData.community = uni.getStorageSync('communityName')
formData.communityId = uni.getStorageSync('communityId')
@@ -511,7 +510,7 @@
formData.floorId = uni.getStorageSync('floorId')
formData.houseNumber = uni.getStorageSync('houseNumberName')
formData.houseNumberId = uni.getStorageSync('houseNumberId')
formData.status = uni.getStorageSync('houseStatus')
formData.status = uni.getStorageSync('houseStatus') || { id: 0, name: '自住' }
}
onShow(() => {
syncFormDataFromStorage()
@@ -520,9 +519,7 @@
try {
const tempPath = await (type === 'front' ? idCardFrontUpload.chooseImage() : idCardBackUpload
.chooseImage())
// 已经由 hook 自动处理了 previewUrl 和 tempFilePath
} catch (err) {
// 用户取消选择,不处理
}
}
@@ -601,7 +598,6 @@
// 下一步
const goNext = () => {
console.log(typeof(uni.getStorageSync('communityId')));
// 基础校验
if (!formData.community) {
uni.showToast({
title: '请选择小区',
@@ -645,13 +641,11 @@
return
}
currentStep.value = 1
//跳转
}
// 完整校验
const goSubmit = async () => {
// 1. 前端校验
if (!form.name) return uni.showToast({
title: '请输入住户姓名',
icon: 'none'
@@ -688,8 +682,7 @@
title: '请上传身份证国徽面',
icon: 'none'
})
// 2. 确认弹窗
const modalRes = await new Promise((resolve) => {
uni.showModal({
title: '确认提交',
@@ -699,7 +692,6 @@
})
if (!modalRes.confirm) return
// 3. 开始提交
uni.showLoading({
title: '提交中...',
mask: true
@@ -743,7 +735,7 @@
gender: form.gender == '男' ? '0' : '1',
idCardType: form.cardType.id,
idCard: form.cardNo,
houseStatus: uni.getStorageSync('houseStatus').id,
houseStatus: formData.status.id,
ownerRelationship: form.relation.id,
phone: form.phone,
smsCode: form.code,