/// <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 ActionResult Management() { var service = _iCouponService; var vshop = _iVShopService; var userCouponList = service.GetUserCouponList(CurrentUser.Id); var shopBonus = ShopBonusApplication.GetShopBounsByUser(CurrentUser.Id); var couponlist = userCouponList.Select(a => new UserCouponInfo { UserId = a.UserId, ShopId = a.ShopId, CouponId = a.CouponId, Price = a.Price, PerMax = a.PerMax, OrderAmount = a.OrderAmount, Num = a.Num, StartTime = a.StartTime, EndTime = a.EndTime, CreateTime = a.CreateTime, CouponName = a.CouponName, UseStatus = a.UseStatus, UseTime = a.UseTime, VShop = vshop.GetVShopByShopId(a.ShopId), Remark = a.Remark, UseArea = a.UseArea }); int NoUseCount = couponlist.Count(item => (item.EndTime > DateTime.Now && item.UseStatus == Entities.CouponRecordInfo.CounponStatuses.Unuse)); int bonusNoUseCount = shopBonus.Count(p => p.Receive.State == Entities.ShopBonusReceiveInfo.ReceiveState.NotUse && p.Bonus.BonusDateEnd > DateTime.Now); ViewBag.NoUseCount = NoUseCount + bonusNoUseCount; ViewBag.UserCount = (userCouponList.Count() + shopBonus.Count()) - ViewBag.NoUseCount; ViewBag.ShopBonus = shopBonus; return(View(couponlist)); }
/// <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)); }
public ActionResult ShopHeader(long id) { InitHeaderData(); #region 获取店铺的评价统计 var shopStatisticOrderComments = ServiceApplication.Create <IShopService>().GetShopStatisticOrderComments(id); var productAndDescription = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescription).FirstOrDefault(); var sellerServiceAttitude = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitude).FirstOrDefault(); var sellerDeliverySpeed = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeed).FirstOrDefault(); var productAndDescriptionPeer = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescriptionPeer).FirstOrDefault(); var sellerServiceAttitudePeer = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitudePeer).FirstOrDefault(); var sellerDeliverySpeedPeer = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeedPeer).FirstOrDefault(); var productAndDescriptionMax = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescriptionMax).FirstOrDefault(); var productAndDescriptionMin = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescriptionMin).FirstOrDefault(); var sellerServiceAttitudeMax = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitudeMax).FirstOrDefault(); var sellerServiceAttitudeMin = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitudeMin).FirstOrDefault(); var sellerDeliverySpeedMax = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeedMax).FirstOrDefault(); var sellerDeliverySpeedMin = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeedMin).FirstOrDefault(); decimal defaultValue = 5; //宝贝与描述 if (productAndDescription != null && productAndDescriptionPeer != null) { ViewBag.ProductAndDescription = productAndDescription.CommentValue; ViewBag.ProductAndDescriptionPeer = productAndDescriptionPeer.CommentValue; ViewBag.ProductAndDescriptionMin = productAndDescriptionMin.CommentValue; ViewBag.ProductAndDescriptionMax = productAndDescriptionMax.CommentValue; } else { ViewBag.ProductAndDescription = defaultValue; ViewBag.ProductAndDescriptionPeer = defaultValue; ViewBag.ProductAndDescriptionMin = defaultValue; ViewBag.ProductAndDescriptionMax = defaultValue; } //卖家服务态度 if (sellerServiceAttitude != null && sellerServiceAttitudePeer != null) { ViewBag.SellerServiceAttitude = sellerServiceAttitude.CommentValue; ViewBag.SellerServiceAttitudePeer = sellerServiceAttitudePeer.CommentValue; ViewBag.SellerServiceAttitudeMax = sellerServiceAttitudeMax.CommentValue; ViewBag.SellerServiceAttitudeMin = sellerServiceAttitudeMin.CommentValue; } else { ViewBag.SellerServiceAttitude = defaultValue; ViewBag.SellerServiceAttitudePeer = defaultValue; ViewBag.SellerServiceAttitudeMax = defaultValue; ViewBag.SellerServiceAttitudeMin = defaultValue; } //卖家发货速度 if (sellerDeliverySpeedPeer != null && sellerDeliverySpeed != null) { ViewBag.SellerDeliverySpeed = sellerDeliverySpeed.CommentValue; ViewBag.SellerDeliverySpeedPeer = sellerDeliverySpeedPeer.CommentValue; ViewBag.SellerDeliverySpeedMax = sellerDeliverySpeedMax.CommentValue; ViewBag.sellerDeliverySpeedMin = sellerDeliverySpeedMin.CommentValue; } else { ViewBag.SellerDeliverySpeed = defaultValue; ViewBag.SellerDeliverySpeedPeer = defaultValue; ViewBag.SellerDeliverySpeedMax = defaultValue; ViewBag.sellerDeliverySpeedMin = defaultValue; } #endregion #region 微店二维码 var vshop = ServiceApplication.Create <IVShopService>().GetVShopByShopId(id); string vshopUrl = ""; var curUrl = CurrentUrlHelper.CurrentUrlNoPort(); if (vshop != null) { vshopUrl = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/vshop/detail/" + vshop.Id; ViewBag.VShopQR = CreateQR(vshop.StrLogo, vshopUrl); } else { vshopUrl = curUrl + "/m-" + PlatformType.WeiXin.ToString(); ViewBag.VShopQR = CreateQR(null, vshopUrl); } #endregion ViewBag.ShopName = ServiceApplication.Create <IShopService>().GetShop(id).ShopName; var user = CurrentUser?.Id ?? 0; bool isLogin = CurrentUser != null; var model = new ProductPartialHeaderModel(); model.ShopId = id; model.isLogin = isLogin ? "true" : "false"; //用户积分 model.MemberIntegral = isLogin ? MemberIntegralApplication.GetAvailableIntegral(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 browsingPro = isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List<ProductBrowsedHistoryModel>(); //model.BrowsingProducts = browsingPro; InitHeaderData(); setTheme();//主题设置 ViewBag.Keyword = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword; ViewBag.Keywords = SiteSettings.HotKeyWords; return(PartialView("~/Areas/Web/Views/Shared/ShopHeader.cshtml", model)); }