修改挂单功能

This commit is contained in:
2025-09-09 16:25:28 +08:00
parent e6c6b1f43f
commit ded24a8446
23 changed files with 1073 additions and 231 deletions

View File

@@ -15,6 +15,15 @@
<div class="col-sm-4 text-left">
<input class="form-control" v-model="guadanorder.order_form.orderNo" readonly />
</div>
<label class="col-sm-2 col-form-label text-center">關聯活動</label>
<div class="col-sm-4">
<select class="form-control" v-model="guadanorder.order_form.activityNum" >
<option :value="null">未關聯</option>
<option v-for="activity in activityList" :key="activity.num" :value="activity.num">
{{activity.subject}}
</option>
</select>
</div>
</div>
<div class="form-group row mt-3">
<label class="col-sm-2 col-form-label text-center">
@@ -86,14 +95,51 @@
{{item.follower?.u_name}}
</template>
<template #item.actions="{ item }">
<v-btn color="red" variant="outlined" size="small" class="me-2" @click="confirmDeleteGuadanOrderGuest(item)">
取消
</v-btn>
<v-btn color="primary" variant="outlined" size="small" @click="editGuadanOrderGuest(item)">
<v-icon start>mdi-pencil</v-icon>
編輯
</v-btn>
</template>
<div>
<!-- 取消預訂 -->
<v-btn
color="red"
variant="outlined"
size="small"
class="me-2"
:disabled="item.statuscode !== '401'"
@click="confirmDeleteGuadanOrderGuest(item)"
>
取消預訂
</v-btn>
<v-btn
color="red"
variant="outlined"
size="small"
class="me-2"
:disabled="item.statuscode !== '401'"
@click="checkinGuadanGuest(item)"
>
入住
</v-btn>
<v-btn
color="red"
variant="outlined"
size="small"
class="me-2"
:disabled="item.statuscode !== '402'">
續住
</v-btn>
<!-- 退房 -->
<v-btn
color="primary"
variant="outlined"
size="small"
:disabled="item.statuscode !== '402'"
@click="checkoutGuadanOrderGuest(item)"
>
<v-icon start>mdi-exit-run</v-icon>
退房
</v-btn>
</div>
</template>
</v-data-table>
</fieldset>
@@ -174,21 +220,6 @@
<div class="text-info text-xs mt-1">請從床位清單中選擇</div>
</div>
</v-col>
<v-col cols="12" sm="6">
<div class="d-flex flex-column justify-center" style="height: 100%;">
<v-select
v-model="checkInGuest.inGuest.statusUuid"
:items="checkInGuest.status"
item-value="uuid"
item-text="name"
label="选择個人挂单状态"
dense
outlined
></v-select>
</div>
</v-col>
</v-row>
</v-container>
</v-card-text>
@@ -768,6 +799,7 @@
vuetify: new Vuetify(vuetify_options),
data() {
return {
activityList: [],
availableBedCount: {
male: 0,
female: 0,
@@ -782,6 +814,7 @@
bookerName: null,
bookerPhone: null,
bookerFollowerNum: null,
activityNum: null,
},
status_items: [],
},
@@ -848,7 +881,7 @@
bedUuid: null,
checkInAt: null,
checkOutAt: null,
statusUuid: null,
statuscode: null,
},
status: [],
},
@@ -938,8 +971,14 @@
}
},
methods: {
getActivityList() {
axios.post('/api/activity/GetList?page=1&pageSize=500', { kind: 0, subject: "" })
.then((res) => {
this.activityList = res.data.list
})
},
getavailablebedcountbytime(startTime, endTime) {
axios.get('/api/region/bed/getavailablebedcountbytime',{
axios.get('/api/region/bed/getavailablebedcountbytime', {
params: {
startTime: startTime,
endTime: endTime
@@ -1117,6 +1156,7 @@
this.guadanorder.order_form.bookerPhone = res.data.bookerPhone;
this.guadanorder.order_form.bookerFollowerNum = res.data.bookerFollowerNum;
this.guadanorder.order_form.uuid = res.data.uuid;
this.guadanorder.order_form.activityNum = res.data.activityNum;
})
}
},
@@ -1203,6 +1243,40 @@
//掛單相關方法-------------------end
//增加蓮友方法-------------------start
checkoutGuadanOrderGuest(guest) {
this.$refs.confirmModal.open({
message: `確定要將 ${guest.follower.u_name || ''} 退房嗎?`,
onConfirm: async () => {
try {
const response = await axios.post(`/api/guadanorderguest/checkout`, null, {
params: { uuid: guest.uuid }
});
// 成功提示
this.$refs.messageModal.open({
title: '操作成功',
message: '退房成功!',
status: 'success'
});
// 更新狀態並刷新資料
guest.statusCode = "403"; // 已退房
this.getGuadanOrderGuestByOrderNo();
} catch (error) {
console.error(error);
// 失敗提示
this.$refs.messageModal.open({
title: '操作失敗',
message: error.response?.data?.message || '退房過程中發生錯誤!',
status: 'error'
});
}
}
});
},
resetInGuest() {
this.checkInGuest.inGuest = {
uuid: null,
@@ -1212,7 +1286,7 @@
bedUuid: null,
checkInAt: null,
checkOutAt: null,
statusUuid: null,
statuscode: null,
};
},
setInGuest() {
@@ -1284,8 +1358,7 @@
getGuadanGuestStatus() {
axios.get('/api/region/bed/status/list')
.then((res) => {
this.checkInGuest.status = res.data.filter(item => item.category === 4);
console.log(this.checkInGuest.status);
this.checkInGuest.status = res.data.filter(item => item.category === 4 && item.code != '404');
})
},
//增加蓮友方法-------------------end
@@ -1318,7 +1391,7 @@
},
selectGuadanOrderGuest(guest) {
this.selectGuestModal.currentSelectedGuest = guest;
console.log('----------'+ guest)
console.log('----------' + guest)
this.selectGuestModal.fullNameText = guest.u_name;
this.checkInGuest.inGuest.followerNum = guest.num;
this.selectGuestModal.showSelectGuestModal = false;
@@ -1336,7 +1409,7 @@
this.getCurrentSelectBedTextByBedId(guest.bedUuid);
this.selectGuestModal.fullNameText = guest.follower?.u_name;
this.selectGuestModal.currentSelectedGuest = guest.follower;
this.checkInGuest.inGuest.statusUuid = guest.statusUuid;
this.checkInGuest.inGuest.statuscode = guest.statuscode;
},
async saveEditGuadanOrderGuest() {
@@ -1352,9 +1425,14 @@
},
deleteGuadanOrderGuest(guest) {
axios.post('/api/guadanorderguest/delete?uuid=' + guest.uuid).then((res) => {
this.guadanguest.items = this.guadanguest.items.filter(i => i.uuid != guest.uuid);
})
axios.post('/api/guadanorderguest/cancel?uuid=' + guest.uuid)
.then((res) => {
this.guadanguest.items = this.guadanguest.items.filter(i => i.uuid != guest.uuid);
}).catch((error) => {
this.$refs.messageModal.open({
message: (error.response?.data?.message || error.message)
})
});
},
confirmDeleteGuadanOrderGuest(guest) {
this.$refs.confirmModal.open({
@@ -1364,6 +1442,43 @@
}
})
},
async checkinGuadanGuest(guest) {
// 先確認操作
this.$refs.confirmModal.open({
message: '確認入住?',
onConfirm: async () => {
try {
// 發送請求到後端 API
const response = await axios.post(`/api/guadanorderguest/checkin`, null, {
params: { uuid: guest.uuid }
});
// 成功提示
this.$refs.messageModal.open({
title: '操作成功',
message: '入住成功!',
status: 'success'
});
// 更新本地列表,修改狀態為已入住 (402)
guest.statusCode = "402";
// 如果需要刷新整個列表,也可以調用
this.getGuadanOrderGuestByOrderNo();
} catch (error) {
console.error(error);
// 失敗提示
this.$refs.messageModal.open({
title: '操作失敗',
message: error.response?.data?.message || '入住過程中發生錯誤!',
status: 'error'
});
}
}
});
},
//蓮友選擇相關方法---------------end
//床位選擇相關方法----------------start
@@ -1532,6 +1647,7 @@
this.loadRegions();
this.getGuadanOrderStatus();
this.getGuadanGuestStatus();
this.getActivityList();
},
computed: {

View File

@@ -56,7 +56,7 @@
return {
items: [],
headers: [
{ text: '登记挂单莲友', value: 'bookerName'},
{ text: '登记挂单莲友', value: 'bookerName' },
{ text: '起始日期', value: 'start_date', align: 'center' },
{ text: '結束日期', value: 'end_date', align: 'center' },
{ text: '掛單人數', value: 'guest_count' },
@@ -81,7 +81,7 @@
this.$refs.confirmModal.open({
message: '確認取消掛單?',
onConfirm: () => {
axios.post('/api/guadan/delete', null, {
axios.post('/api/guadan/cancel', null, {
params: {
uuid: order.uuid
}

View File

@@ -0,0 +1,193 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="statistics_table.aspx.cs" Inherits="admin_guadan_statistics_table" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!-- 今日使用情況 -->
<div class="section mb-6">
<v-card outlined class="pa-1">
<v-card-title class="headline grey--text text--darken-2">
今日使用情况
</v-card-title>
<v-divider class="mb-4"></v-divider>
<v-card-text>
<div class="d-flex flex-wrap justify-space-around">
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined>
<div class="subtitle-1 font-weight-bold">总预订人数</div>
<div class="headline">{{totalbookers }}</div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined>
<div class="subtitle-1 font-weight-bold">今日预订人数</div>
<div class="headline">{{today.todaytotalbookers }}</div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined>
<div class="subtitle-1 font-weight-bold">今日已入住人数</div>
<div class="headline">{{today.checkin }}</div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#e3f2fd" outlined>
<div class="subtitle-1 font-weight-bold">今日待入住人数</div>
<div class="headline">{{today.todaytotalbookers - today.checkin }}</div>
</v-card>
<v-card class="ma-2 pa-3 text-center" color="#fce4ec" outlined>
<div class="subtitle-1 font-weight-bold">空床數</div>
<div class="headline">{{ bedcount - today.todaytotalbookers}}</div>
</v-card>
</div>
</v-card-text>
</v-card>
</div>
<!-- 近期床位使用統計 -->
<div class="section container">
<!-- 日期筛选区 -->
<div class="d-flex align-center flex-wrap" style="gap: 12px;">
<!-- 开始日期 -->
<v-menu
ref="menu1"
v-model="menu1"
:close-on-content-click="false"
transition="scale-transition"
offset-y
min-width="auto"
>
<template v-slot:activator="{ on, attrs }">
<v-text-field
v-model="startDate"
label="開始日期"
prepend-icon="mdi-calendar"
readonly
v-bind="attrs"
v-on="on"
dense
outlined
></v-text-field>
</template>
<v-date-picker v-model="startDate" @input="menu1 = false"></v-date-picker>
</v-menu>
<!-- 结束日期 -->
<v-menu
ref="menu2"
v-model="menu2"
:close-on-content-click="false"
transition="scale-transition"
offset-y
min-width="auto"
>
<template v-slot:activator="{ on, attrs }">
<v-text-field
v-model="endDate"
label="結束日期"
prepend-icon="mdi-calendar"
readonly
v-bind="attrs"
v-on="on"
dense
outlined
></v-text-field>
</template>
<v-date-picker v-model="endDate" @input="menu2 = false"></v-date-picker>
</v-menu>
<!-- 查询按钮 -->
<v-btn
color="primary"
@click="getList"
style="align-self: stretch;"
>
查詢
</v-btn>
</div>
</div>
<v-divider class="mb-4"></v-divider>
<div>
<!-- 表格 -->
<v-data-table
:items="items"
:headers="headers"
class="elevation-2"
dense
hide-default-footer
:items-per-page="10"
>
<template #item.date="{ item }">
<span>{{ item.date | timeString('YYYY-MM-DD') }}</span>
</template>
<template #item.bedusagerate="{ item }">
{{ ((item.todaytotalbookers / bedcount) * 100).toFixed(2) + '%' }}
</template>
<template #item.roomcount="{item}">
{{roomcount}}
</template>
<template #item.bedcount="{item}">
{{bedcount}}
</template>
</v-data-table>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
items: [],
headers: [
{ text: '日期', value: 'date' },
{ text: '房间数量', value: 'roomcount' },
{ text: '床位数量', value: 'bedcount' },
{ text: '预约人数', value: 'todaytotalbookers' },
{ text: '已入住人数', value: 'checkin'},
{ text: '可用床位', value: 'availableBeds' },
{ text: '床位利用率', value: 'bedusagerate' }
],
today: {},
totalbookers: 0,
startDate: null,
endDate: null,
menu1: false,
menu2: false,
bedcount: 0,
roomcount: 0,
}
},
methods: {
async getList() {
try {
const res = await axios.get('/api/guadan/guadanstatisticstable/list', {
params: {
start: this.startDate || '',
end: this.endDate || ''
}
});
this.items = res.data.statistics;
this.roomcount = res.data.roomcount;
this.bedcount = res.data.bedcount;
this.today = res.data.today;
this.totalbookers = res.data.totalbookers;
} catch (e) {
console.error(e);
}
}
},
mounted() {
this.getList();
}
})
</script>
</asp:Content>

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_guadan_statistics_table : MyWeb.config
{
protected void Page_Load(object sender, EventArgs e)
{
}
}