示例#1
0
        /// <summary>
        /// 生成商品的促销信息
        /// </summary>
        /// <param name="singlePromotionInfo">单品促销活动</param>
        /// <param name="buySendPromotionList">买送促销活动列表</param>
        /// <param name="fullSendPromotionInfo">满赠促销活动</param>
        /// <param name="fullCutPromotionInfo">满减促销活动</param>
        /// <returns></returns>
        public static string GeneratePromotionMsg(SinglePromotionInfo singlePromotionInfo, List <BuySendPromotionInfo> buySendPromotionList, FullSendPromotionInfo fullSendPromotionInfo, FullCutPromotionInfo fullCutPromotionInfo)
        {
            StringBuilder promotionMsg = new StringBuilder();

            //单品促销
            if (singlePromotionInfo != null)
            {
                //折扣类别
                switch (singlePromotionInfo.DiscountType)
                {
                case 0:    //折扣
                    promotionMsg.AppendFormat("折扣:{0}折<br/>", singlePromotionInfo.DiscountValue);
                    break;

                case 1:    //直降
                    promotionMsg.AppendFormat("直降:{0}元<br/>", singlePromotionInfo.DiscountValue);
                    break;

                case 2:    //折后价
                    promotionMsg.AppendFormat("折后价:{0}元<br/>", singlePromotionInfo.DiscountValue);
                    break;
                }

                //积分
                if (singlePromotionInfo.PayCredits > 0)
                {
                    promotionMsg.AppendFormat("赠送{0}:{1}<br/>", Credits.PayCreditName, singlePromotionInfo.PayCredits);
                }

                //优惠劵
                if (singlePromotionInfo.CouponTypeId > 0)
                {
                    CouponTypeInfo couponTypeInfo = Coupons.GetCouponTypeById(singlePromotionInfo.CouponTypeId);
                    if (couponTypeInfo != null)
                    {
                        promotionMsg.AppendFormat("赠送优惠劵:{0}<br/>", couponTypeInfo.Name);
                    }
                }
            }
            //买送促销
            if (buySendPromotionList != null && buySendPromotionList.Count > 0)
            {
                promotionMsg.Append("买送促销:");
                foreach (BuySendPromotionInfo buySendPromotionInfo in buySendPromotionList)
                {
                    promotionMsg.AppendFormat("买{0}送{1},", buySendPromotionInfo.BuyCount, buySendPromotionInfo.SendCount);
                }
                promotionMsg.Remove(promotionMsg.Length - 1, 1);
                promotionMsg.Append("<br/>");
            }
            //满赠促销
            if (fullSendPromotionInfo != null)
            {
                promotionMsg.Append("满赠促销:");
                promotionMsg.AppendFormat("满{0}元加{1}元<br/>", fullSendPromotionInfo.LimitMoney, fullSendPromotionInfo.AddMoney);
            }
            //满减促销
            if (fullCutPromotionInfo != null)
            {
                promotionMsg.Append("满减促销:");
                promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney1, fullCutPromotionInfo.CutMoney1);
                if (fullCutPromotionInfo.LimitMoney2 > 0 && fullCutPromotionInfo.CutMoney2 > 0)
                {
                    promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney2, fullCutPromotionInfo.CutMoney2);
                }
                if (fullCutPromotionInfo.LimitMoney3 > 0 && fullCutPromotionInfo.CutMoney3 > 0)
                {
                    promotionMsg.AppendFormat("满{0}元减{1}元,", fullCutPromotionInfo.LimitMoney3, fullCutPromotionInfo.CutMoney3);
                }
                promotionMsg.Remove(promotionMsg.Length - 1, 1);
                promotionMsg.Append("<br/>");
            }

            return(promotionMsg.Length > 0 ? promotionMsg.Remove(promotionMsg.Length - 5, 5).ToString() : "");
        }
示例#2
0
        /// <summary>
        /// 满减商品列表
        /// </summary>
        /// <returns></returns>
        public ActionResult FullCutProductList()
        {
            //满减促销活动id
            int pmId = GetRouteInt("pmId");

            if (pmId == 0)
            {
                pmId = WebHelper.GetQueryInt("pmId");
            }
            //开始价格
            int startPrice = GetRouteInt("startPrice");

            if (startPrice == 0)
            {
                startPrice = WebHelper.GetQueryInt("startPrice");
            }
            //结束价格
            int endPrice = GetRouteInt("endPrice");

            if (endPrice == 0)
            {
                endPrice = WebHelper.GetQueryInt("endPrice");
            }
            //排序列
            int sortColumn = GetRouteInt("sortColumn");

            if (sortColumn == 0)
            {
                sortColumn = WebHelper.GetQueryInt("sortColumn");
            }
            //排序方向
            int sortDirection = GetRouteInt("sortDirection");

            if (sortDirection == 0)
            {
                sortDirection = WebHelper.GetQueryInt("sortDirection");
            }
            //当前页数
            int page = GetRouteInt("page");

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

            //满减促销活动
            FullCutPromotionInfo fullCutPromotionInfo = Promotions.GetFullCutPromotionByPmIdAndTime(pmId, DateTime.Now);

            if (fullCutPromotionInfo == null)
            {
                return(PromptView(Url.Action("index"), "促销活动不存在"));
            }

            PageModel pageModel = new PageModel(20, page, Promotions.GetFullCutProductCount(fullCutPromotionInfo, startPrice, endPrice));

            FullCutProductListModel model = new FullCutProductListModel()
            {
                PmId             = pmId,
                StartPrice       = startPrice,
                EndPrice         = endPrice,
                SortColumn       = sortColumn,
                SortDirection    = sortDirection,
                PageModel        = pageModel,
                ProductList      = Promotions.GetFullCutProductList(pageModel.PageSize, pageModel.PageNumber, fullCutPromotionInfo, startPrice, endPrice, sortColumn, sortDirection),
                OrderProductList = Carts.GetCartProductList(WorkContext.Uid, WorkContext.Sid)
            };

            return(View(model));
        }
示例#3
0
 /// <summary>
 /// 获得满减商品数量
 /// </summary>
 /// <param name="fullCutPromotionInfo">满减促销活动</param>
 /// <param name="startPrice">开始价格</param>
 /// <param name="endPrice">结束价格</param>
 /// <returns></returns>
 public static int GetFullCutProductCount(FullCutPromotionInfo fullCutPromotionInfo, int startPrice, int endPrice)
 {
     return(BrnShop.Data.Promotions.GetFullCutProductCount(fullCutPromotionInfo, startPrice, endPrice));
 }
示例#4
0
 /// <summary>
 /// 获得满减商品列表
 /// </summary>
 /// <param name="pageSize">每页数</param>
 /// <param name="pageNumber">当前页数</param>
 /// <param name="fullCutPromotionInfo">满减促销活动</param>
 /// <param name="startPrice">开始价格</param>
 /// <param name="endPrice">结束价格</param>
 /// <param name="sortColumn">排序列</param>
 /// <param name="sortDirection">排序方向</param>
 /// <returns></returns>
 public static List <PartProductInfo> GetFullCutProductList(int pageSize, int pageNumber, FullCutPromotionInfo fullCutPromotionInfo, int startPrice, int endPrice, int sortColumn, int sortDirection)
 {
     return(BrnShop.Data.Promotions.GetFullCutProductList(pageSize, pageNumber, fullCutPromotionInfo, startPrice, endPrice, sortColumn, sortDirection));
 }
示例#5
0
 /// <summary>
 /// 更新满减促销活动
 /// </summary>
 public static void UpdateFullCutPromotion(FullCutPromotionInfo fullCutPromotionInfo)
 {
     BrnMall.Data.Promotions.UpdateFullCutPromotion(fullCutPromotionInfo);
 }
示例#6
0
 /// <summary>
 /// 创建满减促销活动
 /// </summary>
 public static void CreateFullCutPromotion(FullCutPromotionInfo fullCutPromotionInfo)
 {
     BrnShop.Data.Promotions.CreateFullCutPromotion(fullCutPromotionInfo);
 }
示例#7
0
 /// <summary>
 /// 更新满减促销活动
 /// </summary>
 public static void UpdateFullCutPromotion(FullCutPromotionInfo fullCutPromotionInfo)
 {
     NStore.Data.Promotions.UpdateFullCutPromotion(fullCutPromotionInfo);
 }