You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.8 KiB

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();
}
}
/// <summary>
/// 代发信息Id
/// </summary>
public long? OrderDropShippingId { get; set; }
[JsonIgnore]
public Action OnSkuAmountChanged { get; set; }
public bool IsSelected { get => isSelected; set { SetProperty(ref isSelected, value); } }
}
}