/// <summary> /// 获取拼团项用于新增活动 /// </summary> /// <param name="productId">商品编号</param> /// <returns></returns> public static FightGroupGetSkuListModel GetNewActiveItems(long productId) { FightGroupGetSkuListModel result = new FightGroupGetSkuListModel(); var pro = GetService <IProductService>().GetProduct(productId); result.ProductImg = MallIO.GetProductSizeImage(pro.RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_150); result.skulist = new List <FightGroupActiveItemModel>(); var price = 0m; if (pro.IsOpenLadder) { var ladder = ProductManagerApplication.GetLadderPriceByProductIds(productId); if (ladder.Any()) { price = ladder.OrderBy(m => m.MinBath).FirstOrDefault().Price; } } var skus = ProductManagerApplication.GetSKUs(pro.Id); foreach (var item in skus) { FightGroupActiveItemModel data = new FightGroupActiveItemModel(); data.ProductId = productId; data.SkuId = item.Id; data.SkuName = item.Color + " " + item.Size + " " + item.Version; data.ProductPrice = price > 0 ? price : item.SalePrice; data.ProductStock = item.Stock; data.ActivePrice = data.ProductPrice; data.ActiveStock = 0; //活动库存置空 result.skulist.Add(data); } return(result); }
public ActionResult GetSkuList(long productId) { FightGroupGetSkuListModel result = new FightGroupGetSkuListModel(); result = FightGroupApplication.GetNewActiveItems(productId); return(Json(result)); }
/// <summary> /// 获取拼团项用于新增活动 /// </summary> /// <param name="productId">商品编号</param> /// <returns></returns> public static FightGroupGetSkuListModel GetNewActiveItems(long productId) { FightGroupGetSkuListModel result = new FightGroupGetSkuListModel(); var pro = _iProductService.GetProduct(productId); result.ProductImg = HimallIO.GetProductSizeImage(pro.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_150); result.skulist = new List <FightGroupActiveItemModel>(); foreach (var item in pro.SKUInfo) { FightGroupActiveItemModel _data = new FightGroupActiveItemModel(); _data.ProductId = productId; _data.SkuId = item.Id; _data.SkuName = item.Color + " " + item.Size + " " + item.Version; _data.ProductPrice = item.SalePrice; _data.ProductStock = item.Stock; _data.ActivePrice = _data.ProductPrice; _data.ActiveStock = 0; //活动库存置空 result.skulist.Add(_data); } return(result); }