基于uniapp+vue3+uni-ui跨三端(小程序+h5+app端)酒店预约模板

最新跨端原创实战uni-app+vue3+pinia+uv-ui仿携程/去哪儿旅游酒店预订系统。

未标题-1-2

项目技术知识

  • 技术框架:uni-app+vite5+vue3
  • 状态管理:pinia2
  • 组件库:uni-ui+uv-ui(uniapp+vue3组件库)
  • 弹框组件:uv3-popup(基于uniapp+vue3多端弹窗组件)
  • 自定义组件:uv3-navbar导航条+uv3-tabbar菜单栏
  • 缓存技术:pinia-plugin-unistorage
  • 支持运行:h5+小程序+app端

image

未标题0-1

image

项目框架结构

image

uniapp-vue3trip酒店预订项目已经发布到我的原创作品集,欢迎下载使用。

uniapp+vue3+pinia2+uvui跨多端酒店预订app系统

image

uniapp项目入口配置

import { createSSRApp } from 'vue'
import App from './App'

// 引入pinia状态管理
import pinia from '@/pinia'

export function createApp() {
  const app = createSSRApp(App)
  app.use(pinia)
  return {
    app,
    pinia
  }
}

uni-trip项目布局模板

image

<!-- 公共布局模板 -->
<script setup>
  // #ifdef MP-WEIXIN
  defineOptions({
    options: { virtualHost: true }
  })
  // #endif
  const props = defineProps({
    // 是否显示自定义tabbar
    showTabBar: { type: [Boolean, String], default: false },
  })
  
  const handleChange = (index) => {
    if(index == 2) {
      uni.showToast({
        icon: 'none',
        title: '自定义功能'
      })
    }
  }
</script>

<template>
  <view class="uv3__container flexbox flex-col flex1">
    <!-- 顶部插槽 -->
    <slot name="header" />
    
    <!-- 内容区 -->
    <view class="uv3__scrollview flex1" :style="{'padding-bottom': showTabBar ? '50px' : 0}">
      <slot />
    </view>
    
    <!-- 底部插槽 -->
    <slot name="footer" />
    
    <!-- tabbar栏 -->
    <uv3-tabbar :show="showTabBar" transparent zIndex="99" @change="handleChange" />
  </view>
</template>

未标题-7

未标题-3

uniapp+vue3自定义标题栏

image

image

参数配置如下:

const props = defineProps({
  // 是否是自定义导航
  custom: { type: [Boolean, String], default: false },
  // 是否显示返回
  back: { type: [Boolean, String], default: true },
  // 标题
  title: { type: [String, Number], default: '' },
  // 标题颜色
  color: { type: String, default: '#fff' },
  // 背景色
  bgcolor: { type: String, default: '#07c160' },
  // 标题字体大小
  size: { type: String, default: null },
  // 标题是否居中
  center: { type: [Boolean, String], default: false },
  // 是否搜索
  search: { type: [Boolean, String], default: false },
  // 是否固定
  fixed: { type: [Boolean, String], default: false },
  // 是否背景透明
  transparent: { type: [Boolean, String], default: false },
  // 设置层级
  zIndex: { type: [Number, String], default: '2023' },
  // 自定义iconfont字体图标库前缀
  customPrefix: { type: String, default: 'uv3trip-icon' },
  // 自定义样式
  customStyle: String,
})

uniapp+vue3预订模板

image

001360截图20251106153325642

image

image

<!-- 日历 -->
<uv3-popup
  v-model="isVisibleCalendar"
  title="选择日期"
  position="bottom"
  round
  xclose
  xposition="left"
  :customStyle="{'overflow': 'hidden'}"
  @open="showCalendar=true"
  @close="showCalendar=false"
>
  <uv-calendars
    v-if="showCalendar"
    ref="calendarRef"
    mode="range"
    insert
    color="#ffaa00"
    :startDate="startDate"
    :endDate="endDate"
    :date="rangeDate"
    :selected="dingDate"
    title="选择日期"
    start-text="入住"
    end-text="离店"
    @change="handleCalendarChange"
  />
</uv3-popup>
const isVisibleCalendar = ref(false)
const showCalendar = ref(false)
const calendarRef = ref(null)
const nightNum = ref(1)
// 限制日期选择范围-开始日期
const startDate = ref(getDate(new Date()).fullDate)
// 限制日期选择范围-结束日期
const endDate = ref(getDate(new Date(), 90).fullDate)
// 自定义默认选中日期,不传默认为今天。mode="multiple"或mode="range"时,该值为数组
const rangeDate = ref([getDate(new Date()).fullDate, getDate(new Date(), 1).fullDate])
// 打点,期待格式[{date: '2019-06-27', info: '签到', disable: false}]
const dingDate = ref([
  {
    date: getDate(new Date(), 3).fullDate,
    info: '已预订',
    infoColor: '#ffaa00',
    badge: true
  },
  {
    date: getDate(new Date(), 4).fullDate,
    info: '已满',
    disable: true,
  },
  {
    date: getDate(new Date(), 5).fullDate,
    info: '优惠',
    infoColor: '#19be6b',
    topinfo: '¥99',
    topinfoColor: '#19be6b'
  },
  {
    date: getDate(new Date(), 7).fullDate,
    info: '有空房',
    infoColor: '#09f',
  },
])

项目中还新增聊天功能模块。

p3

拒绝ai,坚持纯手写前端原创进阶项目,关注我,一起技术成长~

👋 感谢阅读,欢迎关注我的公众号 「Andy前端」

360截图20231019102528039

 

posted @ 2026-09-26 11:45  yxybox  阅读(12)  评论(0)    收藏  举报