From 4419dfff64e85fbdcfa1b25af1c70ae1175a8468 Mon Sep 17 00:00:00 2001 From: HUANGBANGLIN Date: Fri, 12 Sep 2025 13:48:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E8=B5=84=E6=96=99=E5=BA=93=E4=BA=A7?= =?UTF-8?q?=E8=89=B2=E7=9A=84=E5=87=A0=E4=B8=AA=E6=96=87=E4=BB=B6=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=EF=BC=8C=E6=B1=87=E5=87=BA=E6=8C=82=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=8C=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A6=81=E6=9C=89=E6=89=8D=E8=83=BD=E8=BF=90?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/App_Code/Model/Model.Context.cs | 7 +- web/App_Code/Model/Model.Designer.cs | 18 +- web/App_Code/Model/Model.cs | 78 +++-- web/App_Code/Model/Model.edmx | 270 +++++++----------- web/App_Code/Model/Model.edmx.diagram | 24 +- web/App_Code/api/guadanOrderController.cs | 5 +- .../api/guadanOrderGuestController.cs | 73 ++++- web/App_Code/guadanGuestQueryController.cs | 70 +++++ web/admin/guadan/create.aspx | 139 ++++++++- web/admin/guadan/guest/index.aspx | 198 +++++++++++++ web/admin/guadan/guest/index.aspx.cs | 14 + web/admin/guadan/index.aspx | 2 +- 12 files changed, 667 insertions(+), 231 deletions(-) create mode 100644 web/App_Code/guadanGuestQueryController.cs create mode 100644 web/admin/guadan/guest/index.aspx create mode 100644 web/admin/guadan/guest/index.aspx.cs diff --git a/web/App_Code/Model/Model.Context.cs b/web/App_Code/Model/Model.Context.cs index 7b8c298..b3af8b4 100644 --- a/web/App_Code/Model/Model.Context.cs +++ b/web/App_Code/Model/Model.Context.cs @@ -1,9 +1,9 @@ //------------------------------------------------------------------------------ // -// This code was generated from a template. +// 這個程式碼是由範本產生。 // -// Manual changes to this file may cause unexpected behavior in your application. -// Manual changes to this file will be overwritten if the code is regenerated. +// 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。 +// 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。 // //------------------------------------------------------------------------------ @@ -74,7 +74,6 @@ namespace Model public virtual DbSet stock_reason { get; set; } public virtual DbSet suppliers { get; set; } public virtual DbSet supplier_kind { get; set; } - public virtual DbSet sysdiagrams { get; set; } public virtual DbSet act_bom { get; set; } public virtual DbSet family_members { get; set; } public virtual DbSet PostCitiy { get; set; } diff --git a/web/App_Code/Model/Model.Designer.cs b/web/App_Code/Model/Model.Designer.cs index 7cfed4e..1c2d095 100644 --- a/web/App_Code/Model/Model.Designer.cs +++ b/web/App_Code/Model/Model.Designer.cs @@ -1,10 +1,10 @@ -// T4 code generation is enabled for model 'D:\dev\ez\17168erp\git_17888\web\App_Code\Model\Model.edmx'. -// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer -// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model -// is open in the designer. +// 已啟用模型 'D:\17168erp_new_git\17168ERP\web\App_Code\Model\Model.edmx' 的 T4 程式碼產生。 +// 若要啟用舊版程式碼產生,請將 [程式碼產生策略] 設計工具屬性的值 +//變更為 [舊版 ObjectContext]。當模型在設計工具中開啟時,這個屬性便可 +//以在 [屬性] 視窗中使用。 -// If no context and entity classes have been generated, it may be because you created an empty model but -// have not yet chosen which version of Entity Framework to use. To generate a context class and entity -// classes for your model, open the model in the designer, right-click on the designer surface, and -// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation -// Item...'. \ No newline at end of file +// 如果尚未產生任何內容和實體類型,可能是因為您建立了空的模型,但 +//尚未選擇要使用的 Entity Framework 版本。若要為您的模型產生內容類別和 +//實體類型,請在設計工具中開啟模型,以滑鼠右鍵按一下設計工具介面並 +//選取 [從資料庫更新模型]、[由模型產生資料庫] 或 [加入程式碼產生 +//項目]。 \ No newline at end of file diff --git a/web/App_Code/Model/Model.cs b/web/App_Code/Model/Model.cs index 8688c37..1f090d4 100644 --- a/web/App_Code/Model/Model.cs +++ b/web/App_Code/Model/Model.cs @@ -1,9 +1,9 @@ //------------------------------------------------------------------------------ // -// This code was generated from a template. +// 這個程式碼是由範本產生。 // -// Manual changes to this file may cause unexpected behavior in your application. -// Manual changes to this file will be overwritten if the code is regenerated. +// 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。 +// 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。 // //------------------------------------------------------------------------------ @@ -441,7 +441,7 @@ namespace Model { this.members = new HashSet(); this.news = new HashSet(); - this.GuaDanOrders = new HashSet(); + this.GuaDanOrder = new HashSet(); } public int num { get; set; } @@ -477,7 +477,7 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection news { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrders { get; set; } + public virtual ICollection GuaDanOrder { get; set; } } } namespace Model @@ -768,8 +768,8 @@ namespace Model this.family_members = new HashSet(); this.transfer_register = new HashSet(); this.transfer_register1 = new HashSet(); - this.GuaDanOrders = new HashSet(); - this.GuaDanOrderGuests = new HashSet(); + this.GuaDanOrder = new HashSet(); + this.GuaDanOrderGuest = new HashSet(); } public int num { get; set; } @@ -830,9 +830,9 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection transfer_register1 { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrders { get; set; } + public virtual ICollection GuaDanOrder { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrderGuests { get; set; } + public virtual ICollection GuaDanOrderGuest { get; set; } } } namespace Model @@ -869,9 +869,11 @@ namespace Model public string BookerPhone { get; set; } public bool IsDeleted { get; set; } public System.Guid Uuid { get; set; } + public Nullable ActivityNum { get; set; } + public bool IsCancel { get; set; } public virtual admin admin { get; set; } - public virtual follower follower { get; set; } + public virtual follower followers { get; set; } } } namespace Model @@ -881,6 +883,12 @@ namespace Model public partial class GuaDanOrderGuest { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] + public GuaDanOrderGuest() + { + this.RegionAndRoomAndBedSchedule = new HashSet(); + } + public string GuaDanOrderNo { get; set; } public Nullable FollowerNum { get; set; } public bool IsDeleted { get; set; } @@ -889,12 +897,14 @@ namespace Model public Nullable BedUuid { get; set; } public Nullable CheckInAt { get; set; } public Nullable CheckOutAt { get; set; } - public Nullable statusUuid { get; set; } + public string StatusCode { get; set; } - public virtual follower follower { get; set; } + public virtual follower followers { get; set; } public virtual RegionRoomBed RegionRoomBed { get; set; } public virtual Room Room { get; set; } public virtual RegionRoomBedStatus RegionRoomBedStatus { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection RegionAndRoomAndBedSchedule { get; set; } } } namespace Model @@ -1393,7 +1403,10 @@ namespace Model public Nullable TargetUuid { get; set; } public string GuaDanOrderNo { get; set; } public Nullable ScheduleDate { get; set; } - public bool IsActive { get; set; } + public bool IsCancel { get; set; } + public Nullable GuaDanOrderGuestUuid { get; set; } + + public virtual GuaDanOrderGuest GuaDanOrderGuest { get; set; } } } namespace Model @@ -1406,7 +1419,7 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public RegionRoomBed() { - this.GuaDanOrderGuests = new HashSet(); + this.GuaDanOrderGuest = new HashSet(); } public string Name { get; set; } @@ -1415,12 +1428,12 @@ namespace Model public bool IsDeleted { get; set; } public System.Guid Uuid { get; set; } public System.Guid RoomUuid { get; set; } - public Nullable StatusUuid { get; set; } + public string StatusCode { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrderGuests { get; set; } - public virtual RegionRoomBedStatus RegionRoomBedStatus { get; set; } + public virtual ICollection GuaDanOrderGuest { get; set; } public virtual Room Room { get; set; } + public virtual RegionRoomBedStatus RegionRoomBedStatus { get; set; } } } namespace Model @@ -1433,8 +1446,8 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public RegionRoomBedStatus() { - this.GuaDanOrderGuests = new HashSet(); - this.RegionRoomBeds = new HashSet(); + this.GuaDanOrderGuest = new HashSet(); + this.RegionRoomBed = new HashSet(); } public string Code { get; set; } @@ -1442,12 +1455,11 @@ namespace Model public string Description { get; set; } public Nullable Category { get; set; } public bool IsDeleted { get; set; } - public System.Guid Uuid { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrderGuests { get; set; } + public virtual ICollection GuaDanOrderGuest { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection RegionRoomBeds { get; set; } + public virtual ICollection RegionRoomBed { get; set; } } } namespace Model @@ -1460,7 +1472,7 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public RegionType() { - this.Regions = new HashSet(); + this.Region = new HashSet(); } public string Code { get; set; } @@ -1471,7 +1483,7 @@ namespace Model public System.Guid Uuid { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection Regions { get; set; } + public virtual ICollection Region { get; set; } } } namespace Model @@ -1484,7 +1496,7 @@ namespace Model [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public Room() { - this.GuaDanOrderGuests = new HashSet(); + this.GuaDanOrderGuest = new HashSet(); this.RegionRoomBed = new HashSet(); } @@ -1499,7 +1511,7 @@ namespace Model public System.Guid RegionUuid { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection GuaDanOrderGuests { get; set; } + public virtual ICollection GuaDanOrderGuest { get; set; } public virtual Region Region { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection RegionRoomBed { get; set; } @@ -1685,20 +1697,6 @@ namespace Model using System; using System.Collections.Generic; - public partial class sysdiagram - { - public string name { get; set; } - public int principal_id { get; set; } - public int diagram_id { get; set; } - public Nullable version { get; set; } - public byte[] definition { get; set; } - } -} -namespace Model -{ - using System; - using System.Collections.Generic; - public partial class transfer_register { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] diff --git a/web/App_Code/Model/Model.edmx b/web/App_Code/Model/Model.edmx index aebea72..8e40781 100644 --- a/web/App_Code/Model/Model.edmx +++ b/web/App_Code/Model/Model.edmx @@ -438,6 +438,8 @@ + + @@ -451,7 +453,7 @@ - + @@ -733,7 +735,8 @@ - + + @@ -745,18 +748,17 @@ - + - + - + - @@ -876,16 +878,6 @@ - - - - - - - - - - @@ -1392,15 +1384,15 @@ - - + + - + - + @@ -1702,18 +1694,6 @@ - - - - - - - - - - - - @@ -1726,6 +1706,18 @@ + + + + + + + + + + + + @@ -1738,6 +1730,18 @@ + + + + + + + + + + + + @@ -1934,7 +1938,6 @@ - @@ -1944,36 +1947,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2036,7 +2009,6 @@ - @@ -2190,7 +2162,7 @@ - + @@ -2290,18 +2262,22 @@ - - - - + + + + + + + + @@ -2634,7 +2610,7 @@ - + @@ -2824,8 +2800,8 @@ - - + + @@ -3192,16 +3168,6 @@ - - - - - - - - - - @@ -3992,7 +3958,6 @@ - @@ -4355,10 +4320,14 @@ - + + + + + @@ -4371,14 +4340,14 @@ - - - - + + + + @@ -4668,8 +4637,10 @@ + + - + @@ -4683,11 +4654,12 @@ - - + + - + + @@ -4736,7 +4708,9 @@ - + + + @@ -4748,23 +4722,22 @@ - - - + + + - + - + - - - + + @@ -4776,7 +4749,7 @@ - + @@ -4791,7 +4764,7 @@ - + @@ -4855,15 +4828,27 @@ - - + + - + - + + + + + + + + + + + + + @@ -4903,18 +4888,6 @@ - - - - - - - - - - - - @@ -4927,6 +4900,18 @@ + + + + + + + + + + + + @@ -5666,42 +5651,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5803,6 +5753,8 @@ + + @@ -5821,7 +5773,7 @@ - + @@ -5867,7 +5819,8 @@ - + + @@ -5884,7 +5837,7 @@ - + @@ -5897,7 +5850,6 @@ - @@ -5947,7 +5899,7 @@ - + diff --git a/web/App_Code/Model/Model.edmx.diagram b/web/App_Code/Model/Model.edmx.diagram index 7f1c080..c1722e4 100644 --- a/web/App_Code/Model/Model.edmx.diagram +++ b/web/App_Code/Model/Model.edmx.diagram @@ -52,7 +52,6 @@ - @@ -131,26 +130,27 @@ - - - - - - - - - + + + + + + + + + - + + - + diff --git a/web/App_Code/api/guadanOrderController.cs b/web/App_Code/api/guadanOrderController.cs index dd07ca1..dbf7a6a 100644 --- a/web/App_Code/api/guadanOrderController.cs +++ b/web/App_Code/api/guadanOrderController.cs @@ -162,7 +162,10 @@ public class guadanOrderController : ApiController { return NotFound(); } - + if(_db.GuaDanOrderGuest.Any(a => a.GuaDanOrderNo == guadan.GuaDanOrderNo) ) + { + return BadRequest($"该挂单已经存在挂单莲友,不能取消!"); + } using (var transaction = _db.Database.BeginTransaction()) { try diff --git a/web/App_Code/api/guadanOrderGuestController.cs b/web/App_Code/api/guadanOrderGuestController.cs index 2e9923a..aca81d9 100644 --- a/web/App_Code/api/guadanOrderGuestController.cs +++ b/web/App_Code/api/guadanOrderGuestController.cs @@ -191,8 +191,6 @@ public class guadanOrderGuestController : ApiController _db.RegionAndRoomAndBedSchedule.Add(schedul); } await _db.SaveChangesAsync(); - await _db.SaveChangesAsync(); - return Ok(); } @@ -328,7 +326,56 @@ public class guadanOrderGuestController : ApiController await _db.SaveChangesAsync(); return Ok(); } + [HttpPost] + [Route("api/guadanorderguest/xuzhu")] + public async Task ExtendStay([FromBody] XuZhuModel model) + { + //续住方法 + if (model == null) + return BadRequest("请求数据为空"); + if (model.GuestUuid == Guid.Empty || model.GuestBedUuid == Guid.Empty) + return BadRequest("GuestUuid 或 GuestBedUuid 无效"); + var guest= await _db.GuaDanOrderGuest.FindAsync(model.GuestUuid); + if (guest == null) + { + return BadRequest("挂单不存在"); + } + if(guest.BedUuid != model.GuestBedUuid) + { + return BadRequest("床位不正确"); + } + var bedIsCanUse = await RegionAndRoomAndBedSchedule.IsBedAvailableAsync(_db,model.GuestBedUuid, model.CurrentCheckoutDate, model.NewCheckoutDate); + if(!bedIsCanUse) + { + return BadRequest("该床位在续住时间段内被预定,无法续住"); + } + + var newStartDate = model.CurrentCheckoutDate.Date; + var newEndDate = model.NewCheckoutDate.Date.AddDays(-1); + if (newEndDate < newStartDate) + return BadRequest("续住日期区间无效"); + for (var date = newStartDate; date <= newEndDate; date = date.AddDays(1)) + { + var newSchedule = new RegionAndRoomAndBedSchedule + { + GuaDanOrderNo = guest.GuaDanOrderNo, + Uuid = Guid.NewGuid(), + TargetUuid = model.GuestBedUuid, + GuaDanOrderGuestUuid = model.GuestUuid, + ScheduleDate = date, + Title = "续住挂单", // 一天一条,开始和结束是同一天 + Description = "续住挂单", + UseType = 30, + CreatedAt = DateTime.UtcNow + }; + + _db.RegionAndRoomAndBedSchedule.Add(newSchedule); + } + guest.CheckOutAt = model.NewCheckoutDate.Date; + await _db.SaveChangesAsync(); // 保存数据库操作 + return Ok(new { message = "续住成功" }); + } [HttpPost] [Route("api/guadanorderguest/cancel")] public async Task CancelGuadanGuest([FromUri] Guid uuid) @@ -541,12 +588,23 @@ public class guadanOrderGuestController : ApiController if (guest.BedUuid != null) { var bed = _db.RegionRoomBed.FirstOrDefault(b => b.Uuid == guest.BedUuid); - if (bed != null && StatusTransitionManager.CanTransition(bed.StatusCode, "102")) // 102 = 占用 + if(bed == null) + { + return BadRequest("入住床位不存在"); + } + if (StatusTransitionManager.CanTransition(bed.StatusCode, "102")) // 102 = 占用 { bed.StatusCode = "102"; } + else + { + return BadRequest($"当前床位状态:{bed.RegionRoomBedStatus.Name} 不能入住"); + } + } + else if(guest.BedUuid == null) + { + return BadRequest("入住床位不存在"); } - _db.SaveChanges(); return Ok(new { message = "入住成功", statusCode = guest.StatusCode }); @@ -593,5 +651,12 @@ public class guadanOrderGuestController : ApiController public int num { get; set; } public string u_name { get; set; } } + public class XuZhuModel + { + public Guid GuestUuid { get; set; } // 不可为空 + public Guid GuestBedUuid { get; set; } // 不可为空 + public DateTime CurrentCheckoutDate { get; set; } // 当前退房时间 + public DateTime NewCheckoutDate { get; set; } // 新退房时间 + } } \ No newline at end of file diff --git a/web/App_Code/guadanGuestQueryController.cs b/web/App_Code/guadanGuestQueryController.cs new file mode 100644 index 0000000..7a3c5ae --- /dev/null +++ b/web/App_Code/guadanGuestQueryController.cs @@ -0,0 +1,70 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Threading.Tasks; +using System.Web; +using System.Web.Http; + +/// +/// guadanGuestQueryController 的摘要描述 +/// +public class guadanGuestQueryController: ApiController +{ + private Model.ezEntities _db = new Model.ezEntities(); + public guadanGuestQueryController() + { + // + // TODO: 在這裡新增建構函式邏輯 + // + } + [HttpPost] + [Route("api/guadan/guest/query/list")] + public async Task GetList([FromBody] SearchGuestModel search) + { + var query = _db.GuaDanOrderGuest + .Where(guest => guest.StatusCode != "404"); + if(search.SearchName != null) + { + query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName)); + } + var data = await query.ToListAsync(); + var data1 = data.Select(a => new + { + name = a.followers != null ? a.followers.u_name : null, + checkindate = a.CheckInAt, + checkoutdate = a.CheckOutAt, + guadanorderno = a.GuaDanOrderNo, + roomName = GetRoomAndBedString(a.RegionRoomBed), + }).ToList(); + return Ok(new + { + items = data1, + total = data1.Count(), + }); + + } + public string GetRoomAndBedString(RegionRoomBed bed) + { + if (bed == null || bed.Room == null) return ""; + var room = bed.Room; + var region = room.Region; + var name = room.Name + "/" + bed.Name; + if(region != null) + { + name = region.Name + "/" + name; + } + var parentRegion = region.Region2; + while (parentRegion != null) + { + name = parentRegion.Name + "/" + name; + parentRegion = parentRegion.Region2; + } + return name; + } + public class SearchGuestModel + { + public string SearchName = null; + } +} \ No newline at end of file diff --git a/web/admin/guadan/create.aspx b/web/admin/guadan/create.aspx index 322434d..01d212d 100644 --- a/web/admin/guadan/create.aspx +++ b/web/admin/guadan/create.aspx @@ -122,7 +122,8 @@ variant="outlined" size="small" class="me-2" - :disabled="item.statuscode !== '402'"> + :disabled="item.statuscode !== '402'" + @click="showXuzhuGuestModalMethod(item)"> 續住 @@ -142,6 +143,52 @@ + +
+ + + + +
+ 续住 +
+ + mdi-close + +
+ + + +
+ 当前退房时间: + {{ guadanguest.xuzhu.currentCheckoutDate }} +
+
+ 续住后退房时间: + +
+
+ + + + 续住 + 取消 + +
+
+
@@ -868,6 +915,13 @@ ], items: [], showCreateGuestModal: false, + xuzhu: { + showXuzhuGuestModal: false, + currentCheckoutDate: null, + newCheckoutDate: null, + guestUuid: null, + guestBedUuid: null, + } }, checkInGuest: { showSelectGuadanOrderGuest: false, @@ -971,6 +1025,89 @@ } }, methods: { + //续住相關方法--------------------start + showXuzhuGuestModalMethod(guest) { + if (!guest.checkoutat) { + return; + } + this.guadanguest.xuzhu.showXuzhuGuestModal = true; + this.guadanguest.xuzhu.currentCheckoutDate = guest.checkoutat; + this.guadanguest.xuzhu.guestUuid = guest.uuid; + this.guadanguest.xuzhu.guestBedUuid = guest.bedUuid; + + this.$nextTick(() => { // 确保弹窗 DOM 已渲染 + const input = document.getElementById('newCheckoutDate'); + if (input) { + const checkoutDate = new Date(guest.checkoutat); // 用指定日期 + checkoutDate.setDate(checkoutDate.getDate() + 1); // 明天 + const year = checkoutDate.getFullYear(); + const month = String(checkoutDate.getMonth() + 1).padStart(2, '0'); + const day = String(checkoutDate.getDate()).padStart(2, '0'); + const tomorrow = `${year}-${month}-${day}`; + input.min = tomorrow; // 限制最小值 + //input.value = tomorrow; // 默认选中明天 + } + }); + console.log(guest.checkoutat) + }, + closeXuzhuGuestModalMethod() { + console.log(this.guadanguest.xuzhu.newCheckoutDate) + this.guadanguest.xuzhu.showXuzhuGuestModal = false; + this.guadanguest.xuzhu.currentCheckoutDate = null; + this.guadanguest.xuzhu.newCheckoutDate = null; + this.guadanguest.xuzhu.guestUuid = null; + this.guadanguest.xuzhu.guestBedUuid = null; + console.log(this.guadanguest.xuzhu.newCheckoutDate) + console.log(this.guadanguest.xuzhu.currentCheckoutDate) + console.log(this.guadanguest.xuzhu.guestUuid) + console.log(this.guadanguest.xuzhu.guestBedUuid) + }, + xuzhuPost() { + // 校验必填 + if (!this.guadanguest.xuzhu.guestUuid || !this.guadanguest.xuzhu.guestBedUuid) { + alert("GuestUuid 和 GuestBedUuid 不能为空"); + return; + } + if (!this.guadanguest.xuzhu.newCheckoutDate || !this.guadanguest.xuzhu.currentCheckoutDate) { + alert("续住时间不能为空"); + return; + } + + const payload = { + guestUuid: this.guadanguest.xuzhu.guestUuid, + guestBedUuid: this.guadanguest.xuzhu.guestBedUuid, + currentCheckoutDate: this.guadanguest.xuzhu.currentCheckoutDate, + newCheckoutDate: this.guadanguest.xuzhu.newCheckoutDate + }; + + axios.post('/api/guadanorderguest/xuzhu', payload) + .then((res) => { + this.$refs.messageModal.open({ + title: '续住成功', + message: '客人续住已处理', + status: 'success', + callback: () => { + // 弹窗关闭后的回调 + try { + this.getGuadanOrderGuestByOrderNo(); + } + catch (error) { + console.error("发生错误:", error.message); + } finally { + this.closeXuzhuGuestModalMethod(); + } + } + }); + }) + .catch((error) => { + this.$refs.messageModal.open({ + title: '续住失败', + message: error.response?.data?.message || '系统异常,请稍后重试', + status: 'error' + }); + }); + }, + //续住相關方法--------------------end getActivityList() { axios.post('/api/activity/GetList?page=1&pageSize=500', { kind: 0, subject: "" }) .then((res) => { diff --git a/web/admin/guadan/guest/index.aspx b/web/admin/guadan/guest/index.aspx new file mode 100644 index 0000000..cbb5410 --- /dev/null +++ b/web/admin/guadan/guest/index.aspx @@ -0,0 +1,198 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_guadan_guest_index" %> + + + + + + + + + +
+ + + + + + + + + + + + + 共 {{ }} 筆, 頁數: + + + + + + +
+ +
+ + + + + + + diff --git a/web/admin/guadan/guest/index.aspx.cs b/web/admin/guadan/guest/index.aspx.cs new file mode 100644 index 0000000..3b24b88 --- /dev/null +++ b/web/admin/guadan/guest/index.aspx.cs @@ -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_guest_index : MyWeb.config +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} \ No newline at end of file diff --git a/web/admin/guadan/index.aspx b/web/admin/guadan/index.aspx index 9a3fc46..a792648 100644 --- a/web/admin/guadan/index.aspx +++ b/web/admin/guadan/index.aspx @@ -92,7 +92,7 @@ }) }).catch((error) => { this.$refs.messageModal.open({ - message: '取消失敗' + message: error.response?.data || '取消失敗' }) }) }