public ActionResult Header()
        {
            ViewBag.Now = DateTime.Now;
            bool isLogin = CurrentUser != null;
            var  model   = new ProductPartialHeaderModel();

            model.PlatformCustomerServices = CustomerServiceApplication.GetPlatformCustomerService(true, false);
            model.isLogin = isLogin ? "true" : "false";
            //用户积分
            model.MemberIntegral = isLogin ? _iMemberIntegralService.GetMemberIntegral(CurrentUser.Id).AvailableIntegrals : 0;

            //关注诊疗项目
            //var concern = isLogin ? _iProductService.GetUserAllConcern(CurrentUser.Id) : new List<FavoriteInfo>();
            //model.Concern = concern.Take(10).ToList();

            List <IBaseCoupon> baseCoupons = new List <IBaseCoupon>();
            //优惠卷
            var coupons = isLogin ? _iCouponService.GetAllUserCoupon(CurrentUser.Id).ToList() : new List <UserCouponInfo>();

            coupons = coupons == null ? new List <UserCouponInfo>() : coupons;
            baseCoupons.AddRange(coupons);

            //红包
            var shopBonus = isLogin ? _iShopBonusService.GetCanUseDetailByUserId(CurrentUser.Id) : new List <ShopBonusReceiveInfo>();

            shopBonus = shopBonus == null ? new List <ShopBonusReceiveInfo>() : shopBonus;
            baseCoupons.AddRange(shopBonus);
            model.BaseCoupon = baseCoupons;

            //广告
            var imageAds = _iSlideAdsService.GetImageAds(0).Where(p => p.TypeId == Himall.CommonModel.ImageAdsType.HeadRightAds).ToList();

            if (imageAds.Count > 0)
            {
                ViewBag.HeadAds = imageAds;
            }
            else
            {
                ViewBag.HeadAds = _iSlideAdsService.GetImageAds(0).Take(1).ToList();
            }
            //浏览的诊疗项目
            //var browsingPro = isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List<ProductBrowsedHistoryModel>();
            //model.BrowsingProducts = browsingPro;

            InitHeaderData();

            return(PartialView("~/Areas/Web/Views/Shared/Header.cshtml", model));
        }
        /// <summary>
        /// 侧边我的资产
        /// </summary>
        /// <returns></returns>
        public ActionResult MyAsset()
        {
            MyAssetViewModel result = new Models.MyAssetViewModel();

            result.MyCouponCount = 0;
            result.isLogin       = CurrentUser != null;
            ViewBag.isLogin      = result.isLogin ? "true" : "false";
            //用户积分
            result.MyMemberIntegral = result.isLogin ? _iMemberIntegralService.GetMemberIntegral(CurrentUser.Id).AvailableIntegrals : 0;
            //关注商品
            var concern = result.isLogin ? _iProductService.GetUserAllConcern(CurrentUser.Id) : new List <FavoriteInfo>();

            result.MyConcernsProducts = concern.Take(10).ToList();
            //优惠卷
            var coupons = result.isLogin ?_iCouponService.GetAllUserCoupon(CurrentUser.Id).ToList() : new List <UserCouponInfo>();

            coupons               = coupons == null ? new List <UserCouponInfo>() : coupons;
            result.MyCoupons      = coupons;
            result.MyCouponCount += result.MyCoupons.Count();

            //红包
            var shopBonus = result.isLogin ? _iShopBonusService.GetCanUseDetailByUserId(CurrentUser.Id) : new List <ShopBonusReceiveInfo>();

            shopBonus             = shopBonus == null ? new List <ShopBonusReceiveInfo>() : shopBonus;
            result.MyShopBonus    = shopBonus;
            result.MyCouponCount += result.MyShopBonus.Count();

            //浏览的商品
            var browsingPro = result.isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List <ProductBrowsedHistoryModel>();

            result.MyBrowsingProducts = browsingPro;
            return(View(result));
        }
Example #3
0
        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 static List <ShopBonusReceiveInfo> GetCanUseDetailByUserId(long userid)
 {
     return(_iShopBonusService.GetCanUseDetailByUserId(userid));
 }