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 ? MemberIntegralApplication.GetAvailableIntegral(CurrentUser.Id) : 0; //关注商品 result.MyConcernsProducts = result.isLogin ? _iProductService.GetUserAllConcern(CurrentUser.Id, 10) : new List <Entities.FavoriteInfo>(); //优惠卷 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(); //红包 result.MyShopBonus = ShopBonusApplication.GetShopBounsByUser(CurrentUser.Id); result.MyCouponCount += result.MyShopBonus.Count(); //浏览的商品 var browsingPro = result.isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List <ProductBrowsedHistoryModel>(); result.MyBrowsingProducts = browsingPro; ViewBag.Keyword = SiteSettings.Keyword; return(View(result)); }
public JsonResult PostCanUseShopCoupons(long id) { if (CurrentUser != null) { var allcoulist = _iCouponService.GetAllUserCoupon(CurrentUser.Id); var datalist = allcoulist.Where(d => d.ShopId == id); var data = datalist.Select(d => new ShopCouponsListModel { Id = d.CouponId, CreateTime = d.CreateTime, ShopId = d.ShopId, ShopName = d.ShopName, Price = d.Price, PerMax = d.PerMax, OrderAmount = d.OrderAmount, Num = d.Num, StartTime = d.StartTime, EndTime = d.EndTime, CouponName = d.CouponName }).ToList(); return(Json(data)); } else { List <ShopCouponsListModel> data = new List <ShopCouponsListModel>(); return(Json(data)); } }
/// <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)); }
public JsonResult PostCanUseShopCoupons(long id) { var shop = ShopApplication.GetShopBasicInfo(id); if (shop != null && (shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze || shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.HasExpired)) { return(Json(new List <ShopCouponsListModel>())); } if (CurrentUser != null) { var allcoulist = _iCouponService.GetAllUserCoupon(CurrentUser.Id); var datalist = allcoulist.Where(d => d.ShopId == id); var data = datalist.Select(d => new ShopCouponsListModel { Id = d.CouponId, CreateTime = d.CreateTime, ShopId = d.ShopId, ShopName = d.ShopName, Price = d.Price, PerMax = d.PerMax, OrderAmount = d.OrderAmount, Num = d.Num, StartTime = d.StartTime, EndTime = d.EndTime, CouponName = d.CouponName, UseArea = d.UseArea, Remark = d.Remark }).ToList(); return(Json(data)); } else { List <ShopCouponsListModel> data = new List <ShopCouponsListModel>(); return(Json(data)); } }
public static List <UserCouponInfo> GetAllUserCoupon(long userid) { return(_iCouponService.GetAllUserCoupon(userid)); }
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)); }
/// <summary> /// 页面缓存时间 /// </summary> // GET: Web/ProductPartial //[OutputCache(Duration = ConstValues.PAGE_CACHE_DURATION)] 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 ? MemberIntegralApplication.GetAvailableIntegral(CurrentUser.Id) : 0; //关注商品 var user = CurrentUser?.Id ?? 0; var baseCoupons = new List <DisplayCoupon>(); //优惠卷 var usercoupons = _iCouponService.GetAllUserCoupon(user);//优惠卷 var coupons = CouponApplication.GetCouponInfo(usercoupons.Select(p => p.CouponId)); var shops = ShopApplication.GetShops(coupons.Select(p => p.ShopId)); var shopBonus = ShopBonusApplication.GetShopBounsByUser(user);//红包 baseCoupons.AddRange(usercoupons.Select(item => { var coupon = coupons.FirstOrDefault(p => p.Id == item.CouponId); var shop = shops.FirstOrDefault(p => p.Id == coupon.ShopId); return(new DisplayCoupon { Type = CommonModel.CouponType.Coupon, Limit = coupon.OrderAmount, Price = item.Price, ShopId = shop.Id, ShopName = shop.ShopName, EndTime = coupon.EndTime, }); })); baseCoupons.AddRange(shopBonus.Select(p => new DisplayCoupon { Type = CommonModel.CouponType.ShopBonus, EndTime = p.Bonus.DateEnd, Limit = p.Bonus.UsrStatePrice, Price = p.Receive.Price, ShopId = p.Shop.Id, ShopName = p.Shop.ShopName, UseState = p.Bonus.UseState })); 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(); string html = System.IO.File.ReadAllText(this.Server.MapPath(_templateHeadHtmlFileFullName));//读取模板头部html静态文件内容 ViewBag.Html = html; return(PartialView("~/Areas/Web/Views/Shared/Header.cshtml", model)); }