From 4155f6c381f846d474583f513b08d261bf05de86 Mon Sep 17 00:00:00 2001
From: Kven <2955163637@qq.com>
Date: Thu, 19 Jun 2025 21:49:45 +0800
Subject: [PATCH] =?UTF-8?q?feat(hotel):=20=E6=96=B0=E5=A2=9E=E9=85=92?=
=?UTF-8?q?=E5=BA=97=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 添加房间管理和游客管理模块
- 实现房间和游客的查询、创建、编辑和删除功能
- 优化查询条件和表格展示
- 新增退房功能
---
config/vite.config.dev.ts | 4 +-
src/api/guest.ts | 39 +++
src/api/hotel.ts | 38 +++
src/router/routes/modules/hotel.ts | 46 +++
.../hotel/guest/components/guest-edit.vue | 171 +++++++++++
src/views/hotel/guest/index.vue | 281 ++++++++++++++++++
src/views/hotel/room/components/room-edit.vue | 111 +++++++
src/views/hotel/room/index.vue | 234 +++++++++++++++
8 files changed, 922 insertions(+), 2 deletions(-)
create mode 100644 src/api/guest.ts
create mode 100644 src/api/hotel.ts
create mode 100644 src/router/routes/modules/hotel.ts
create mode 100644 src/views/hotel/guest/components/guest-edit.vue
create mode 100644 src/views/hotel/guest/index.vue
create mode 100644 src/views/hotel/room/components/room-edit.vue
create mode 100644 src/views/hotel/room/index.vue
diff --git a/config/vite.config.dev.ts b/config/vite.config.dev.ts
index c462ff3..f840381 100644
--- a/config/vite.config.dev.ts
+++ b/config/vite.config.dev.ts
@@ -14,8 +14,8 @@ export default mergeConfig(
proxy: {
'/api': {
// target: 'http://8.134.75.234:8081',
- // target: 'http://192.168.3.238:8081',
- target: 'http://localhost:8081',
+ target: 'http://192.168.3.119:8081',
+ // target: 'http://localhost:8081',
changeOrigin: true,
},
},
diff --git a/src/api/guest.ts b/src/api/guest.ts
new file mode 100644
index 0000000..ff4fd16
--- /dev/null
+++ b/src/api/guest.ts
@@ -0,0 +1,39 @@
+import axios from 'axios';
+
+export interface GuestRecord {
+ id?: number;
+ name?: string;
+ idCard?: string;
+ phone?: string;
+ roomNumber?: string;
+ checkInTime?: string;
+}
+
+export interface GuestQueryRecord {
+ size: number;
+ current: number;
+ name?: string;
+ status?: number;
+ roomNumber?: string;
+}
+
+export function queryGuestList(data: GuestQueryRecord){
+ return axios.get('/api/rest/hotel/guest', { params: data });
+}
+
+export function createGuest(data: GuestRecord) {
+ return axios.post('/api/rest/hotel/guest', data);
+}
+
+export function deleteGuest(id: number) {
+ return axios.delete(`/api/rest/hotel/guest/${id}`);
+}
+
+export function updateGuest(data: GuestRecord) {
+ return axios.patch(`/api/rest/hotel/guest/${data.id}`, data);
+}
+
+// 游客退房
+export function checkOutGuest(id: any) {
+ return axios.put(`/api/rest/hotel/guest/${id}`);
+}
\ No newline at end of file
diff --git a/src/api/hotel.ts b/src/api/hotel.ts
new file mode 100644
index 0000000..dfe774a
--- /dev/null
+++ b/src/api/hotel.ts
@@ -0,0 +1,38 @@
+import axios from 'axios';
+
+export interface HotelRecord {
+ id?: number;
+ roomNumber?: string;
+ createTime?: string;
+}
+
+export interface HotelQueryRecord {
+ size: number;
+ pages: number;
+ status?: number;
+ roomNumber?: string;
+}
+
+export interface CreateHotelRecord {
+ roomNumber: string;
+}
+
+export function createHotel(data: CreateHotelRecord) {
+ return axios.post('/api/rest/hotel/room', data);
+}
+
+export function queryHotelList(data: HotelQueryRecord) {
+ return axios.get('/api/rest/hotel/room', { params: data });
+}
+
+export function deleteHotel(id: number) {
+ return axios.delete(`/api/rest/hotel/room/${id}`);
+}
+
+export function updateHotel(id:number, data: HotelRecord) {
+ return axios.patch(`/api/rest/hotel/room/${id}`, data);
+}
+
+export function HotelList(){
+ return axios.get('/api/rest/hotel/room/unoccupied');
+}
diff --git a/src/router/routes/modules/hotel.ts b/src/router/routes/modules/hotel.ts
new file mode 100644
index 0000000..79eefe2
--- /dev/null
+++ b/src/router/routes/modules/hotel.ts
@@ -0,0 +1,46 @@
+import { DEFAULT_LAYOUT } from '../base';
+import { AppRouteRecordRaw } from '../types';
+
+const HOTEL: AppRouteRecordRaw = {
+ path: '/hotel',
+ name: 'Hotel',
+ component: DEFAULT_LAYOUT,
+ meta: {
+ locale: '酒店管理',
+ title: '酒店管理',
+ icon: 'icon-empty',
+ requiresAuth: true,
+ order: 1,
+ // permissions: ['hotel'],
+ permissions: ['*'],
+ },
+ children: [
+ {
+ path: 'room',
+ name: 'Room',
+ component: () => import('@/views/hotel/room/index.vue'),
+ meta: {
+ locale: '房间管理',
+ title: '房间管理',
+ requiresAuth: true,
+ // permissions: ['hotel:room'],
+ permissions: ['*'],
+ },
+ },
+ {
+ path: 'guest',
+ name: 'Guest',
+ component: () => import('@/views/hotel/guest/index.vue'),
+ meta: {
+ locale: '游客管理',
+ title: '游客管理',
+ requiresAuth: true,
+ // permissions: ['hotel:guest'],
+ permissions: ['*'],
+ },
+ },
+
+ ],
+};
+
+export default HOTEL;
diff --git a/src/views/hotel/guest/components/guest-edit.vue b/src/views/hotel/guest/components/guest-edit.vue
new file mode 100644
index 0000000..8122520
--- /dev/null
+++ b/src/views/hotel/guest/components/guest-edit.vue
@@ -0,0 +1,171 @@
+
+
+
+ 新建
+
+
+
+ 编辑
+
+
+ {{ modalTitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/hotel/guest/index.vue b/src/views/hotel/guest/index.vue
new file mode 100644
index 0000000..a953323
--- /dev/null
+++ b/src/views/hotel/guest/index.vue
@@ -0,0 +1,281 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dayjs(record.checkInTime).format('YYYY-MM-DD') }}
+
+
+ 已退房
+ 入住中
+
+
+
+
+
+ 退房
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/hotel/room/components/room-edit.vue b/src/views/hotel/room/components/room-edit.vue
new file mode 100644
index 0000000..cd44429
--- /dev/null
+++ b/src/views/hotel/room/components/room-edit.vue
@@ -0,0 +1,111 @@
+
+
+
+ 新建
+
+
+
+ 编辑
+
+
+ {{ modalTitle }}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/hotel/room/index.vue b/src/views/hotel/room/index.vue
new file mode 100644
index 0000000..1d67e82
--- /dev/null
+++ b/src/views/hotel/room/index.vue
@@ -0,0 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dayjs(record.createTime).format('YYYY-MM-DD') }}
+
+
+ 空闲中
+ 入住中
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file