From b34801c6b626289956194aa592c63e5f27575448 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Thu, 21 Aug 2025 09:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E8=B5=81=E9=A1=B5=E9=9D=A2=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=80=89=E5=8F=96=E7=9A=84=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/map-location/map-location.vue | 72 +++++++++++------------- pages/lease/lease.vue | 38 ++++++------- 2 files changed, 53 insertions(+), 57 deletions(-) diff --git a/components/map-location/map-location.vue b/components/map-location/map-location.vue index f9085fe..7a75059 100644 --- a/components/map-location/map-location.vue +++ b/components/map-location/map-location.vue @@ -6,43 +6,39 @@ - + 🗺️ - - - - - 当前定位 - - {{ currentLocation.address }} - - - - - - - 获取位置 - 点击获取当前位置 - - 需要定位权限 - - - - + + + + + + + + + + + + + + + + + + + + + @@ -55,29 +51,29 @@ export default { // 表单标签 label: { type: String, - default: '地址' + default: '地址', }, // 输入框占位符 placeholder: { type: String, - default: '请输入或选择收货地址' + default: '请输入或选择收货地址', }, // 地址值 value: { type: String, - default: '' + default: '', }, // 是否显示位置建议卡片 showLocationCard: { type: Boolean, - default: true - } + default: true, + }, }, data() { return { currentLocation: null, isMapTriggered: false, - addressValue: this.value + addressValue: this.value, } }, watch: { @@ -86,7 +82,7 @@ export default { }, addressValue(newVal) { this.$emit('input', newVal) - } + }, }, methods: { // 获取当前位置信息 @@ -247,7 +243,7 @@ export default { this.addressValue = this.currentLocation.address this.$emit('input', this.currentLocation.address) this.$emit('use-location', this.currentLocation) - + uni.showToast({ title: '已使用当前定位', icon: 'success', @@ -262,8 +258,8 @@ export default { // 清空位置信息 clearLocation() { this.currentLocation = null - } - } + }, + }, } @@ -432,4 +428,4 @@ export default { } } } - \ No newline at end of file + diff --git a/pages/lease/lease.vue b/pages/lease/lease.vue index b3c397f..2f21845 100644 --- a/pages/lease/lease.vue +++ b/pages/lease/lease.vue @@ -23,11 +23,7 @@ 姓名 - + @@ -46,19 +42,19 @@ v-model="formData.address" label="地址" placeholder="请输入或选择收货地址" + @input="onAddressInput" @location-success="onLocationSuccess" @location-error="onLocationError" @use-location="onUseLocation" @map-opened="onMapOpened" - @input="onAddressInput" /> 详细位置 - @@ -158,10 +154,16 @@ export default { const equipmentSelected = !!this.formData.equipmentId const packageSelected = !!this.formData.periodId const amountValid = parseFloat(this.totalAmount) > 0 - - const canPayResult = nameValid && phoneValid && addressValid && detailAddressValid && - equipmentSelected && packageSelected && amountValid - + + const canPayResult = + nameValid && + phoneValid && + addressValid && + detailAddressValid && + equipmentSelected && + packageSelected && + amountValid + // 实时调试信息 console.log('🔍 canPay 实时检查:', { nameValid, @@ -175,9 +177,9 @@ export default { equipmentSelected, packageSelected, amountValid, - canPay: canPayResult + canPay: canPayResult, }) - + return canPayResult }, }, @@ -201,9 +203,9 @@ export default { 'formData.periodId'() { console.log('🔍 套餐ID变化:', this.formData.periodId) }, - 'totalAmount'() { + totalAmount() { console.log('🔍 总金额变化:', this.totalAmount) - } + }, }, onLoad() { // 页面加载时获取设备类型列表 @@ -230,8 +232,6 @@ export default { } }, methods: { - - // 地址输入处理 onAddressInput(value) { console.log('🔍 地址输入变化:', value)