Browse Source

拳探平台的采购方案只允许选择一个采购Sku

AddValidOverTime
shanji 2 years ago
parent
commit
bc7c201223
  1. 74
      BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs

74
BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs

@ -195,69 +195,11 @@ namespace BBWY.Client.ViewModels
} }
} }
//private IList<PurchaseSchemeProductSku> LoadPurchaseProductCore(string purchseProductId,
// out string errorMsg,
// out string purchaserId,
// out string purchaserName,
// out string purchaserLocation,
// Func<string, string> checkPurchaserFunc)
//{
// errorMsg = string.Empty;
// purchaserId = string.Empty;
// purchaserName = string.Empty;
// purchaserLocation = string.Empty;
// //1688商品详情接口
// var response = oneBoundAPIService.GetProductInfo("1688", purchseProductId);
// if (!response.Success)
// {
// //记录日志
// errorMsg = response.Msg;
// return null;
// }
// var jobject = response.Data;
// purchaserId = jobject["item"]["seller_info"].Value<string>("user_num_id");
// purchaserName = jobject["item"]["seller_info"].Value<string>("title");
// if (string.IsNullOrEmpty(purchaserName))
// purchaserName = jobject["item"]["seller_info"].Value<string>("shop_name");
// purchaserLocation = jobject["item"].Value<string>("location");
// if (checkPurchaserFunc != null)
// {
// errorMsg = checkPurchaserFunc(purchaserId);
// if (!string.IsNullOrEmpty(errorMsg))
// return null;
// }
// //else if (PurchaserId != shopId)
// //{
// // errorMsg = "同一条采购方案内的商品所属店铺必须相同";
// // return null;
// //}
// var skuJArray = (JArray)jobject["item"]["skus"]["sku"];
// if (skuJArray.Count == 0)
// {
// errorMsg = $"商品{purchseProductId}缺少sku信息";
// return null;
// }
// return skuJArray.Select(j => new PurchaseSchemeProductSku()
// {
// //ProductId = Product.Id,
// //SkuId = purchaseSchemeProduct.SkuId,
// PurchaseProductId = purchseProductId,
// Price = j.Value<decimal>("price"),
// PurchaseSkuId = j.Value<string>("sku_id"),
// PurchaseSkuSpecId = j.Value<string>("spec_id"),
// Title = j.Value<string>("properties_name"),
// Logo = GetSkuLogo(j, (JArray)jobject["item"]["prop_imgs"]["prop_img"])
// }).ToList();
//}
private void AddPurchaseProduct(ProductSku productSku) private void AddPurchaseProduct(ProductSku productSku)
{ {
if (productSku.PurchaseSchemeList.Count > 4) if (productSku.PurchaseSchemeList.Count > 4)
{ {
MessageBox.Show("该sku的采购方案已达上限(5)"); MessageBox.Show("该sku的采购方案已达上限(5)", "提示");
return; return;
} }
@ -272,7 +214,7 @@ namespace BBWY.Client.ViewModels
} }
else if (productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Count >= 4) else if (productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Count >= 4)
{ {
MessageBox.Show("该采购方案的商品数量已达上限(5)"); MessageBox.Show("该采购方案的商品数量已达上限(5)", "提示");
return; return;
} }
@ -358,6 +300,16 @@ namespace BBWY.Client.ViewModels
MessageBox.Show("至少选中一个采购Sku"); MessageBox.Show("至少选中一个采购Sku");
return; return;
} }
var productSku = ProductSkuList.FirstOrDefault(sku => sku.Id == purchaseSchemeProduct.SkuId);
if (productSku.SelectedPurchaseScheme.PurchasePlatform == Platform.)
{
if (purchaseSchemeProduct.SkuList.Count(s => s.IsSelected) > 1)
{
MessageBox.Show("拳探平台的采购方案只允许选择一个采购Sku", "提示");
return;
}
}
purchaseSchemeProduct.PurchaseSchemeProductSkuList.Clear(); purchaseSchemeProduct.PurchaseSchemeProductSkuList.Clear();
purchaseSchemeProduct.SelectedSkuIdList.Clear(); purchaseSchemeProduct.SelectedSkuIdList.Clear();
foreach (var sku in purchaseSchemeProduct.SkuList) foreach (var sku in purchaseSchemeProduct.SkuList)
@ -370,7 +322,7 @@ namespace BBWY.Client.ViewModels
} }
purchaseSchemeProduct.IsEditing = false; purchaseSchemeProduct.IsEditing = false;
var productSku = ProductSkuList.FirstOrDefault(sku => sku.Id == purchaseSchemeProduct.SkuId);
productSku.SelectedPurchaseScheme.PurchaserId = PurchaserId; productSku.SelectedPurchaseScheme.PurchaserId = PurchaserId;
productSku.SelectedPurchaseScheme.PurchaserName = PurchaserName; productSku.SelectedPurchaseScheme.PurchaserName = PurchaserName;
productSku.SelectedPurchaseScheme.PurchaserLocation = PurchaserLocation; productSku.SelectedPurchaseScheme.PurchaserLocation = PurchaserLocation;

Loading…
Cancel
Save