using KJD_Web.Services.Shops; using KJD_Web.Utils; using MySqlX.XDevAPI.Relational; using Store.Contracts.Order.Entitys; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace KJD_Web.Model.WxModel; public class ShopRevenueStatistics { public class StatisticsBase { public long ShopId { get; set; } public string OrderId { get; set; } } /// /// 订单信息 /// public class OrderInfo : StatisticsBase { public string ShopName { get; set; } /// /// 外采金额(单位:分,整数存储) 最后一次购买的商品金额 /// public int OutAmount { get { if (BuyerOrders == null || BuyerOrders.Count == 0) return 0; return BuyerOrders.Last().OutAmount; } } /// /// 订单金额,单位为分, /// public int OrderPrice { get; set; } /// /// 平台服务费(微信小店:预计技术服务费),单位为分 /// public int PredictCommissionFee { get; set; } /// /// 达人佣金(微信小店:分账金额),单位为分 /// public int CommissionAmount { get; set; } /// /// 利润 /// public int Profit { get; set; } /// /// 快递包裹费用 /// public int PackageAmount { get; set; } /// /// 采购类型 /// public PurchaseType PurchaseType { get; set; } public List Items { get; set; } = []; /// /// 买手订单信息 /// public List BuyerOrders { get; set; } = []; public bool HasRefund => Items.Any(x => x.IsAfterSale); public DateTime CreateTime { get; set; } public DateTime UpdateTime { get; set; } } public class OrderItemInfo { public string OrderId { get; set; } public string SkuId { get; set; } /// /// SKU价格 /// public int SkuPrice { get; set; } /// /// 是否退款完成 /// public bool IsRefundSuccessed { get { return AfterSaleStatus == AfterSaleStatus.MERCHANT_REFUND_SUCCESS || AfterSaleStatus == AfterSaleStatus.MERCHANT_RETURN_SUCCESS; } } /// /// 是否是售后订单 /// public bool IsAfterSale { get { return AfterSaleStatus != AfterSaleStatus.NONE; } } /// /// 退款状态 /// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4: 退款成功 11 退款完成订单已取消 /// public int RefundStatus { get; set; } public AfterSaleStatus AfterSaleStatus { get; set; } = AfterSaleStatus.NONE; /// /// 退款金额 /// public int RefundAmount { get; set; } } public class OrderFlatInfo { public long ShopId { get; set; } public string OrderId { get; set; } public int CreateTime { get; set; } public int UpdateTime { get; set; } public string ShopName { get; set; } public int OutAmount { get; set; } public int OrderPrice { get; set; } public int PredictCommissionFee { get; set; } public int CommissionAmount { get; set; } // 子表字段 public string SkuId { get; set; } public int SkuPrice { get; set; } public int CashCouponDiscountedPrice { get; set; } public int RefundStatus { get; set; } } /// /// 订单退款 /// public class OrderRefundInfo : StatisticsBase { public string SkuId { get; set; } /// /// 退款状态 /// public string Status { get; set; } /// /// 退款金额 /// public int RefundAmount { get; set; } public int CreateTime { get; set; } } /// /// 买手订单 /// public class BuyerOrderInfo : StatisticsBase { public long Id { get; set; } /// /// 是否有效订单 /// 主订单未退款采用的买手订单 /// public bool IsValid { get; set; } /// /// 采购类型 /// public PurchaseType PurchaseType { get; set; } /// /// 买手订单 /// public string SkuId { get; set; } public string OutOrderSn { get; set; } /// /// 购买金额(分) /// public int OutAmount { get; set; } ///// ///// 订单作废状态:0=正常,1=已作废,2=作废失败 ///// //public int Status { get; set; } public long RefundId { get; set; } /// /// 退款金额(分) /// public int RefundAmount { get; set; } /// /// 退款状态 /// public string RefundStatusText { get; set; } public string Remark { get; set; } public DateTime CreateTime { get; set; } } /// /// 更新要素信息 /// public class UpdateStatsInfo { /// /// 商铺Id /// public string ShopId { get; set; } /// /// 订单创建时间 /// public int OrderCreateAt { get; set; } public DateTime OrderCreateDate => TimeUtils.StampToDateTime(OrderCreateAt).Date; } }