public object GetShopBranchHome() { CheckUserLogin(); DateTime nowDt = DateTime.Now; //三个月内预约单 OrderQuery query = new OrderQuery() { ShopBranchId = CurrentShopBranch.Id, StartDate = nowDt.Date.AddDays(-nowDt.Day).AddMonths(-2), EndDate = nowDt }; var orders = OrderApplication.GetOrdersNoPage(query); var threeMonthAmounht = orders.Sum(e => e.ActualPayAmount); //从三个月的数据中统计本周的 DateTime weekStartDt = nowDt.Date.AddDays(-(int)nowDt.DayOfWeek); var weekAmount = orders.Where(e => e.OrderDate >= weekStartDt).Sum(e => e.ActualPayAmount); //从三个月的数据中统计当天的 var todayAmount = orders.Where(e => e.OrderDate.Date == nowDt.Date).Sum(e => e.ActualPayAmount); //待自提预约单数 query = new OrderQuery() { ShopBranchId = CurrentShopBranch.Id, Status = OrderInfo.OrderOperateStatus.WaitSelfPickUp }; var pickUpOrders = OrderApplication.GetOrdersNoPage(query); var pickUpOrderCount = pickUpOrders.Count; //近三天发布诊疗项目数 var products = ShopBranchApplication.GetShopBranchProductCount(CurrentShopBranch.Id, nowDt.Date.AddDays(-2), nowDt.Date); var productCount = products.Select(e => e.ProductId).Distinct().Count(); var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShopByShopId(CurrentShopBranch.ShopId); var logo = "/Images/branchapp.jpg"; if (vshop != null && vshop.State == VShopInfo.VshopStates.Normal && !string.IsNullOrEmpty(vshop.WXLogo)) { logo = vshop.WXLogo; } return(Json(new { success = true, data = new { shopName = CurrentShopBranch.ShopBranchName, todayAmount = todayAmount, weekAmount = weekAmount, threeMonthAmounht = threeMonthAmounht, createProductCount = productCount, pickUpOrderCount = pickUpOrderCount, logo = logo, shopBranchId = CurrentShopBranch.Id } })); }