Esempio n. 1
0
        public ActionResult Console()
        {
            //新首页开始
            HomeModel model  = new HomeModel();
            var       shopId = CurrentSellerManager.ShopId;
            /*店铺信息*/
            var shop = ShopApplication.GetShop(shopId);

            if (shop != null)
            {
                model.SellerConsoleModel = StatisticApplication.GetSellerConsoleModel(shopId);
                /*公告*/
                model.Articles      = _iArticleService.GetTopNArticle <ArticleInfo>(6, 4);
                ViewBag.Logo        = SiteSettingApplication.SiteSettings.MemberLogo;
                model.ShopId        = shop.Id;
                model.ShopLogo      = shop.Logo;
                model.ShopName      = shop.ShopName;
                model.ShopEndDate   = shop.EndDate.HasValue ? shop.EndDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                model.ShopGradeName = model.SellerConsoleModel.ShopGrade;

                var shopStatisticOrderComments = _iShopService.GetShopStatisticOrderComments(CurrentSellerManager.ShopId);
                var productAndDescription      = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescription).FirstOrDefault();
                var sellerServiceAttitude      = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitude).FirstOrDefault();
                var sellerDeliverySpeed        = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeed).FirstOrDefault();

                var defaultValue = "5";
                //宝贝与描述
                model.ProductAndDescription = productAndDescription != null?string.Format("{0:F}", productAndDescription.CommentValue) : defaultValue;

                //卖家服务态度
                model.SellerServiceAttitude = sellerServiceAttitude != null?string.Format("{0:F}", sellerServiceAttitude.CommentValue) : defaultValue;

                //卖家发货速度
                model.SellerDeliverySpeed = sellerDeliverySpeed != null?string.Format("{0:F}", sellerDeliverySpeed.CommentValue) : defaultValue;

                //所有商品数
                model.ProductsNumberIng = model.SellerConsoleModel.ProductLimit.ToString();
                //发布商品数量
                model.ProductsNumber = model.SellerConsoleModel.ProductsCount.ToString();
                //使用空间
                model.UseSpace = model.SellerConsoleModel.ImageLimit.ToString();
                //正使用的空间
                model.UseSpaceing = model.SellerConsoleModel.ProductImages.ToString();
                //商品咨询
                model.OrderProductConsultation = model.SellerConsoleModel.ProductConsultations.ToString();
                //订单总数
                model.OrderCounts = model.SellerConsoleModel.OrderCounts.ToString();
                //待买家付款
                model.OrderWaitPay = model.SellerConsoleModel.WaitPayTrades.ToString();
                //待发货
                model.OrderWaitDelivery = model.SellerConsoleModel.WaitDeliveryTrades.ToString();
                //待回复评价
                model.OrderReplyComments = model.SellerConsoleModel.ProductComments.ToString();
                //待处理投诉
                model.OrderHandlingComplaints = model.SellerConsoleModel.Complaints.ToString();
                //待处理退款
                model.OrderWithRefund = model.SellerConsoleModel.RefundTrades.ToString();
                //待处理退货
                model.OrderWithRefundAndRGoods = model.SellerConsoleModel.RefundAndRGoodsTrades.ToString();
                //商品评价
                model.ProductsEvaluation = model.SellerConsoleModel.ProductsEvaluation.ToString();
                //授权品牌
                model.ProductsBrands = _iBrandService.GetShopBrandApplys(CurrentSellerManager.ShopId).Where(c => c.AuditStatus == 1).Count().ToString();
                //出售中
                model.ProductsOnSale = model.SellerConsoleModel.OnSaleProducts.ToString();
                //草稿箱
                model.ProductsInDraft = model.SellerConsoleModel.ProductsInDraft.ToString();
                //待审核
                model.ProductsWaitForAuditing = model.SellerConsoleModel.WaitForAuditingProducts.ToString();
                //审核未通过
                model.ProductsAuditFailed = model.SellerConsoleModel.AuditFailureProducts.ToString();
                //违规下架
                model.ProductsInfractionSaleOff = model.SellerConsoleModel.InfractionSaleOffProducts.ToString();
                //仓库中
                model.ProductsInStock = model.SellerConsoleModel.InStockProducts.ToString();
                //警戒库存数
                model.OverSafeStockProducts = ProductManagerApplication.GetOverSafeStockProducts(CurrentSellerManager.ShopId).ToString();
                DateTime startDate      = DateTime.Now.AddDays(-1).Date;
                DateTime endDate        = startDate.AddDays(1).AddMilliseconds(-1);
                var      statistic      = StatisticApplication.GetShopTradeStatistic(CurrentSellerManager.ShopId, null, startDate, endDate);
                var      lstEchartsData = new List <EchartsData>();
                if (statistic != null)
                {
                    ViewBag.VistiCounts   = statistic.VisitCounts;
                    ViewBag.OrderCounts   = statistic.OrderCount;
                    ViewBag.OrderPayCount = statistic.OrderPayCount;
                }
                else
                {
                    string zero = decimal.Zero.ToString();
                    ViewBag.VistiCounts   = zero;
                    ViewBag.OrderCounts   = zero;
                    ViewBag.OrderPayCount = zero;
                }
            }
            //新首页结束
            return(View(model));
        }