From 05504a293d4c7f342683105e54540d281aba944f Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Tue, 19 Aug 2025 11:11:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=A0=A1=E9=AA=8C1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/map-location/map-location.vue | 6 ++++- pages/lease/lease.vue | 30 ++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/components/map-location/map-location.vue b/components/map-location/map-location.vue index f16282f..f9085fe 100644 --- a/components/map-location/map-location.vue +++ b/components/map-location/map-location.vue @@ -136,7 +136,10 @@ export default { // 地址输入 onAddressInput(e) { - this.$emit('address-input', e.detail.value) + const value = e.detail.value + this.addressValue = value + this.$emit('input', value) + this.$emit('address-input', value) }, // 点击地图图标,自动获取定位并打开地图 @@ -242,6 +245,7 @@ export default { } this.addressValue = this.currentLocation.address + this.$emit('input', this.currentLocation.address) this.$emit('use-location', this.currentLocation) uni.showToast({ diff --git a/pages/lease/lease.vue b/pages/lease/lease.vue index f1b4c61..b3c397f 100644 --- a/pages/lease/lease.vue +++ b/pages/lease/lease.vue @@ -50,13 +50,18 @@ @location-error="onLocationError" @use-location="onUseLocation" @map-opened="onMapOpened" - + @input="onAddressInput" /> 详细位置 - + @@ -149,18 +154,24 @@ export default { const nameValid = this.formData.name.trim().length > 0 const phoneValid = this.formData.phone.trim().length > 0 const addressValid = this.formData.address.trim().length > 0 + const detailAddressValid = this.formData.detailAddress.trim().length > 0 const equipmentSelected = !!this.formData.equipmentId const packageSelected = !!this.formData.periodId const amountValid = parseFloat(this.totalAmount) > 0 - const canPayResult = nameValid && phoneValid && addressValid && + const canPayResult = nameValid && phoneValid && addressValid && detailAddressValid && equipmentSelected && packageSelected && amountValid // 实时调试信息 console.log('🔍 canPay 实时检查:', { nameValid, phoneValid, - addressValid, + addressValid: addressValid, + addressValue: `"${this.formData.address}"`, + addressLength: this.formData.address.length, + detailAddressValid: detailAddressValid, + detailAddressValue: `"${this.formData.detailAddress}"`, + detailAddressLength: this.formData.detailAddress.length, equipmentSelected, packageSelected, amountValid, @@ -181,6 +192,9 @@ export default { 'formData.address'() { console.log('🔍 地址变化:', this.formData.address) }, + 'formData.detailAddress'() { + console.log('🔍 详细位置变化:', this.formData.detailAddress) + }, 'formData.equipmentId'() { console.log('🔍 设备ID变化:', this.formData.equipmentId) }, @@ -218,6 +232,14 @@ export default { methods: { + // 地址输入处理 + onAddressInput(value) { + console.log('🔍 地址输入变化:', value) + console.log('🔍 地址输入前 formData.address:', this.formData.address) + this.formData.address = value + console.log('🔍 地址输入后 formData.address:', this.formData.address) + }, + // 地图组件事件处理 onLocationSuccess(location) { console.log('位置获取成功:', location)