Пример #1
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            if (!SecureHelper.IsSafeSqlString(consultMessage))
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的内容不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            PageModel pageModel           = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo            = productInfo,
                CategoryInfo           = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo              = Brands.GetBrandById(productInfo.BrandId),
                StoreInfo              = storeInfo,
                StoreKeeperInfo        = Stores.GetStoreKeeperById(storeInfo.StoreId),
                StoreRegion            = Regions.GetRegionById(storeInfo.RegionId),
                StoreRankInfo          = StoreRanks.GetStoreRankById(storeInfo.StoreRid),
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages)
            };

            return(View(model));
        }
Пример #2
0
        /// <summary>
        /// 套装
        /// </summary>
        public ActionResult Suit()
        {
            //套装id
            int pmId = GetRouteInt("pmId");

            if (pmId == 0)
            {
                pmId = WebHelper.GetQueryInt("pmId");
            }

            //判断套装是否存在或过期
            SuitPromotionInfo suitPromotionInfo = Promotions.GetSuitPromotionByPmIdAndTime(pmId, DateTime.Now);

            if (suitPromotionInfo == null)
            {
                return(PromptView("/", "你访问的套装不存在或过期"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(suitPromotionInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的套装不存在"));
            }

            //扩展套装商品列表
            List <ExtSuitProductInfo> extSuitProductList = Promotions.GetExtSuitProductList(pmId);

            SuitModel model = new SuitModel();

            model.SuitPromotionInfo = suitPromotionInfo;
            model.SuitProductList   = extSuitProductList;
            model.StoreInfo         = storeInfo;
            model.StoreKeeperInfo   = Stores.GetStoreKeeperById(storeInfo.StoreId);
            model.StoreRegion       = Regions.GetRegionById(storeInfo.RegionId);
            model.StoreRankInfo     = StoreRanks.GetStoreRankById(storeInfo.StoreRid);

            foreach (ExtSuitProductInfo extSuitProductInfo in extSuitProductList)
            {
                model.SuitDiscount  += extSuitProductInfo.Number * extSuitProductInfo.Discount;
                model.ProductAmount += extSuitProductInfo.Number * extSuitProductInfo.ShopPrice;
            }
            model.SuitAmount = model.ProductAmount - model.SuitDiscount;

            return(View(model));
        }
Пример #3
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult ProductReviewList()
        {
            int pid        = WebHelper.GetQueryInt("pid");
            int reviewType = WebHelper.GetQueryInt("reviewType");
            int page       = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            if (reviewType < 0 || reviewType > 3)
            {
                reviewType = 0;
            }

            PageModel pageModel          = new PageModel(10, page, ProductReviews.GetProductReviewCount(pid, reviewType));
            ProductReviewListModel model = new ProductReviewListModel()
            {
                ProductInfo       = productInfo,
                CategoryInfo      = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo         = Brands.GetBrandById(productInfo.BrandId),
                StoreInfo         = storeInfo,
                StoreKeeperInfo   = Stores.GetStoreKeeperById(storeInfo.StoreId),
                StoreRegion       = Regions.GetRegionById(storeInfo.RegionId),
                StoreRankInfo     = StoreRanks.GetStoreRankById(storeInfo.StoreRid),
                ReviewType        = reviewType,
                PageModel         = pageModel,
                ProductReviewList = ProductReviews.GetProductReviewList(pid, reviewType, pageModel.PageSize, pageModel.PageNumber)
            };

            return(View(model));
        }
Пример #4
0
        /// <summary>
        /// 商品
        /// </summary>
        public ActionResult Product()
        {
            //商品id
            int pid = GetRouteInt("pid");

            if (pid == 0)
            {
                pid = WebHelper.GetQueryInt("pid");
            }

            //判断商品是否存在
            ProductInfo productInfo = Products.GetProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            //商品存在时
            ProductModel model = new ProductModel();

            //商品id
            model.Pid = pid;
            //商品信息
            model.ProductInfo = productInfo;
            //商品分类
            model.CategoryInfo = Categories.GetCategoryById(productInfo.CateId);
            //商品品牌
            model.BrandInfo = Brands.GetBrandById(productInfo.BrandId);
            //店铺信息
            model.StoreInfo = storeInfo;
            //店长信息
            model.StoreKeeperInfo = Stores.GetStoreKeeperById(storeInfo.StoreId);
            //店铺区域
            model.StoreRegion = Regions.GetRegionById(storeInfo.RegionId);
            //店铺等级信息
            model.StoreRankInfo = StoreRanks.GetStoreRankById(storeInfo.StoreRid);
            //商品图片列表
            model.ProductImageList = Products.GetProductImageList(pid);
            //扩展商品属性列表
            model.ExtProductAttributeList = Products.GetExtProductAttributeList(pid);
            //商品SKU列表
            model.ProductSKUList = Products.GetProductSKUListBySKUGid(productInfo.SKUGid);
            //商品库存数量
            model.StockNumber = Products.GetProductStockNumberByPid(pid);


            //单品促销
            model.SinglePromotionInfo = Promotions.GetSinglePromotionByPidAndTime(pid, DateTime.Now);
            //买送促销活动列表
            model.BuySendPromotionList = Promotions.GetBuySendPromotionList(productInfo.StoreId, pid, DateTime.Now);
            //赠品促销活动
            model.GiftPromotionInfo = Promotions.GetGiftPromotionByPidAndTime(pid, DateTime.Now);
            //赠品列表
            if (model.GiftPromotionInfo != null)
            {
                model.ExtGiftList = Promotions.GetExtGiftList(model.GiftPromotionInfo.PmId);
            }
            //套装商品列表
            model.SuitProductList = Promotions.GetProductAllSuitPromotion(pid, DateTime.Now);
            //满赠促销活动
            model.FullSendPromotionInfo = Promotions.GetFullSendPromotionByStoreIdAndPidAndTime(productInfo.StoreId, pid, DateTime.Now);
            //满减促销活动
            model.FullCutPromotionInfo = Promotions.GetFullCutPromotionByStoreIdAndPidAndTime(productInfo.StoreId, pid, DateTime.Now);

            //广告语
            model.Slogan = model.SinglePromotionInfo == null ? "" : model.SinglePromotionInfo.Slogan;
            //商品促销信息
            model.PromotionMsg = Promotions.GeneratePromotionMsg(model.SinglePromotionInfo, model.BuySendPromotionList, model.FullSendPromotionInfo, model.FullCutPromotionInfo);
            //商品折扣价格
            model.DiscountPrice = Promotions.ComputeDiscountPrice(model.ProductInfo.ShopPrice, model.SinglePromotionInfo);

            //关联商品列表
            model.RelateProductList = Products.GetRelateProductList(pid);

            //用户浏览历史
            model.UserBrowseHistory = BrowseHistories.GetUserBrowseHistory(WorkContext.Uid, pid);

            //商品咨询类型列表
            model.ProductConsultTypeList = ProductConsults.GetProductConsultTypeList();

            //更新浏览历史
            if (WorkContext.Uid > 0)
            {
                Asyn.UpdateBrowseHistory(WorkContext.Uid, pid);
            }
            //更新商品统计
            Asyn.UpdateProductStat(pid, WorkContext.RegionId);

            return(View(model));
        }