Exemplo n.º 1
0
 public MemberController(
     IOrderService iOrderService,
     IMemberService iMemberService,
     IMemberCapitalService iMemberCapitalService,
     ICouponService iCouponService,
     IShopBonusService iShopBonusService,
     IVShopService iVShopService,
     IProductService iProductService,
     IShippingAddressService iShippingAddressService,
     IMessageService iMessageService,
     IMemberSignInService iMemberSignInService,
     IRefundService iRefundService,
     ICommentService iCommentService,
     IShopBranchService iShopBranchService,
     IShopService iShopService
     )
 {
     _iOrderService           = iOrderService;
     _iMemberService          = iMemberService;
     _iMemberCapitalService   = iMemberCapitalService;
     _iCouponService          = iCouponService;
     _iShopBonusService       = iShopBonusService;
     _iVShopService           = iVShopService;
     _iProductService         = iProductService;
     _iShippingAddressService = iShippingAddressService;
     _iMessageService         = iMessageService;
     _iMemberSignInService    = iMemberSignInService;
     _iRefundService          = iRefundService;
     _iCommentService         = iCommentService;
     _iShopBranchService      = iShopBranchService;
     _iShopService            = iShopService;
 }
Exemplo n.º 2
0
 public CartController(IProductService iProductService, IShopService iShopService, IVShopService iVShopService, IShopBranchService iShopBranchService)
 {
     _iProductService    = iProductService;
     _iShopService       = iShopService;
     _iVShopService      = iVShopService;
     _iShopBranchService = iShopBranchService;
 }
Exemplo n.º 3
0
 public BranchCartController()
 {
     _iShopBranchService = new ShopBranchService();
     _iCartService       = new CartService();
     _iProductService    = new ProductService();
     _iBranchCartService = new BranchCartService();
     _iShopService       = ServiceProvider.Instance <IShopService> .Create;
     _iVShopService      = new VShopService();
 }
Exemplo n.º 4
0
 public BranchCartController()
 {
     this._iShopBranchService = (IShopBranchService) new ShopBranchService();
     this._iCartService       = (ICartService) new CartService();
     this._iProductService    = (IProductService) new ProductService();
     this._iBranchCartService = (IBranchCartService) new BranchCartService();
     this._iShopService       = (IShopService) new ShopService();
     this._iVShopService      = (IVShopService) new VShopService();
 }
Exemplo n.º 5
0
 public BranchCartController()
 {
     _iShopBranchService = new ShopBranchService();
     _iCartService       = new CartService();
     _iProductService    = new ProductService();
     _iBranchCartService = new BranchCartService();
     _iShopService       = new ShopService();
     _iVShopService      = new VShopService();
 }
Exemplo n.º 6
0
        private List <CartProductModel> PackageCartProducts(Mall.Entities.ShoppingCartInfo cart, decimal prodPrice, decimal discount, IProductService productService, IShopService shopService, IShopBranchService shopBranchService, IVShopService vshopService, ITypeService typeservice, bool isBranch = false)
        {
            List <CartProductModel> products = new List <CartProductModel>();
            var limitProducts = LimitTimeApplication.GetPriceByProducrIds(cart.Items.Select(e => e.ProductId).ToList());//限时购价格
            var groupCart     = cart.Items.Where(item => item.ShopBranchId == 0).Select(c =>
            {
                var cItem   = new Mall.Entities.ShoppingCartItem();
                var skuInfo = productService.GetSku(c.SkuId);
                if (skuInfo != null)
                {
                    cItem = c;
                }
                return(cItem);
            }).GroupBy(i => i.ProductId).ToList();

            foreach (var item in cart.Items)
            {
                var                        product       = ProductManagerApplication.GetProduct(item.ProductId);
                var                        shop          = shopService.GetShop(product.ShopId);
                DTO.ShopBranch             shopbranch    = null;
                Entities.ShopBranchSkuInfo shopbranchsku = null;
                if (item.ShopBranchId > 0)
                {
                    shopbranch    = ShopBranchApplication.GetShopBranchById(item.ShopBranchId);
                    shopbranchsku = shopBranchService.GetSkusByIds(item.ShopBranchId, new List <string> {
                        item.SkuId
                    }).FirstOrDefault();
                }

                if (null != shop)
                {
                    var vshop = vshopService.GetVShopByShopId(shop.Id);
                    var sku   = ProductManagerApplication.GetSKU(item.SkuId);
                    if (sku == null)
                    {
                        continue;
                    }
                    //处理限时购、会员折扣价格
                    var prod = limitProducts.FirstOrDefault(e => e.ProductId == item.ProductId);
                    prodPrice = sku.SalePrice;
                    if (prod != null && !isBranch)
                    {
                        prodPrice = prod.MinPrice;
                    }
                    else
                    {
                        if (shop.IsSelf)
                        {//官方自营店才计算会员折扣
                            prodPrice = sku.SalePrice * discount;
                        }
                    }
                    #region 阶梯价--张宇枫
                    //阶梯价
                    if (product.IsOpenLadder)
                    {
                        var quantity = groupCart.Where(i => i.Key == item.ProductId).ToList().Sum(cartitem => cartitem.Sum(i => i.Quantity));
                        prodPrice = ProductManagerApplication.GetProductLadderPrice(item.ProductId, quantity);
                        if (shop.IsSelf)
                        {
                            prodPrice = prodPrice * discount;
                        }
                    }
                    #endregion
                    Entities.TypeInfo typeInfo     = typeservice.GetType(product.TypeId);
                    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;
                    if (product != null)
                    {
                        colorAlias   = !string.IsNullOrWhiteSpace(product.ColorAlias) ? product.ColorAlias : colorAlias;
                        sizeAlias    = !string.IsNullOrWhiteSpace(product.SizeAlias) ? product.SizeAlias : sizeAlias;
                        versionAlias = !string.IsNullOrWhiteSpace(product.VersionAlias) ? product.VersionAlias : versionAlias;
                    }
                    if (sku != null)
                    {
                        #region 正在参加限时抢购商品在购物车失效 TDO:ZYF
                        var isLimit = false;
                        //门店商品,在参加限时购,也可以正常购买
                        var limit = LimitTimeApplication.GetLimitTimeMarketItemByProductId(item.ProductId);
                        if (limit != null && !isBranch)
                        {
                            isLimit = limit.Status == Entities.FlashSaleInfo.FlashSaleStatus.Ongoing;
                        }
                        #endregion
                        var _tmp = new CartProductModel
                        {
                            CartItemId     = item.Id.ToString(),
                            SkuId          = item.SkuId,
                            Id             = product.Id.ToString(),
                            ImgUrl         = Core.MallIO.GetRomoteProductSizeImage(product.RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_150),
                            Name           = product.ProductName,
                            Price          = prodPrice.ToString("F2"),
                            Count          = item.Quantity.ToString(),
                            ShopId         = shop.Id.ToString(),
                            Size           = sku.Size,
                            Color          = sku.Color,
                            Version        = sku.Version,
                            VShopId        = vshop == null ? "0" : vshop.Id.ToString(),
                            ShopName       = shop.ShopName,
                            ShopLogo       = vshop == null ? "" : Core.MallIO.GetRomoteImagePath(vshop.StrLogo),
                            Url            = Core.MallIO.GetRomoteImagePath("/m-IOS/product/detail/") + item.ProductId,
                            ProductStatus  = isLimit ? 0 : (sku.Stock <= 0 ? ProductInfo.ProductSaleStatus.InStock.GetHashCode() : product.SaleStatus.GetHashCode()),
                            Status         = isLimit ? 1 : ProductManagerApplication.GetProductShowStatus(product, sku, shopbranch == null ? 1 : item.Quantity, shopbranch, shopbranchsku),// 0:正常;1:已失效;2:库存不足;3:已下架;
                            ColorAlias     = colorAlias,
                            SizeAlias      = sizeAlias,
                            VersionAlias   = versionAlias,
                            AddTime        = item.AddTime,
                            ShopBranchId   = item.ShopBranchId,
                            ShopBranchName = null == shopbranch ? "" : shopbranch.ShopBranchName,
                            ShopBranchLogo = null == shopbranch ? "" : Core.MallIO.GetRomoteImagePath(shopbranch.ShopImages)
                        };
                        products.Add(_tmp);
                    }
                }
            }
            return(products);
        }
Exemplo n.º 7
0
 public BranchCartHelper()
 {
     this._iBranchCartService = ServiceHelper.Create <IBranchCartService>();
     this._iProductService    = ServiceHelper.Create <IProductService>();
     this._iShopBranchService = ServiceHelper.Create <IShopBranchService>();
 }
Exemplo n.º 8
0
 public BranchCartHelper(IBranchCartService iBranchCartService, IProductService iProductService, IShopBranchService iShopBranchService)
 {
     this._iBranchCartService = iBranchCartService;
     this._iProductService    = iProductService;
     this._iShopBranchService = iShopBranchService;
 }