using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace CampusErrand.Models; /// /// 订单表 /// public class Order { [Key] public int Id { get; set; } /// 订单编号 [MaxLength(32)] public string OrderNo { get; set; } = string.Empty; /// 单主用户 ID public int OwnerId { get; set; } /// 跑腿用户 ID public int? RunnerId { get; set; } /// 订单类型 public OrderType OrderType { get; set; } /// 订单状态 public OrderStatus Status { get; set; } = OrderStatus.Pending; /// 物品名称/要做的事情 [MaxLength(256)] public string ItemName { get; set; } = string.Empty; /// 取货/代取地点 [MaxLength(256)] public string? PickupLocation { get; set; } /// 送达地点 [MaxLength(256)] public string DeliveryLocation { get; set; } = string.Empty; /// 备注信息 [MaxLength(512)] public string? Remark { get; set; } /// 联系手机号 [MaxLength(20)] public string Phone { get; set; } = string.Empty; /// 跑腿佣金 [Column(TypeName = "decimal(10,2)")] public decimal Commission { get; set; } /// 商品总金额(万能帮/代购/美食街) [Column(TypeName = "decimal(10,2)")] public decimal? GoodsAmount { get; set; } /// 支付总金额 [Column(TypeName = "decimal(10,2)")] public decimal TotalAmount { get; set; } /// 完成凭证图片 [MaxLength(512)] public string? CompletionProof { get; set; } /// 是否已评价 public bool IsReviewed { get; set; } /// 下单时间 public DateTime CreatedAt { get; set; } = DateTime.UtcNow; /// 接单时间 public DateTime? AcceptedAt { get; set; } /// 完成时间 public DateTime? CompletedAt { get; set; } /// IM 群组 ID(接单时创建) [MaxLength(64)] public string? ImGroupId { get; set; } // 导航属性 [ForeignKey(nameof(OwnerId))] public User? Owner { get; set; } [ForeignKey(nameof(RunnerId))] public User? Runner { get; set; } public ICollection FoodOrderItems { get; set; } = []; }