diff --git a/src/pages.json b/src/pages.json index 34291d5..c2f266a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -12,6 +12,12 @@ } }, "pages": [ + { + "path": "pages/booking/booking", + "style": { + "navigationBarTitleText": "一键预约" + } + }, { "path": "pages/login/login", "style": { @@ -32,12 +38,7 @@ "navigationBarTitleText": "我的" } }, - { - "path": "pages/booking/booking", - "style": { - "navigationBarTitleText": "一键预约" - } - }, + { "path": "pages/booking/booking-success", "style": { diff --git a/src/pages/booking/booking.vue b/src/pages/booking/booking.vue index ea4b75f..5ebe014 100644 --- a/src/pages/booking/booking.vue +++ b/src/pages/booking/booking.vue @@ -5,7 +5,9 @@ import TimePopup from './components/timePopup.vue' import AddressPopup from './components/addressPopup.vue' import SitePopup from './components/sitePopup.vue' import { postBookingAPI } from '@/services/booking' - +import AddressPanel from './components/AddressPanel.vue' +import TimePanel from './components/TimePanel.vue' +import SitePanel from './components/SitePanel.vue' const activeMenuKey = ref(0) const activeWeightKey = ref(0) @@ -18,9 +20,9 @@ const isShowAddressPop = ref(false) const isShowSitePop = ref(false) // 回收地址、回收时间、 回收站点 -const recycleAddress = ref('') -const appointmentTime = ref('') -const siteLabel = ref('') +const recycleAddress = ref('请选择回收地址') +const appointmentTime = ref('请选择回收时间') +const siteLabel = ref('请选择回收站点') const recycleStationId = ref('521632060801030597') // 是否可以预约 @@ -196,17 +198,37 @@ const handleBooking = async () => { } } +// uni-ui 弹出层组件 ref +const popup = ref<{ + open: (type?: UniHelper.UniPopupType) => void + close: () => void +}>() + +// 弹出层条件渲染 +const popupName = ref<'address' | 'time' | 'site'>() +const openPopup = (name: typeof popupName.value) => { + // 修改弹出层名称 + popupName.value = name + popup.value?.open() +} +const handlePopClose = (item) => { + if (popupName.value == 'time') { + appointmentTime.value = item + } + if (popupName.value == 'address') { + recycleAddress.value = item.location + } + if (popupName.value == 'site') { + recycleAddress.value = item.name + } + + popup.value?.close() +}