修改挂单功能
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user