public ActionResult Center() { MemberCenterModel model = new MemberCenterModel(); var orders = _iOrderService.GetTopOrders(int.MaxValue, CurrentUser.Id); var setting = _iDistributionService.GetDistributionSetting(); model.CanDistribution = false; if (setting != null && setting.Enable) { model.CanDistribution = true; } //待评价 //var queryModel = new OrderQuery() //{ // Status = Model.OrderInfo.OrderOperateStatus.Finish, // UserId = CurrentUser.Id, // PageSize = int.MaxValue, // PageNo = 1, // Commented = false //}; //ViewBag.WaitingForComments = _iOrderService.GetOrders<OrderInfo>(queryModel).Total; var member = _iMemberService.GetMember(CurrentUser.Id); model.Member = member; model.AllOrders = orders.Count(); model.WaitingForRecieve = orders.Count(item => item.UserId == CurrentUser.Id && (item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitReceiving || item.OrderStatus == OrderInfo.OrderOperateStatus.WaitSelfPickUp)); //获取待收货订单数 model.WaitingForPay = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitPay); //获取待支付订单数 var waitdelordnum = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitDelivery); //获取待发货订单数 var fgwaitdelordnum = _iOrderService.GetFightGroupOrderByUser(CurrentUser.Id); model.WaitingForDelivery = waitdelordnum - fgwaitdelordnum; model.WaitingForComments = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.Finish && item.OrderCommentInfo.Count == 0); //拼团 model.CanFightGroup = FightGroupApplication.IsOpenMarketService(); model.BulidFightGroupNumber = FightGroupApplication.CountJoiningOrder(CurrentUser.Id); RefundQuery query = new RefundQuery() { UserId = CurrentUser.Id, PageNo = 1, PageSize = int.MaxValue }; var refundPage = _iRefundService.GetOrderRefunds(query); DateTime endsrtime = DateTime.Now.Date; if (CurrentSiteSetting.SalesReturnTimeout > 0) { endsrtime = endsrtime.AddDays(-CurrentSiteSetting.SalesReturnTimeout).Date; } model.RefundOrders = refundPage.Models.Where(e => e.ManagerConfirmStatus == OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm || (e.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.UnAudit && e.OrderItemInfo.OrderInfo.FinishDate >= endsrtime)).Count(); var capital = _iMemberCapitalService.GetCapitalInfo(CurrentUser.Id); decimal cap; if (capital != null) { cap = capital.Balance.HasValue ? capital.Balance.Value : 0; } else { cap = 0; } model.Capital = cap; var CouponsCount = _iCouponService.GetAllUserCoupon(CurrentUser.Id).Count(); CouponsCount += _iShopBonusService.GetCanUseDetailByUserId(CurrentUser.Id).Count(); model.CouponsCount = CouponsCount; var userInte = MemberIntegralApplication.GetMemberIntegral(UserId); var userGrade = MemberGradeApplication.GetMemberGradeByUserIntegral(userInte.HistoryIntegrals); model.GradeName = userGrade.GradeName; model.MemberAvailableIntegrals = userInte.AvailableIntegrals; model.CollectionShop = _iVShopService.GetUserConcernVShops(CurrentUser.Id, 1, int.MaxValue).Count(); model.CanSignIn = _iMemberSignInService.CanSignInByToday(CurrentUser.Id); model.SignInIsEnable = _iMemberSignInService.GetConfig().IsEnable; model.userMemberInfo = CurrentUser; return(View(model)); }
public ActionResult Center() { var userId = CurrentUser.Id; MemberCenterModel model = new MemberCenterModel(); var statistic = StatisticApplication.GetMemberOrderStatistic(userId, true); var member = _iMemberService.GetMember(userId); model.Member = member; model.AllOrders = statistic.OrderCount; model.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(UserId); model.WaitingForPay = statistic.WaitingForPay; model.WaitingForDelivery = statistic.WaitingForDelivery; model.WaitingForComments = statistic.WaitingForComments; model.RefundOrders = statistic.RefundCount; model.FavoriteProductCount = FavoriteApplication.GetFavoriteCountByUser(userId); //拼团 model.CanFightGroup = FightGroupApplication.IsOpenMarketService(); model.BulidFightGroupNumber = FightGroupApplication.CountJoiningOrder(userId); model.Capital = MemberCapitalApplication.GetBalanceByUserId(userId); model.CouponsCount = MemberApplication.GetAvailableCouponCount(userId); var integral = MemberIntegralApplication.GetMemberIntegral(userId); model.GradeName = MemberGradeApplication.GetMemberGradeByUserIntegral(integral.HistoryIntegrals).GradeName; model.MemberAvailableIntegrals = MemberIntegralApplication.GetAvailableIntegral(userId); model.CollectionShop = ShopApplication.GetUserConcernShopsCount(userId); model.CanSignIn = _iMemberSignInService.CanSignInByToday(userId); model.SignInIsEnable = _iMemberSignInService.GetConfig().IsEnable; model.userMemberInfo = CurrentUser; model.IsOpenRechargePresent = SiteSettings.IsOpenRechargePresent; model.DistributionOpenMyShopShow = SiteSettings.DistributorRenameOpenMyShop; model.DistributionMyShopShow = SiteSettings.DistributorRenameMyShop; if (PlatformType == PlatformType.WeiXin) { //分销 model.IsShowDistributionOpenMyShop = SiteSettings.DistributionIsEnable; var duser = DistributionApplication.GetDistributor(CurrentUser.Id); if (duser != null && duser.DistributionStatus != (int)DistributorStatus.UnApply) { model.IsShowDistributionOpenMyShop = false; //拒绝的分销员显示“我要开店” if (duser.DistributionStatus == (int)DistributorStatus.Refused || duser.DistributionStatus == (int)DistributorStatus.UnAudit) { model.IsShowDistributionOpenMyShop = true && SiteSettings.DistributionIsEnable; } model.IsShowDistributionMyShop = true && SiteSettings.DistributionIsEnable; if (duser.DistributionStatus == (int)DistributorStatus.NotAvailable || duser.DistributionStatus == (int)DistributorStatus.Refused || duser.DistributionStatus == (int)DistributorStatus.UnAudit) { model.IsShowDistributionMyShop = false; } } } _iMemberService.AddIntegel(member); //给用户加积分//执行登录后初始化相关操作 return(View(model)); }