Exemplo n.º 1
0
        /// <summary>
        /// 获取商品列表
        /// </summary>
        /// <param name="info"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        private static List <OrderProductItemModel> GetCartItemList(OrderInfo info, OrderItemGroup group)
        {
            List <OrderProductItemModel> list = new List <OrderProductItemModel>();
            ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle);

            group.ProductItemList.ForEach(item =>
            {
                OrderProductItemModel model = new OrderProductItemModel()
                {
                    ProductSysNo = item.ProductSysNo,
                    ProductID    = item.ProductID,
                    ProductName  = item["ProductTitle"] == null ? "" : item["ProductTitle"].ToString(),
                    SplitGroupPropertyDescList = item.SplitGroupPropertyDescList,
                    DefaultImage         = ProductFacade.BuildProductImage(imageSize, item.DefaultImage),
                    ConsumptionDate      = item.ConsumptionDate,
                    UnitQuantity         = item.UnitQuantity,
                    UnitMarketPrice      = item.UnitMarketPrice,
                    UnitCostPrice        = item.UnitCostPrice,
                    UnitSalePrice        = item.UnitSalePrice,
                    Weight               = item.Weight,
                    TotalInventory       = item.TotalInventory,
                    WarehouseNumber      = item.WarehouseNumber,
                    WarehouseName        = item.WarehouseName,
                    WarehouseCountryCode = item.WarehouseCountryCode,
                    MerchantSysNo        = item.MerchantSysNo,
                    UnitRewardedPoint    = item.UnitRewardedPoint,
                    TotalRewardedPoint   = item.TotalRewardedPoint,
                    SpecialActivityType  = item.SpecialActivityType,
                    SpecialActivitySysNo = item.SpecialActivitySysNo,
                    Quantity             = group.Quantity * item.UnitQuantity,
                    AttachmentList       = GetAttachment(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo),
                    GiftList             = GetGiftItem(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo, 2),
                    ProductChecked       = item.ProductChecked
                };
                decimal discountPrice = item["UnitDiscountAmt"] == null ? GetDiscountPrice(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo) : (decimal)item["UnitDiscountAmt"];//折扣金额
                model.UnitPrice       = item.UnitSalePrice - discountPrice;
                // model.UnitTaxFee = decimal.Round((decimal)item["TariffRate"] * (model.UnitPrice - (item["UnitCouponAmt"] == null ? 0m : (decimal)item["UnitCouponAmt"])), 2, MidpointRounding.AwayFromZero);//- (item["UnitDiscountAmt"] == null ? 0m : (decimal)item["UnitDiscountAmt"])折扣金额
                model.UnitTaxFee     = (item["UnitDiscountAmt"] == null ? 0m : (decimal)item["UnitDiscountAmt"]);//折扣金额
                model.TotalSalePrice = (item.UnitSalePrice - discountPrice + model.UnitTaxFee) * model.Quantity;
                //计算是否已加入收藏夹
                model.IsWished = false;
                Nesoft.ECWeb.UI.LoginUser currUser = Nesoft.ECWeb.UI.UserMgr.ReadUserInfo();
                if (currUser != null && currUser.UserSysNo > 0)
                {
                    model.IsWished = ProductFacade.IsProductWished(item.ProductSysNo, currUser.UserSysNo);
                }

                list.Add(model);
            });

            return(list);
        }
Exemplo n.º 2
0
        public override ExtensibleObject CloneObject()
        {
            OrderProductItemModel gi = new OrderProductItemModel()
            {
                ProductSysNo               = this.ProductSysNo,
                ConsumptionDate            = this.ConsumptionDate,
                ProductID                  = this.ProductID,
                ProductName                = this.ProductName,
                UnitQuantity               = this.UnitQuantity,
                UnitCostPrice              = this.UnitCostPrice,
                UnitSalePrice              = this.UnitSalePrice,
                DefaultImage               = this.DefaultImage,
                Weight                     = this.Weight,
                UnitMarketPrice            = this.UnitMarketPrice,
                MerchantSysNo              = this.MerchantSysNo,
                SplitGroupPropertyDescList = this.SplitGroupPropertyDescList == null ? null : this.SplitGroupPropertyDescList,
                TotalInventory             = this.TotalInventory,
                UnitTaxFee                 = this.UnitTaxFee,
                WarehouseCountryCode       = this.WarehouseCountryCode,
                WarehouseName              = this.WarehouseName,
                WarehouseNumber            = this.WarehouseNumber,
                UnitRewardedPoint          = this.UnitRewardedPoint,
                TotalSalePrice             = this.TotalSalePrice,
                TotalRewardedPoint         = this.TotalRewardedPoint,
                SpecialActivityType        = this.SpecialActivityType,
                SpecialActivitySysNo       = this.SpecialActivitySysNo,
                Quantity                   = this.Quantity,
                AttachmentList             = this.AttachmentList,
                GiftList                   = this.GiftList,
                IsWished                   = this.IsWished,
                UnitPrice                  = this.UnitPrice,
                ProductChecked             = this.ProductChecked
            };

            if (this.SplitGroupPropertyDescList != null)
            {
                gi.SplitGroupPropertyDescList = new List <KeyValuePair <string, string> >();
                this.SplitGroupPropertyDescList.ForEach(f => gi.SplitGroupPropertyDescList.Add(new KeyValuePair <string, string>(f.Key, f.Value)));
            }

            return(gi);
        }