diff --git a/BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs b/BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs index 7e84d263..7f731960 100644 --- a/BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs +++ b/BBWY.Client/ViewModels/Ware/BindingPurchaseProductViewModel.cs @@ -195,69 +195,11 @@ namespace BBWY.Client.ViewModels } } - //private IList LoadPurchaseProductCore(string purchseProductId, - // out string errorMsg, - // out string purchaserId, - // out string purchaserName, - // out string purchaserLocation, - // Func 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("user_num_id"); - // purchaserName = jobject["item"]["seller_info"].Value("title"); - // if (string.IsNullOrEmpty(purchaserName)) - // purchaserName = jobject["item"]["seller_info"].Value("shop_name"); - // purchaserLocation = jobject["item"].Value("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("price"), - // PurchaseSkuId = j.Value("sku_id"), - // PurchaseSkuSpecId = j.Value("spec_id"), - // Title = j.Value("properties_name"), - // Logo = GetSkuLogo(j, (JArray)jobject["item"]["prop_imgs"]["prop_img"]) - // }).ToList(); - //} - private void AddPurchaseProduct(ProductSku productSku) { if (productSku.PurchaseSchemeList.Count > 4) { - MessageBox.Show("该sku的采购方案已达上限(5)"); + MessageBox.Show("该sku的采购方案已达上限(5)", "提示"); return; } @@ -272,7 +214,7 @@ namespace BBWY.Client.ViewModels } else if (productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Count >= 4) { - MessageBox.Show("该采购方案的商品数量已达上限(5)"); + MessageBox.Show("该采购方案的商品数量已达上限(5)", "提示"); return; } @@ -358,6 +300,16 @@ namespace BBWY.Client.ViewModels MessageBox.Show("至少选中一个采购Sku"); 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.SelectedSkuIdList.Clear(); foreach (var sku in purchaseSchemeProduct.SkuList) @@ -370,7 +322,7 @@ namespace BBWY.Client.ViewModels } purchaseSchemeProduct.IsEditing = false; - var productSku = ProductSkuList.FirstOrDefault(sku => sku.Id == purchaseSchemeProduct.SkuId); + productSku.SelectedPurchaseScheme.PurchaserId = PurchaserId; productSku.SelectedPurchaseScheme.PurchaserName = PurchaserName; productSku.SelectedPurchaseScheme.PurchaserLocation = PurchaserLocation;