using CommunityToolkit.Mvvm.ComponentModel; using Newtonsoft.Json; using System; namespace BBWY.Client.Models { public class RelationPurchaseOrderSku : ObservableObject { public RelationPurchaseOrderSku() { SingleSkuAmountStr = (0).ToString(); } private bool isSelected; private string singleSkuAmountStr; private decimal singleSkuAmount; private decimal skuAmount; public string ProductId { get; set; } public string SkuId { get; set; } public string Logo { get; set; } public int Quantity { get; set; } public string Title { get; set; } public string SingleSkuAmountStr { get => singleSkuAmountStr; set { if (SetProperty(ref singleSkuAmountStr, value)) { if (decimal.TryParse(value, out decimal d)) SingleSkuAmount = d; } } } public decimal SingleSkuAmount { get => singleSkuAmount; set { if (SetProperty(ref singleSkuAmount, value)) SkuAmount = SingleSkuAmount * Quantity; } } public decimal SkuAmount { get => skuAmount; set { if (SetProperty(ref skuAmount, value)) OnSkuAmountChanged?.Invoke(); } } /// /// 代发信息Id /// public long? OrderDropShippingId { get; set; } [JsonIgnore] public Action OnSkuAmountChanged { get; set; } public bool IsSelected { get => isSelected; set { SetProperty(ref isSelected, value); } } } }