diff --git a/property-uniapp-project/pageSubPack/my/addCar.vue b/property-uniapp-project/pageSubPack/my/addCar.vue index 462e624..6f5e4bd 100644 --- a/property-uniapp-project/pageSubPack/my/addCar.vue +++ b/property-uniapp-project/pageSubPack/my/addCar.vue @@ -50,7 +50,7 @@ - + @@ -85,12 +85,6 @@ const type = ref('') const isSubmitting = ref(false) const formData = ref({ - // carNum: uni.getStorageSync('carNum'), - // carBrand: uni.getStorageSync('carBrand'), - // carModel: uni.getStorageSync('carModel'), - // carColor: uni.getStorageSync('carColor'), - // carImageUrl: uni.getStorageSync('carImageUrl'), - // carBrandId: uni.getStorageSync('carBrandId') carNum: '', carBrand: '', carModel: '', @@ -253,6 +247,7 @@ } } + const submitCarData = (carImageUrl) => { // 处理 carImageUrl 可能是对象 { url: string } 的情况 const imageUrl = typeof carImageUrl === 'object' ? carImageUrl.url : carImageUrl @@ -273,7 +268,6 @@ params.id = id.value putCar(params).then(res => { console.log(res); - isSubmitting.value = false uni.hideLoading() if (res.code === 200) { uni.showToast({ @@ -291,16 +285,22 @@ uni.navigateBack() }, 1500) } else { - isSubmitting.value = false + isSubmitting.value = false uni.showToast({ title: res.msg || '提交失败', icon: 'none' }) } - }) - }else{ - postCar(params).then(res => { + }).catch((err) => { isSubmitting.value = false + uni.hideLoading() + uni.showToast({ + title: err.msg || '提交失败', + icon: 'none' + }) + }) + } else { + postCar(params).then(res => { uni.hideLoading() if (res.code === 200) { uni.showToast({ @@ -318,16 +318,23 @@ uni.navigateBack() }, 1500) } else { - isSubmitting.value = false + isSubmitting.value = false uni.showToast({ title: res.msg || '提交失败', icon: 'none' }) } + }).catch((err) => { + isSubmitting.value = false + uni.hideLoading() + uni.showToast({ + title: err.msg || '提交失败', + icon: 'none' + }) }) } - + } const selectItem = (typeStr) => { diff --git a/property-uniapp-project/pageSubPack/my/addParkingSpace.vue b/property-uniapp-project/pageSubPack/my/addParkingSpace.vue index bbb23f8..67ae6f0 100644 --- a/property-uniapp-project/pageSubPack/my/addParkingSpace.vue +++ b/property-uniapp-project/pageSubPack/my/addParkingSpace.vue @@ -145,6 +145,18 @@ } else if (uni.getStorageSync('operationType') == 'add') { id.value = undefined type.value = '添加' + // 添加模式下清空上次残留的缓存,保证每次进入都是干净的 + uni.removeStorageSync('communityName') + uni.removeStorageSync('communityId') + uni.removeStorageSync('parkingLotName') + uni.removeStorageSync('parkingLotId') + uni.removeStorageSync('parkingSpaceName') + uni.removeStorageSync('parkingSpaceId') + uni.removeStorageSync('parkingStatus') + uni.removeStorageSync('bindCarName') + uni.removeStorageSync('bindCarId') + uni.removeStorageSync('ownerName') + uni.removeStorageSync('ownerId') } }) diff --git a/property-uniapp-project/pageSubPack/my/carDetail.vue b/property-uniapp-project/pageSubPack/my/carDetail.vue index d5aba19..d5bc584 100644 --- a/property-uniapp-project/pageSubPack/my/carDetail.vue +++ b/property-uniapp-project/pageSubPack/my/carDetail.vue @@ -64,6 +64,7 @@ const statusBarHeight = ref(20) const currentStatus = ref('') const isDeleting = ref(false) + const isUpdating = ref(false) const id = ref(undefined) const form = ref({ plateNo: '', @@ -72,6 +73,7 @@ color: '', carImg: '' }) + let isFirstLoad = true onLoad((options) => { console.log(options); id.value = options.id @@ -80,7 +82,17 @@ }) - + onShow(() => { + // 首次加载由 onLoad 处理,仅从编辑页返回时刷新 + if (isFirstLoad) { + isFirstLoad = false + return + } + isUpdating.value = false + if (id.value) { + loadCarDetail() + } + }) const loadCarDetail = async () => { // 防重复请求 @@ -104,6 +116,8 @@ } } const clickUpdate = () => { + if (isUpdating.value) return + isUpdating.value = true uni.setStorageSync('operationType', 'update') uni.navigateTo({ url: '/pageSubPack/my/addCar?id=' + id.value @@ -112,12 +126,12 @@ const onDelete = () => { if (isDeleting.value) return + isDeleting.value = true uni.showModal({ title: "确认删除", content: "确认删除此车辆信息吗?", success: (res) => { if (res.confirm) { - isDeleting.value = true uni.showLoading({ title: '删除中...', mask: true @@ -125,7 +139,6 @@ deleteCar({ carId: id.value }).then(deleteRes => { - isDeleting.value = false uni.hideLoading() if (deleteRes.code === 200) { uni.showToast({ @@ -136,12 +149,22 @@ uni.navigateBack() }, 1500) } else { + isDeleting.value = false uni.showToast({ title: deleteRes.msg || '删除失败', icon: 'none' }) } + }).catch(() => { + isDeleting.value = false + uni.hideLoading() + uni.showToast({ + title: '删除失败', + icon: 'none' + }) }) + } else { + isDeleting.value = false } } }) diff --git a/property-uniapp-project/pageSubPack/my/selectResidentialCommunity.vue b/property-uniapp-project/pageSubPack/my/selectResidentialCommunity.vue index e4cf6db..0dfab05 100644 --- a/property-uniapp-project/pageSubPack/my/selectResidentialCommunity.vue +++ b/property-uniapp-project/pageSubPack/my/selectResidentialCommunity.vue @@ -131,13 +131,7 @@ }); } else if (sourcePage.value == 'addParkingSpace') { uni.setStorageSync('checkType', '停车场') - uni.navigateTo({ - // url: '/pageSubPack/my/bindHouse', - url: '/pageSubPack/my/selectParingLot', - success: res => {}, - fail: () => {}, - complete: () => {} - }); + uni.navigateBack() } else { } diff --git a/property-uniapp-project/pageSubPack/service-list/addComplaints.vue b/property-uniapp-project/pageSubPack/service-list/addComplaints.vue index ab57a78..ef4c9ba 100644 --- a/property-uniapp-project/pageSubPack/service-list/addComplaints.vue +++ b/property-uniapp-project/pageSubPack/service-list/addComplaints.vue @@ -46,7 +46,10 @@ 问题描述 - + + + {{ description.length }}/200 + @@ -56,7 +59,7 @@ 投诉人姓名 - + @@ -97,7 +100,7 @@ - + @@ -161,7 +164,9 @@ const villageId = ref('') const tempFilePaths = ref([]) const maxCount = ref(9) -// 关闭所有弹窗 +const isSubmitting = ref(false) + + // 关闭所有弹窗 const closeAllPopup = () => { showTypePopup.value = false showPropertyPopup.value = false @@ -238,12 +243,14 @@ const submitForm = async () => { if (!selectedTypeId.value) { return uni.showToast({ title: '请选择投诉类型', icon: 'none' }) } - if (selectedType.value === '物业服务' && !selectedProperty.value) { - return uni.showToast({ title: '请选择物业', icon: 'none' }) - } + // if (selectedType.value === '物业服务' && !selectedProperty.value) { + // return uni.showToast({ title: '请选择物业', icon: 'none' }) + // } if (!description.value.trim()) { return uni.showToast({ title: '请输入问题描述', icon: 'none' }) } + if (isSubmitting.value) return + isSubmitting.value = true uni.showLoading({ title: '提交中...', mask: true }) @@ -272,14 +279,14 @@ const submitForm = async () => { if (res.code === 200) { uni.showToast({ title: '提交成功', icon: 'success' }) setTimeout(() => { - uni.navigateTo({ - url: '/pageSubPack/service-list/complaintsSuggestionsIndex' - }) + uni.navigateBack() }, 1500) } else { + isSubmitting.value = false uni.showToast({ title: res.msg || '提交失败', icon: 'none' }) } } catch (err) { + isSubmitting.value = false uni.hideLoading() uni.showToast({ title: err.msg || '提交失败,请重试', @@ -391,20 +398,35 @@ const submitForm = async () => { .desc-right { flex: 1; + width: 100%; + } + + .desc-input-wrap { + width: 100%; + margin-top: 20rpx; + border: 1rpx solid #f0f0f0; + border-radius: 8rpx; + padding: 24rpx; + box-sizing: border-box; } .desc-input { - width: calc(100vw - 84rpx); + width: 100%; min-height: 80px; - margin-top: 20rpx; - padding: 24rpx; - border: 1rpx solid #f0f0f0; - border-radius: 8rpx; font-size: 30rpx; color: #333; line-height: 1.5; - box-sizing: border-box; background: transparent; + border: none; + outline: none; + } + + .desc-count { + display: block; + text-align: right; + font-size: 24rpx; + color: #999; + margin-top: 8rpx; } /* 照片上传区域 */ diff --git a/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue b/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue index a2be6d2..209f39b 100644 --- a/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue +++ b/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue @@ -53,7 +53,7 @@