Пример #1
0
        public ActionResult CashDepositRule()
        {
            var data       = _iCashDepositsService.GetCategoryCashDeposits();
            var categories = CategoryApplication.GetCategories();

            ViewBag.Categories = categories;

            #region 老套餐可能漏掉了一级分类保证金,这里同步下
            var cIds = categories.Where(t => t.ParentCategoryId == 0).Select(t => t.Id);
            if (cIds != null && cIds.Count() > 0)
            {
                var addIds = cIds.Except(data.Select(a => a.CategoryId));
                if (addIds != null && addIds.Count() > 0)
                {
                    foreach (var value in addIds)
                    {
                        CategoryCashDepositInfo addm = new CategoryCashDepositInfo();
                        addm.CategoryId = value;
                        CashDepositsApplication.AddCategoryCashDeposits(addm);
                    }
                    Log.Error("保证金少了一级分类Id:" + string.Join(",", addIds));
                    data = _iCashDepositsService.GetCategoryCashDeposits();//说明之前漏掉了重新读取最新的
                }
            }
            #endregion

            ViewBag.Categories = categories;
            return(View(data));
        }
Пример #2
0
        public JsonResult GetProductList(string skey, int rows, int page, long categoryId = 0)
        {
            //查询条件
            DistributionProductQuery query = new DistributionProductQuery();

            query.ProductName = skey;
            query.PageSize    = rows;
            query.PageNo      = page;
            query.Status      = DistributionProductStatus.Normal;
            query.ShopId      = curshopid;
            if (categoryId != 0)
            {
                query.CategoryId = categoryId;
            }
            query.isShopCategory = true;

            var data     = DistributionApplication.GetProducts(query);
            var datalist = new List <DistributionProductListModel>();

            if (data.Models != null)
            {
                var products   = ProductManagerApplication.GetProductsByIds(data.Models.Select(p => p.ProductId).ToList());
                var categories = CategoryApplication.GetCategories();
                foreach (var item in data.Models)
                {
                    var product   = products.FirstOrDefault(p => p.Id == item.ProductId);
                    var categorie = categories.FirstOrDefault(p => p.Id == product.Id);
                    datalist.Add(new DistributionProductListModel
                    {
                        BrokerageId        = item.Id,
                        ProductId          = item.ProductId,
                        ProductName        = product.ProductName,
                        CategoryId         = product.CategoryId,
                        CategoryName       = GetProductShopCategorieName(product.Id),
                        ShopId             = item.ShopId,
                        BrokerageRate1     = item.BrokerageRate1,
                        BrokerageRate2     = item.BrokerageRate2,
                        BrokerageRate3     = item.BrokerageRate3,
                        MaxBrokerage       = item.MaxBrokerage,
                        MaxSalePrice       = item.MaxSalePrice,
                        MinSalePrice       = item.MinSalePrice,
                        NoSettlementAmount = item.NoSettlementAmount,
                        ProductStatus      = item.ProductStatus,
                        SaleAmount         = item.SaleAmount,
                        SaleCount          = item.SaleCount,
                        SettlementAmount   = item.SettlementAmount,
                        ShopName           = item.ShopName
                    });
                }
            }
            var result = new { rows = datalist, total = data.Total };

            return(Json(result));
        }
Пример #3
0
        public ActionResult ApplyDetail(long id)
        {
            var model      = _iShopService.GetBusinessCategoriesApplyInfo(id);
            var details    = _iShopService.GetBusinessCategoriesApplyDetails(id);
            var categories = CategoryApplication.GetCategories();

            foreach (var item in details)
            {
                var path = CategoryApplication.GetCategoryPath(categories, item.CategoryId);
                item.CatePath = string.Join(">", path.Select(p => p.Name));
            }
            ViewBag.Details = details;
            return(View(model));
        }
Пример #4
0
        public ActionResult Index(string keywords = "", long categoryId = 0, long brandId = 0, int orderBy = 0, int pageNo = 1, int pageSize = 40)
        {
            var query = new ShopQuery
            {
                ShopName   = keywords,
                CategoryId = categoryId,
                BrandId    = brandId,
                PageNo     = pageNo,
                PageSize   = pageSize,
                Status     = Entities.ShopInfo.ShopAuditStatus.Open
            };

            if (orderBy == 1)
            {
                query.Sort = "OrderCount";
            }
            var result = new ShopSearchViewModel
            {
                Keywords         = keywords,
                CategoryId       = categoryId,
                BrandId          = brandId,
                Shops            = new List <Shop>(),
                OrderBy          = orderBy,
                IsSaleCountOnOff = SiteSettingApplication.SiteSettings.ProductSaleCountOnOff == 1
            };

            var shopData = _iShopService.GetShops(query);
            var shops    = shopData.Models;

            if (shopData.Total == 0)
            {
                return(View(result));
            }

            result.Pager = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = shopData.Total
            };
            result.Total = shopData.Total;


            var statisticList = ShopApplication.GetStatisticOrderComment(shops.Select(p => p.Id).ToList());

            var productQuery = new ProductQuery
            {
                PageNo   = 1,
                PageSize = 4,
                OnSale   = true,
                IsAsc    = false,
                Sort     = "displaysale",
            };

            foreach (var item in shops)
            {
                var shop = new Shop();
                shop.Id       = item.Id;
                shop.ShopName = item.ShopName;
                //销量
                shop.SaleCount = (int)ShopApplication.GetShopDisplaySales(item.Id);
                var statistic = statisticList.FirstOrDefault(p => p.ShopId == item.Id);
                //宝贝与描述
                shop.ProductAndDescription = string.Format("{00:F}", statistic.ProductAndDescription);
                //卖家服务态度
                shop.SellerServiceAttitude = string.Format("{00:F}", statistic.SellerServiceAttitude);
                //卖家发货速度
                shop.SellerDeliverySpeed = string.Format("{00:F}", statistic.SellerDeliverySpeed);

                //查询商品
                productQuery.ShopId = item.Id;
                var products = ProductManagerApplication.GetProducts(productQuery);
                shop.ProductCount = products.Total;
                shop.Products     = products.Models.Select(p => new Product {
                    Id         = p.Id,
                    Image      = MallIO.GetProductSizeImage(p.ImagePath, 1, (int)ImageSize.Size_150),
                    Price      = p.MinSalePrice,
                    CategoryId = p.CategoryId,
                }).ToList();
                shop.Logo = item.Logo;
                result.Shops.Add(shop);
            }

            //经营品牌
            var shopBrands = ShopApplication.GetShopBrands(shops.Select(p => p.Id).ToList());

            result.Brands = shopBrands.GroupBy(p => p.BrandId).ToDictionary(k => k.Key, v => v.FirstOrDefault().BrandName);

            //经营类型
            var CategoryIds = result.Shops.SelectMany(s => s.Products.Select(p => p.CategoryId));

            result.Categorys = CategoryApplication.GetCategories()
                               .Where(p => CategoryIds.Contains(p.Id))
                               .ToDictionary(k => k.Id, v => v.Name);

            return(View(result));
        }
Пример #5
0
        public JsonResult List(long?categoryId, string brandName, string productCode, int?auditStatus, string ids, int page, int rows, string keyWords, string shopName, int?saleStatus, bool?isAsc, string sort = "", sbyte?productType = null)
        {
            var query = new ProductQuery()
            {
                PageSize    = rows,
                PageNo      = page,
                BrandName   = brandName,
                KeyWords    = keyWords,
                CategoryId  = categoryId,
                Ids         = string.IsNullOrWhiteSpace(ids) ? null : ids.Split(',').Select(item => long.Parse(item)),
                ShopName    = shopName,
                ProductCode = productCode,
                IsAsc       = isAsc.HasValue ? isAsc.Value : false,
                Sort        = sort
            };

            if (productType.HasValue && productType.Value > -1)
            {
                query.ProductType = productType.Value;
            }
            if (isAsc.HasValue && string.IsNullOrEmpty(query.Sort)) //如果按序号排序不为null
            {
                query.OrderKey  = 5;                                //4商家,5平台
                query.OrderType = isAsc.Value;
            }
            if (auditStatus.HasValue)
            {
                query.AuditStatus = new ProductInfo.ProductAuditStatus[] { (ProductInfo.ProductAuditStatus)auditStatus };
                if (auditStatus == (int)ProductInfo.ProductAuditStatus.WaitForAuditing)
                {
                    query.SaleStatus = ProductInfo.ProductSaleStatus.OnSale;
                }
            }
            if (saleStatus.HasValue)
            {
                query.SaleStatus = (ProductInfo.ProductSaleStatus)saleStatus;
            }

            var products = ProductManagerApplication.GetProducts(query);

            var brands     = BrandApplication.GetBrandsByIds(products.Models.Select(p => p.BrandId).ToList());
            var categories = CategoryApplication.GetCategories();
            var shops      = ShopApplication.GetShops(products.Models.Select(p => p.ShopId).ToList());

            var list = products.Models.Select(item =>
            {
                var description = ProductManagerApplication.GetProductDescription(item.Id);
                return(new ProductModel()
                {
                    //TODO:FG 循环内查询调用提取
                    name = item.ProductName,
                    brandName = brands.FirstOrDefault(p => p.Id == item.BrandId)?.Name ?? string.Empty,
                    categoryName = categories.FirstOrDefault(p => p.Id == item.CategoryId)?.Name ?? string.Empty,
                    id = item.Id,
                    imgUrl = item.GetImage(ImageSize.Size_50),
                    price = item.MinSalePrice,
                    state = item.ShowProductState,
                    auditStatus = (int)item.AuditStatus,
                    url = "",
                    auditReason = description?.AuditReason ?? string.Empty,
                    shopName = shops.FirstOrDefault(p => p.Id == item.ShopId)?.ShopName ?? string.Empty,
                    saleStatus = (int)item.SaleStatus,
                    productCode = item.ProductCode,
                    saleCounts = item.SaleCounts,
                    AddedDate = item.AddedDate.ToString("yyyy-MM-dd HH:mm"),
                    DisplaySequence = item.DisplaySequence,
                    VirtualSaleCounts = (int)item.VirtualSaleCounts,
                    ProductType = item.ProductType
                });
            });

            return(Json(new DataGridModel <ProductModel>()
            {
                rows = list, total = products.Total
            }));
        }