using AllBase.Model.Result; using System; using System.Collections.Generic; using System.Linq; using WPFCommon.Helpers; using WPFCommon.Models; namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels; /// /// 订单发票Model /// public class PddBrowserOrderInvoiceViewModel : BindableBaseEx { private bool _isSelected; /// /// 是否被勾选(用于批量开票) /// public bool IsSelected { get => _isSelected; set => SetProperty(ref _isSelected, value, nameof(IsSelected)); } public string buyerId { get; set; } // 买手Id public string buyerName { get; set; } // 买手名称 /// /// 订单价 /// public int order_amount { get; set; } /// /// 实付款 /// public string display_amount { get; set; } /// /// 下单时间 /// public long order_time { get; set; } /// /// 订单号 /// public string order_sn { get; set; } public int status { get; set; } public int pay_status { get; set; } public string order_status_prompt { get; set; } /// /// 订单详情 /// public string order_link_url { get; set; } public List order_Goods { get; set; } public List order_buttons { get; set; } public string GoodsName { get => order_Goods?.FirstOrDefault()?.goods_name ?? ""; } /// /// 是否已开票 /// public bool IsInvoiced { get => GetValue(); set { SetValue(value); base.RaisePropertyChanged(nameof(InvoiceStatusText)); } } public int Quantity => order_Goods?.Sum(a => a.goods_number.Value) ?? 0; /// 发票状态文案:已开票 / 待开票 public string InvoiceStatusText => IsInvoiced ? "已开票" : "待开票"; public DateTime OrderTime { get => DateTimeHelper.ConvertFromUnixTimestampInSeconds(order_time); } public string ThumbUrl => order_Goods?.FirstOrDefault()?.thumb_url ?? ""; public string DisplayAmount => (order_amount / 100.0).ToString("F2"); } public class OrderButtonItem { public int button_code { get; set; } public string brief_prompt { get; set; } public ButtonTypeValue type_value { get; set; } } public class ButtonTypeValue { public string Url { get; set; } }