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.
70 lines
1.8 KiB
70 lines
1.8 KiB
2 years ago
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Collections.ObjectModel;
|
||
|
|
||
|
namespace BBWYB.Client.Models
|
||
|
{
|
||
|
public class ProductSkuWithScheme : ObservableObject
|
||
|
{
|
||
|
private int quantity;
|
||
|
private bool isSelected;
|
||
|
public string Id { get; set; }
|
||
|
|
||
|
public string SkuId { get; set; }
|
||
|
|
||
|
public string ProductId { get; set; }
|
||
|
|
||
|
public decimal Price { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// Sku标题
|
||
|
/// </summary>
|
||
|
public string Title { get; set; }
|
||
|
|
||
|
public string Logo { get; set; }
|
||
|
|
||
|
/// <summary>
|
||
|
/// 京东Sku状态【1:上架 2:下架 4:删除】
|
||
|
/// </summary>
|
||
|
public int State { get; set; }
|
||
|
|
||
|
public DateTime? CreateTime { get; set; }
|
||
|
|
||
|
public long PurchaseSchemeId { get; set; }
|
||
|
|
||
|
public string PurchaserId { get; set; }
|
||
|
|
||
|
public string PurchaserName { get; set; }
|
||
|
|
||
|
public Platform? PurchasePlatform { get; set; }
|
||
|
|
||
|
public int Quantity { get => quantity; set { if (SetProperty(ref quantity, value)) OnQuantityChanged(); } }
|
||
|
|
||
|
public IList<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; }
|
||
|
|
||
|
public bool IsSelected
|
||
|
{
|
||
|
get => isSelected; set { if (SetProperty(ref isSelected, value)) OnSelectChanged(); }
|
||
|
}
|
||
|
|
||
|
public ProductSkuWithScheme()
|
||
|
{
|
||
|
PurchaseSchemeProductSkuList = new ObservableCollection<PurchaseSchemeProductSku>();
|
||
|
}
|
||
|
|
||
|
private void OnSelectChanged()
|
||
|
{
|
||
|
if (IsSelected && Quantity <= 0)
|
||
|
Quantity = 1;
|
||
|
else if (!IsSelected)
|
||
|
Quantity = 0;
|
||
|
}
|
||
|
|
||
|
private void OnQuantityChanged()
|
||
|
{
|
||
|
IsSelected = Quantity > 0;
|
||
|
}
|
||
|
}
|
||
|
}
|