租赁页面地址选取的精简
This commit is contained in:
parent
e326254bd6
commit
b34801c6b6
|
|
@ -6,43 +6,39 @@
|
||||||
<view class="address-input-wrapper">
|
<view class="address-input-wrapper">
|
||||||
<input
|
<input
|
||||||
v-model="addressValue"
|
v-model="addressValue"
|
||||||
class="address-input"
|
|
||||||
:placeholder="placeholder || '请输入或选择收货地址'"
|
:placeholder="placeholder || '请输入或选择收货地址'"
|
||||||
|
class="address-input"
|
||||||
@focus="onAddressFocus"
|
@focus="onAddressFocus"
|
||||||
@input="onAddressInput"
|
@input="onAddressInput"
|
||||||
/>
|
/>
|
||||||
<view
|
<view class="map-icon-wrapper" title="点击获取定位并打开地图" @click="openMapWithLocation">
|
||||||
class="map-icon-wrapper"
|
|
||||||
title="点击获取定位并打开地图"
|
|
||||||
@click="openMapWithLocation"
|
|
||||||
>
|
|
||||||
<text class="map-icon">🗺️</text>
|
<text class="map-icon">🗺️</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 当前定位 -->
|
<!-- 当前定位 -->
|
||||||
<view class="location-suggestion">
|
<!-- <view class="location-suggestion">-->
|
||||||
<view v-if="currentLocation" class="location-card">
|
<!-- <view v-if="currentLocation" class="location-card">-->
|
||||||
<view class="location-content">
|
<!-- <view class="location-content">-->
|
||||||
<view class="location-header">
|
<!-- <view class="location-header">-->
|
||||||
<text class="location-title">当前定位</text>
|
<!-- <text class="location-title">当前定位</text>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<text class="location-address">{{ currentLocation.address }}</text>
|
<!-- <text class="location-address">{{ currentLocation.address }}</text>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<button class="use-location-btn" @click="useCurrentLocation">使用</button>
|
<!-- <button class="use-location-btn" @click="useCurrentLocation">使用</button>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<view v-else class="location-card">
|
<!-- <view v-else class="location-card">-->
|
||||||
<view class="location-content">
|
<!-- <view class="location-content">-->
|
||||||
<view class="location-header">
|
<!-- <view class="location-header">-->
|
||||||
<text class="location-title">获取位置</text>
|
<!-- <text class="location-title">获取位置</text>-->
|
||||||
<text class="location-company">点击获取当前位置</text>
|
<!-- <text class="location-company">点击获取当前位置</text>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<text class="location-address">需要定位权限</text>
|
<!-- <text class="location-address">需要定位权限</text>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<button class="get-location-btn" @click="getCurrentLocation">获取</button>
|
<!-- <button class="get-location-btn" @click="getCurrentLocation">获取</button>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -55,29 +51,29 @@ export default {
|
||||||
// 表单标签
|
// 表单标签
|
||||||
label: {
|
label: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '地址'
|
default: '地址',
|
||||||
},
|
},
|
||||||
// 输入框占位符
|
// 输入框占位符
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '请输入或选择收货地址'
|
default: '请输入或选择收货地址',
|
||||||
},
|
},
|
||||||
// 地址值
|
// 地址值
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
// 是否显示位置建议卡片
|
// 是否显示位置建议卡片
|
||||||
showLocationCard: {
|
showLocationCard: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentLocation: null,
|
currentLocation: null,
|
||||||
isMapTriggered: false,
|
isMapTriggered: false,
|
||||||
addressValue: this.value
|
addressValue: this.value,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -86,7 +82,7 @@ export default {
|
||||||
},
|
},
|
||||||
addressValue(newVal) {
|
addressValue(newVal) {
|
||||||
this.$emit('input', newVal)
|
this.$emit('input', newVal)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取当前位置信息
|
// 获取当前位置信息
|
||||||
|
|
@ -247,7 +243,7 @@ export default {
|
||||||
this.addressValue = this.currentLocation.address
|
this.addressValue = this.currentLocation.address
|
||||||
this.$emit('input', this.currentLocation.address)
|
this.$emit('input', this.currentLocation.address)
|
||||||
this.$emit('use-location', this.currentLocation)
|
this.$emit('use-location', this.currentLocation)
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '已使用当前定位',
|
title: '已使用当前定位',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
|
@ -262,8 +258,8 @@ export default {
|
||||||
// 清空位置信息
|
// 清空位置信息
|
||||||
clearLocation() {
|
clearLocation() {
|
||||||
this.currentLocation = null
|
this.currentLocation = null
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -432,4 +428,4 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,7 @@
|
||||||
<!-- 姓名 -->
|
<!-- 姓名 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="field-label">姓名</text>
|
<text class="field-label">姓名</text>
|
||||||
<input
|
<input v-model="formData.name" class="field-input" placeholder="请输入姓名" />
|
||||||
v-model="formData.name"
|
|
||||||
class="field-input"
|
|
||||||
placeholder="请输入姓名"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 手机号 -->
|
<!-- 手机号 -->
|
||||||
|
|
@ -46,19 +42,19 @@
|
||||||
v-model="formData.address"
|
v-model="formData.address"
|
||||||
label="地址"
|
label="地址"
|
||||||
placeholder="请输入或选择收货地址"
|
placeholder="请输入或选择收货地址"
|
||||||
|
@input="onAddressInput"
|
||||||
@location-success="onLocationSuccess"
|
@location-success="onLocationSuccess"
|
||||||
@location-error="onLocationError"
|
@location-error="onLocationError"
|
||||||
@use-location="onUseLocation"
|
@use-location="onUseLocation"
|
||||||
@map-opened="onMapOpened"
|
@map-opened="onMapOpened"
|
||||||
@input="onAddressInput"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 详细位置 -->
|
<!-- 详细位置 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="field-label">详细位置</text>
|
<text class="field-label">详细位置</text>
|
||||||
<input
|
<input
|
||||||
v-model="formData.detailAddress"
|
v-model="formData.detailAddress"
|
||||||
class="field-input"
|
class="field-input"
|
||||||
placeholder="例:6栋201室"
|
placeholder="例:6栋201室"
|
||||||
@input="onDetailAddressInput"
|
@input="onDetailAddressInput"
|
||||||
/>
|
/>
|
||||||
|
|
@ -158,10 +154,16 @@ export default {
|
||||||
const equipmentSelected = !!this.formData.equipmentId
|
const equipmentSelected = !!this.formData.equipmentId
|
||||||
const packageSelected = !!this.formData.periodId
|
const packageSelected = !!this.formData.periodId
|
||||||
const amountValid = parseFloat(this.totalAmount) > 0
|
const amountValid = parseFloat(this.totalAmount) > 0
|
||||||
|
|
||||||
const canPayResult = nameValid && phoneValid && addressValid && detailAddressValid &&
|
const canPayResult =
|
||||||
equipmentSelected && packageSelected && amountValid
|
nameValid &&
|
||||||
|
phoneValid &&
|
||||||
|
addressValid &&
|
||||||
|
detailAddressValid &&
|
||||||
|
equipmentSelected &&
|
||||||
|
packageSelected &&
|
||||||
|
amountValid
|
||||||
|
|
||||||
// 实时调试信息
|
// 实时调试信息
|
||||||
console.log('🔍 canPay 实时检查:', {
|
console.log('🔍 canPay 实时检查:', {
|
||||||
nameValid,
|
nameValid,
|
||||||
|
|
@ -175,9 +177,9 @@ export default {
|
||||||
equipmentSelected,
|
equipmentSelected,
|
||||||
packageSelected,
|
packageSelected,
|
||||||
amountValid,
|
amountValid,
|
||||||
canPay: canPayResult
|
canPay: canPayResult,
|
||||||
})
|
})
|
||||||
|
|
||||||
return canPayResult
|
return canPayResult
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -201,9 +203,9 @@ export default {
|
||||||
'formData.periodId'() {
|
'formData.periodId'() {
|
||||||
console.log('🔍 套餐ID变化:', this.formData.periodId)
|
console.log('🔍 套餐ID变化:', this.formData.periodId)
|
||||||
},
|
},
|
||||||
'totalAmount'() {
|
totalAmount() {
|
||||||
console.log('🔍 总金额变化:', this.totalAmount)
|
console.log('🔍 总金额变化:', this.totalAmount)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 页面加载时获取设备类型列表
|
// 页面加载时获取设备类型列表
|
||||||
|
|
@ -230,8 +232,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
// 地址输入处理
|
// 地址输入处理
|
||||||
onAddressInput(value) {
|
onAddressInput(value) {
|
||||||
console.log('🔍 地址输入变化:', value)
|
console.log('🔍 地址输入变化:', value)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user