Himall商城- web私有方法

目录

[1 Himall商城- web私有方法](#1 Himall商城- web私有方法)

[1.1 /// 订单提交页面,需要展示的数据](#1.1 /// 订单提交页面,需要展示的数据)

[1.1.1 //默认SKU销售价](#1.1.1 //默认SKU销售价)

[1.1.2 //商品批量销售价](#1.1.2 //商品批量销售价)

  1. Himall商城- web私有方法

#region web私有方法

/// <summary>

    1. /// 订单提交页面,需要展示的数据

/// </summary>

static List<CartItemModel> GenerateCartItem(IEnumerable<string> skuIds, IEnumerable<int> counts)

{

int i = 0;

var products = skuIds.Select(item =>

{

var sku = _iProductService.GetSku(item);

var count = counts.ElementAt(i++);

var product = _iProductService.GetProduct(sku.ProductInfo.Id);

var ltmbuy = _iLimitTimeBuyService.GetLimitTimeMarketItemByProductId(sku.ProductInfo.Id);

      1. //默认SKU销售价

var price = sku.SalePrice;

if (ltmbuy != null)

{

if (count > ltmbuy.LimitCountOfThePeople)

throw new HimallException("超过最大限购数量:" + ltmbuy.LimitCountOfThePeople.ToString() + "");

}

else

{

#region 阶梯价--张宇枫

if (product.IsOpenLadder)

{

      1. //商品批量销售价

price = ProductManagerApplication.GetProductLadderPrice(product.Id, count);

}

#endregion

}

if (sku.Stock < count)

{

//throw new HimallException("库存不足");

}

ProductTypeInfo typeInfo = ServiceProvider.Instance<ITypeService>.Create.GetTypeByProductId(sku.ProductInfo.Id);

string colorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias;

string sizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias;

string versionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias;

string skuDetails = "";

if (!string.IsNullOrWhiteSpace(sku.Size))

{

if (!string.IsNullOrWhiteSpace(skuDetails))

{

skuDetails += "、";

}

skuDetails += sku.Size;

}

if (!string.IsNullOrWhiteSpace(sku.Color))

{

if (!string.IsNullOrWhiteSpace(skuDetails))

{

skuDetails += "、";

}

skuDetails += sku.Color;

}

if (!string.IsNullOrWhiteSpace(sku.Version))

{

if (!string.IsNullOrWhiteSpace(skuDetails))

{

skuDetails += "、";

}

skuDetails += sku.Version;

}

return new CartItemModel()

{

skuId = item,

id = sku.ProductInfo.Id,

imgUrl = Core.HimallIO.GetRomoteProductSizeImage(sku.ProductInfo.RelativePath, 1, (int)(ImageSize.Size_100)),

name = sku.ProductInfo.ProductName,

shopId = sku.ProductInfo.ShopId,

price = ltmbuy == null ? price : (decimal)_iLimitTimeBuyService.GetDetail(item).Price,

count = count,

productCode = sku.ProductInfo.ProductCode,

unit = sku.ProductInfo.MeasureUnit,

size = sku.Size,

color = sku.Color,

version = sku.Version,

skuDetails = skuDetails,

IsSelf = sku.ProductInfo.Himall_Shops.IsSelf,

ColorAlias = colorAlias,

SizeAlias = sizeAlias,

VersionAlias = versionAlias,

IsLimit = ltmbuy != null,

FreightTemplateId = sku.ProductInfo.FreightTemplateId,

IsOpenLadder = sku.ProductInfo.IsOpenLadder

};

}).ToList();

return products;

}

/// <summary>

相关推荐
handsome_sai32 分钟前
【Java 线程池】记录
java
程序员码歌32 分钟前
短思考第261天,浪费时间的十个低效行为,看看你中了几个?
前端·ai编程
Swift社区1 小时前
React Navigation 生命周期完整心智模型
前端·react.js·前端框架
大学生资源网1 小时前
基于springboot的唐史文化管理系统的设计与实现源码(java毕业设计源码+文档)
java·spring boot·课程设计
若梦plus1 小时前
从微信公众号&小程序的SDK剖析JSBridge
前端
guslegend2 小时前
SpringSecurity源码剖析
java
用泥种荷花2 小时前
Python环境安装
前端
Light602 小时前
性能提升 60%:前端性能优化终极指南
前端·性能优化·图片压缩·渲染优化·按需拆包·边缘缓存·ai 自动化
Jimmy2 小时前
年终总结 - 2025 故事集
前端·后端·程序员
烛阴2 小时前
C# 正则表达式(2):Regex 基础语法与常用 API 全解析
前端·正则表达式·c#