public List <RecommendItemModel> GetHomeRecommendItemList(int postionID, int count) { var recommendItemEntityList = RecommendFacade.QueryRecommendProduct(0, 0, postionID, count, ConstValue.LanguageCode, ConstValue.CompanyCode); List <RecommendItemModel> result = new List <RecommendItemModel>(); ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle); foreach (var itemEntity in recommendItemEntityList) { RecommendItemModel itemModel = new RecommendItemModel(); itemModel.ID = itemEntity.SysNo; itemModel.ProductTitle = itemEntity.BriefName; itemModel.PromotionTitle = itemEntity.PromotionTitle; itemModel.Code = itemEntity.ProductID; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage); var priceModel = new SalesInfoModel(); itemModel.Price = priceModel; priceModel.BasicPrice = itemEntity.BasicPrice; priceModel.CurrentPrice = itemEntity.RealPrice; priceModel.CashRebate = itemEntity.CashRebate; priceModel.TariffPrice = itemEntity.TariffPrice; priceModel.FreeEntryTax = itemEntity.TariffPrice <= ConstValue.TariffFreeLimit; decimal realTariffPrice = priceModel.TariffPrice; if (priceModel.FreeEntryTax) { realTariffPrice = 0; } priceModel.TotalPrice = itemEntity.CurrentPrice + itemEntity.CashRebate + realTariffPrice; result.Add(itemModel); } return(result); }
/// <summary> /// 获取首页新品上市商品列表 /// </summary> /// <returns></returns> public List <RecommendItemModel> GetHomeRecommendProductList() { var config = AppSettings.GetCachedConfig(); List <RecommendItemModel> res = new List <RecommendItemModel>(); List <RecommendProduct> resultList = RecommendFacade.QueryNewRecommendProduct(config.CountRecommendProductItemList, ConstValue.LanguageCode, ConstValue.CompanyCode); if (null != resultList && resultList.Count > 0) { foreach (var item in resultList) { RecommendItemModel model = new RecommendItemModel() { Code = item.ProductID, ID = item.SysNo, ImageUrl = ProductFacade.BuildProductImage(ImageUrlHelper.GetImageSize(ImageType.Middle), item.DefaultImage), Price = new SalesInfoModel() { CurrentPrice = item.RealPrice, BasicPrice = item.BasicPrice, TariffPrice = item.TariffPrice, CashRebate = item.CashRebate }, ProductTitle = item.ProductTitle, PromotionTitle = item.PromotionTitle }; res.Add(model); } } return(res); }
public ActionResult Ajax_QueryFood() { var pageIndex = int.Parse(Request["page"]); var pageSize = int.Parse(Request["size"]); var result = new AjaxResult { Success = true }; SearchCriteriaModel filter = new SearchCriteriaModel(); filter.Category1ID = int.Parse(ConfigurationManager.AppSettings["ECCategoryID"]); NameValueCollection pageInfo = new NameValueCollection(); pageInfo.Add("pageIndex", pageIndex.ToString()); pageInfo.Add("pageSize", pageSize.ToString()); ProductSearchResultVM data = SearchManager.Search(filter, pageInfo); data.ProductList.CurrentPageData.ForEach(p => { p.ProductDefaultImage = ProductFacade.BuildProductImage(ImageSize.P240, p.ProductDefaultImage); }); result.Data = new { List = data.ProductList.CurrentPageData, PageCount = data.ProductList.TotalPages }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Ajax_QueryOrder() { var pageIndex = int.Parse(Request["PageIndex"]); var queryType = int.Parse(Request["QueryType"]); SOQueryInfo query = new SOQueryInfo(); //搜索类型,默认是搜索[最近三个月的-15][14-所有订单] query.SearchType = queryType == 1 ? SOSearchType.LastThreeMonths : SOSearchType.ALL; query.PagingInfo = new PageInfo(); query.PagingInfo.PageSize = 5; query.PagingInfo.PageIndex = pageIndex; query.CustomerID = CurrUser.UserSysNo; query.Status = null; QueryResult <OrderInfo> orders = CustomerFacade.GetOrderList(query); //如果查询类型是【三个月内】下单,则需要合并最近下单的数据 if (query.SearchType == SOSearchType.LastThreeMonths && pageIndex == 0) { var recentOrderSysNoes = CookieHelper.GetCookie <string>("SoSysNo"); if (!string.IsNullOrWhiteSpace(recentOrderSysNoes)) { var soSysNoes = recentOrderSysNoes.Split(',').ToList <string>(); var recentOrders = CustomerFacade.GetCenterOrderMasterList(query.CustomerID, soSysNoes); if (recentOrders != null && orders != null && orders.ResultList != null) { //排除掉orders中已经存在的数据 recentOrders.RemoveAll(p => orders.ResultList.Any(q => q.SoSysNo == p.SoSysNo)); //将最近的订单加载到orders中 for (var i = recentOrders.Count - 1; i >= 0; i--) { orders.ResultList.Insert(0, recentOrders[i]); } } } } if (orders != null) { if (orders.ResultList != null) { for (var i = 0; i < orders.ResultList.Count; i++) { orders.ResultList[i] = CustomerFacade.GetCenterSODetailInfo(CurrUser.UserSysNo, orders.ResultList[i].SoSysNo); orders.ResultList[i].SOItemList.ForEach(q => { q.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, q.DefaultImage); }); } } } var result = new AjaxResult { Success = true, Data = orders }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Ajax_QueryMyFavorite() { var result = new AjaxResult { Success = true }; int pageIndex = int.Parse(Request["PageIndex"]); Nesoft.ECWeb.Entity.PageInfo pageInfo = new Entity.PageInfo(); pageInfo.PageIndex = pageIndex; pageInfo.PageSize = 10; var user = UserManager.ReadUserInfo(); var data = CustomerFacade.GetMyFavoriteProductList(user.UserSysNo, pageInfo); var wishSysNos = CookieHelper.GetCookie <List <int> >("DeletedFavorite") ?? new List <int>(); data.ResultList.RemoveAll(p => wishSysNos.Any(q => p.WishSysNo == q)); data.ResultList.ForEach(p => { p.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P60, p.DefaultImage); }); result.Data = data; return(Json(result, JsonRequestBehavior.AllowGet)); }
private StoreBasicInfoModel Transformstoreinfo(StoreBasicInfo storeinfo) { StoreBasicInfoModel result = new StoreBasicInfoModel(); result.Address = storeinfo.Address; result.BrandAuthorize = storeinfo.BrandAuthorize; result.ContactName = storeinfo.ContactName; result.CooperationMode = storeinfo.CooperationMode; result.CurrentECChannel = storeinfo.CurrentECChannel; result.ECExpValue = storeinfo.ECExpValue; result.EditDate = storeinfo.EditDate; result.EditUserName = storeinfo.EditUserName; result.EditUserSysNo = storeinfo.EditUserSysNo; result.Email = storeinfo.Email; result.ExportExpValue = storeinfo.ExportExpValue; result.HaveECExp = storeinfo.HaveECExp; result.HaveExportExp = storeinfo.HaveExportExp; result.InDate = storeinfo.InDate; result.InUserName = storeinfo.InUserName; result.InUserSysNo = storeinfo.InUserSysNo; result.MainBrand = storeinfo.MainBrand; result.MainProductCategory = storeinfo.MainProductCategory; result.Mobile = storeinfo.Mobile; result.Name = storeinfo.Name; result.Phone = storeinfo.Phone; result.QQ = storeinfo.QQ; result.Remark = storeinfo.Remark; result.SellerSysNo = storeinfo.SellerSysNo; result.Site = storeinfo.Site; result.Status = storeinfo.Status; result.StoreName = storeinfo.StoreName; result.SysNo = storeinfo.SysNo; result.ValidDate = storeinfo.ValidDate; //构造商品图片 ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle); result.LogoURL = ProductFacade.BuildProductImage(imageSizeMiddle, storeinfo.LogoURL); //是否被收藏 #region 是否被收藏 LoginUser CurrUser = UserMgr.ReadUserInfo(); bool StoreIsWished = false; if (CurrUser == null || CurrUser.UserSysNo < 0) { StoreIsWished = false; } else { StoreIsWished = CustomerFacade.IsMyFavoriteSeller(CurrUser.UserSysNo, storeinfo.SellerSysNo.Value); } #endregion result.StoreIsWished = StoreIsWished; return(result); }
/// <summary> /// 获取商品列表 /// </summary> /// <param name="info"></param> /// <param name="group"></param> /// <returns></returns> private static List <OrderProductItemModel> GetCartItemList(OrderInfo info, OrderItemGroup group) { List <OrderProductItemModel> list = new List <OrderProductItemModel>(); ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle); group.ProductItemList.ForEach(item => { OrderProductItemModel model = new OrderProductItemModel() { ProductSysNo = item.ProductSysNo, ProductID = item.ProductID, ProductName = item["ProductTitle"] == null ? "" : item["ProductTitle"].ToString(), SplitGroupPropertyDescList = item.SplitGroupPropertyDescList, DefaultImage = ProductFacade.BuildProductImage(imageSize, item.DefaultImage), ConsumptionDate = item.ConsumptionDate, UnitQuantity = item.UnitQuantity, UnitMarketPrice = item.UnitMarketPrice, UnitCostPrice = item.UnitCostPrice, UnitSalePrice = item.UnitSalePrice, Weight = item.Weight, TotalInventory = item.TotalInventory, WarehouseNumber = item.WarehouseNumber, WarehouseName = item.WarehouseName, WarehouseCountryCode = item.WarehouseCountryCode, MerchantSysNo = item.MerchantSysNo, UnitRewardedPoint = item.UnitRewardedPoint, TotalRewardedPoint = item.TotalRewardedPoint, SpecialActivityType = item.SpecialActivityType, SpecialActivitySysNo = item.SpecialActivitySysNo, Quantity = group.Quantity * item.UnitQuantity, AttachmentList = GetAttachment(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo), GiftList = GetGiftItem(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo, 2), ProductChecked = item.ProductChecked }; decimal discountPrice = item["UnitDiscountAmt"] == null ? GetDiscountPrice(info, GetPackageNo(group.PackageNo, item), item.ProductSysNo) : (decimal)item["UnitDiscountAmt"];//折扣金额 model.UnitPrice = item.UnitSalePrice - discountPrice; // model.UnitTaxFee = decimal.Round((decimal)item["TariffRate"] * (model.UnitPrice - (item["UnitCouponAmt"] == null ? 0m : (decimal)item["UnitCouponAmt"])), 2, MidpointRounding.AwayFromZero);//- (item["UnitDiscountAmt"] == null ? 0m : (decimal)item["UnitDiscountAmt"])折扣金额 model.UnitTaxFee = (item["UnitDiscountAmt"] == null ? 0m : (decimal)item["UnitDiscountAmt"]);//折扣金额 model.TotalSalePrice = (item.UnitSalePrice - discountPrice + model.UnitTaxFee) * model.Quantity; //计算是否已加入收藏夹 model.IsWished = false; Nesoft.ECWeb.UI.LoginUser currUser = Nesoft.ECWeb.UI.UserMgr.ReadUserInfo(); if (currUser != null && currUser.UserSysNo > 0) { model.IsWished = ProductFacade.IsProductWished(item.ProductSysNo, currUser.UserSysNo); } list.Add(model); }); return(list); }
private List <ProductImageModel> TransformImageList(List <ProductImage> imageList) { imageList = imageList ?? new List <ProductImage>(); ImageSize imageSizeBig = ImageUrlHelper.GetImageSize(ImageType.Big); ImageSize imageSizeHuge = ImageUrlHelper.GetImageSize(ImageType.Huge); List <ProductImageModel> result = new List <ProductImageModel>(); foreach (var image in imageList) { ProductImageModel model = new ProductImageModel(); model.ImageUrlBig = ProductFacade.BuildProductImage(imageSizeBig, image.ResourceUrl); model.ImageUrlHuge = ProductFacade.BuildProductImage(imageSizeHuge, image.ResourceUrl); result.Add(model); } return(result); }
private List <AttachmentInfo> TransformAttachmentInfo(List <ProductItemInfo> attachmentList) { attachmentList = attachmentList ?? new List <ProductItemInfo>(); ImageSize imageSizeGift = ImageUrlHelper.GetImageSize(ImageType.Tiny); List <AttachmentInfo> result = new List <AttachmentInfo>(); foreach (var item in attachmentList) { AttachmentInfo model = new AttachmentInfo(); model.ID = item.ID; model.ProductName = item.ProductTitle; model.UnitQuantity = item.DisplayQuantity; model.ImageUrl = ProductFacade.BuildProductImage(imageSizeGift, item.DefaultImage); result.Add(model); } return(result); }
public ActionResult Ajax_QueryGroupbuying() { int category = 0; int pageIndex = 0; int.TryParse(Request["category"], out category); int.TryParse(Request["page"], out pageIndex); GroupBuyingQueryInfo queryInfo = new GroupBuyingQueryInfo() { PageInfo = new Entity.PageInfo() { PageIndex = pageIndex, PageSize = int.Parse(Request["size"]) }, SortType = 0, GroupBuyingTypeSysNo = 0 }; if (category > 0) { queryInfo.CategorySysNo = category; } else { queryInfo.CategorySysNo = null; } var data = GroupBuyingFacade.QueryGroupBuyingInfo(queryInfo); data.ResultList.ForEach(p => { p.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P200, p.DefaultImage); }); var result = new AjaxResult { Success = true, Data = data }; return(Json(result, JsonRequestBehavior.AllowGet)); }
//店铺新品商品10个 private List <StoreNewProductRecommendModel> Transformsnewstorerecommend(List <RecommendProduct> newStoreRecommendList) { List <StoreNewProductRecommendModel> result = new List <StoreNewProductRecommendModel>(); foreach (var p in newStoreRecommendList) { StoreNewProductRecommendModel item = new StoreNewProductRecommendModel(); item.CompanyCode = p.CompanyCode; item.EditDate = p.EditDate; item.EditDateStr = p.EditDateStr; item.EditUserName = p.EditUserName; item.EditUserSysNo = p.EditUserSysNo; item.InDate = p.InDate; item.InDateStr = p.InDateStr; item.InUserName = p.InUserName; item.InUserSysNo = p.InUserSysNo; item.LanguageCode = p.LanguageCode; item.StoreCompanyCode = p.StoreCompanyCode; item.SysNo = p.SysNo; item.BasicPrice = p.BasicPrice; item.BrandSysNo = p.BrandSysNo; item.BriefName = p.BriefName; item.CashRebate = p.CashRebate; item.ProductID = p.ProductID; item.Priority = p.Priority; item.ProductName = p.ProductName; item.ProductTitle = p.ProductTitle; item.CurrentPrice = p.CurrentPrice; item.Discount = p.Discount; item.TariffRate = p.TariffRate; item.Description = p.Description; item.PromotionTitle = p.PromotionTitle; item.RealPrice = p.RealPrice; item.TariffPrice = p.TariffPrice; //构造商品图片 ImageSize imageSizeMiddle = Nesoft.ECWeb.MobileService.Models.Product.ImageUrlHelper.GetImageSize(ImageType.Middle); item.DefaultImage = ProductFacade.BuildProductImage(imageSizeMiddle, p.DefaultImage); result.Add(item); } return(result); }
private RecommendItemModel MapFloorItem(FloorItemProduct itemEntity, ImageSize imageSize) { RecommendItemModel itemModel = new RecommendItemModel(); itemModel.ID = itemEntity.ProductSysNo; itemModel.ProductTitle = itemEntity.ProductTitle; //itemModel.PromotionTitle = itemEntity.PromotionTitle; itemModel.Code = ""; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage); var priceModel = new SalesInfoModel(); itemModel.Price = priceModel; priceModel.BasicPrice = itemEntity.BasicPrice ?? 0m; priceModel.CurrentPrice = itemEntity.ProductPrice ?? 0m; priceModel.CashRebate = itemEntity.CashRebate ?? 0m;; priceModel.TariffPrice = 0; priceModel.TotalPrice = itemEntity.RealPrice ?? 0m; return(itemModel); }
private List <ProductItemModel> TransformResultItemList(PagedResult <ProductSearchResultItem> solrItemList) { List <ProductItemModel> result = new List <ProductItemModel>(); ImageSize imageSizeItemList = Nesoft.ECWeb.MobileService.Models.Product.ImageUrlHelper.GetImageSize(ImageType.Middle); foreach (var item in solrItemList) { ProductItemModel model = new ProductItemModel(); //基本信息 model.ID = item.ProductSysNo; model.Code = item.ProductID; model.ProductTitle = item.ProductDisplayName; model.PromotionTitle = item.PromotionTitle; model.ImageUrl = ProductFacade.BuildProductImage(imageSizeItemList, item.ProductDefaultImage); //价格相关信息 SalesInfoModel salesInfo = new SalesInfoModel(); salesInfo.BasicPrice = item.MarketPrice; salesInfo.CurrentPrice = item.SalesPrice; salesInfo.CashRebate = item.CashRebate; salesInfo.TariffPrice = item.ProductTariffAmt; salesInfo.FreeEntryTax = item.ProductTariffAmt <= ConstValue.TariffFreeLimit; salesInfo.TotalPrice = item.TotalPrice; //赠送积分数量 salesInfo.PresentPoint = item.Point; salesInfo.OnlineQty = item.OnlineQty; salesInfo.IsHaveValidGift = item.IsHaveValidGift; salesInfo.IsCountDown = item.IsCountDown; salesInfo.IsNewProduct = item.IsNewproduct; salesInfo.IsGroupBuyProduct = item.IsGroupBuyProduct; model.SalesInfo = salesInfo; //其它信息 model.ReviewCount = item.ReviewCount; model.ReviewScore = item.ReviewScore; result.Add(model); } return(result); }
private BasicInfoModel TransformBasicInfo(ProductBasicInfo basicInfo) { BasicInfoModel result = new BasicInfoModel(); result.ID = basicInfo.ID; result.Code = basicInfo.Code; result.C3SysNo = basicInfo.CategoryID; result.ProductTitle = basicInfo.ProductTitle; result.PromotionTitle = basicInfo.PromotionTitle; result.ProductMode = basicInfo.ProductMode; result.ProducePlace = basicInfo.ProductEntryInfo.OriginCountryName; result.ProductGroupSysNo = basicInfo.ProductGroupSysNo; result.ProductStatus = (int)basicInfo.ProductStatus; result.ProductType = (int)basicInfo.ProductType; //构造商品图片 ImageSize imageSizeMiddle = ImageUrlHelper.GetImageSize(ImageType.Middle); result.DefaultImageUrl = ProductFacade.BuildProductImage(imageSizeMiddle, basicInfo.DefaultImage); return(result); }
/// <summary> /// 获取赠品 /// </summary> /// <param name="info"></param> /// <param name="packageNo">套餐编号</param> /// <param name="ParentProductSysNo"></param> /// <param name="isGiftPool">0获取全部,1赠品池 2非赠品池</param> /// <returns></returns> private static List <OrderGiftItem> GetGiftItem(OrderInfo info, int packageNo, int parentProductSysNo, int isGiftPool) { List <OrderGiftItem> list = new List <OrderGiftItem>(); if (info.GiftItemList != null && info.GiftItemList.Count > 0) { MobileAppConfig config = AppSettings.GetCachedConfig(); ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle); string path = config.MobileAppServiceHost; foreach (OrderGiftItem item in info.GiftItemList) { if (string.IsNullOrEmpty(item.DefaultImage)) { item.DefaultImage = path.TrimEnd('/').TrimEnd('\\') + "/Resources/Images/shoppingcart" + (item.ProductSysNo % 4 + 1) + ".jpg"; } else { item.DefaultImage = ProductFacade.BuildProductImage(imageSize, item.DefaultImage); } if (isGiftPool == 0 && item.ParentProductSysNo == parentProductSysNo && item.ParentPackageNo == packageNo) { list.Add(item); } else if (isGiftPool == 1 && item.ParentProductSysNo == parentProductSysNo && item.ParentPackageNo == packageNo && item.IsGiftPool == true) { list.Add(item); } else if (isGiftPool == 2 && item.ParentProductSysNo == parentProductSysNo && item.ParentPackageNo == packageNo && item.IsGiftPool == false) { list.Add(item); } } } return(list); }
public List <RecommendItemModel> MapAdvItem(List <SaleAdvertisementItem> advItemList) { List <RecommendItemModel> result = new List <RecommendItemModel>(); if (advItemList == null) { return(result); } ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Big); foreach (var itemEntity in advItemList) { RecommendItemModel itemModel = new RecommendItemModel(); itemModel.ID = itemEntity.ProductSysNo; itemModel.ProductTitle = itemEntity.ProductTitle; itemModel.Code = itemEntity.ProductCode; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSize, itemEntity.DefaultImage); var priceModel = new SalesInfoModel(); itemModel.Price = priceModel; priceModel.BasicPrice = itemEntity.MarketPrice; priceModel.CurrentPrice = itemEntity.CurrentPrice; priceModel.CashRebate = itemEntity.CashRebate; priceModel.FreeEntryTax = itemEntity.ProductTariffAmt <= ConstValue.TariffFreeLimit; priceModel.TariffPrice = itemEntity.ProductTariffAmt; decimal realTariffPrice = priceModel.TariffPrice; if (priceModel.FreeEntryTax) { realTariffPrice = 0; } priceModel.TotalPrice = itemEntity.CurrentPrice + itemEntity.CashRebate + realTariffPrice; result.Add(itemModel); } return(result); }
/// <summary> /// 限时抢购列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public QueryResult <CountDownItemModel> GetCountDownList(int pageIndex, int pageSize) { var countDownList = CountDownFacade.GetCountDownList(pageIndex, pageSize); //列表信息 QueryResult <CountDownItemModel> result = new QueryResult <CountDownItemModel>(); result.ResultList = new List <CountDownItemModel>(); ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Middle); var countDownItemList = countDownList.ResultList ?? new List <CountDownInfo>(); foreach (var item in countDownItemList) { CountDownItemModel itemModel = new CountDownItemModel(); itemModel.Code = item.ProductID; itemModel.ID = item.ProductSysNo; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSize, item.DefaultImage); itemModel.ProductTitle = item.ProductTitle; itemModel.PromotionTitle = item.PromotionTitle; //Asura 添加开始时间 开始 itemModel.StartTime = string.Format("{0:G}", item.StartTime); //Asura 添加开始时间 结束 if (item.StartTime > DateTime.Now) { itemModel.LeftSeconds = (int)(DateTime.Now - item.StartTime).TotalSeconds; } else { if (item.EndTime < DateTime.Now) { itemModel.LeftSeconds = 0; } else { itemModel.LeftSeconds = (int)(item.EndTime - DateTime.Now).TotalSeconds; } } //销售相关信息 var priceModel = new SalesInfoModel(); itemModel.Price = priceModel; decimal realSnapShotTariffPrice = item.SnapShotTariffPrice; if (realSnapShotTariffPrice <= ConstValue.TariffFreeLimit) { realSnapShotTariffPrice = 0; } priceModel.BasicPrice = item.SnapShotCurrentPrice + item.SnapShotCashRebate + realSnapShotTariffPrice; priceModel.CurrentPrice = item.CountDownPrice; priceModel.CashRebate = item.CountDownCashRebate; priceModel.TariffPrice = item.TariffPrice; decimal realTariffPrice = item.TariffPrice; if (item.TariffPrice <= ConstValue.TariffFreeLimit) { realTariffPrice = 0; } priceModel.TotalPrice = item.CountDownPrice + item.CountDownCashRebate + realTariffPrice; priceModel.OnlineQty = item.OnlineQty; result.ResultList.Add(itemModel); } result.ResultList.Sort((x, y) => x.LeftSeconds.CompareTo(y.LeftSeconds)); //result.ResultList.Reverse(); //分页信息 if (countDownList.PageInfo != null) { var pageInfo = new PageInfo(); pageInfo.PageIndex = pageIndex; pageInfo.PageSize = pageSize; pageInfo.TotalCount = countDownList.PageInfo.TotalCount; result.PageInfo = pageInfo; } return(result); }
private PromoInfoModel TransformPromoInfo(ProductPromotionInfo promotionInfo) { PromoInfoModel result = new PromoInfoModel(); result.CountDownSysNo = promotionInfo.CountdownSysNo; if (promotionInfo.Countdown != null && promotionInfo.Countdown.EndTime.HasValue) { //计算限时抢购剩余时间 if (promotionInfo.Countdown.EndTime <= DateTime.Now) { result.CountDownLeftSecond = 0; } else { var ts = promotionInfo.Countdown.EndTime.Value - DateTime.Now; result.CountDownLeftSecond = (int)ts.TotalSeconds; } } result.GroupBuyingSysNo = promotionInfo.GroupBuySysNo; //读取单品买赠和厂商赠品列表 result.GiftInfo = new List <GiftItemModel>(); if (promotionInfo.SaleGiftList == null) { promotionInfo.SaleGiftList = new List <SaleGiftInfo>(); } var giftPromoList = promotionInfo.SaleGiftList.Where(item => item.SaleGiftType == SaleGiftType.Single || item.SaleGiftType == SaleGiftType.Vendor); ImageSize imageSizeGift = ImageUrlHelper.GetImageSize(ImageType.Tiny); foreach (var promo in giftPromoList) { if (promo.GiftItemList == null) { promo.GiftItemList = new List <GiftItem>(); } foreach (var giftItem in promo.GiftItemList) { GiftItemModel model = new GiftItemModel(); model.ID = giftItem.ProductSysNo; model.ProductName = giftItem.ProductName; model.ImageUrl = ProductFacade.BuildProductImage(imageSizeGift, giftItem.DefaultImage); model.UnitQuantity = giftItem.UnitQuantity; result.GiftInfo.Add(model); } } //套餐活动信息 result.ComboInfo = new List <ComboInfoModel>(); var comboList = promotionInfo.ComboList ?? new List <ComboInfo>(); ImageSize imageSizeCombo = ImageUrlHelper.GetImageSize(ImageType.Middle); foreach (var combo in comboList) { decimal originalTotal = 0; decimal discount = 0; List <ComboItemModel> comboItemList = new List <ComboItemModel>(); foreach (var item in combo.Items) { ComboItemModel itemModel = new ComboItemModel(); itemModel.ID = item.ProductSysNo; itemModel.Code = item.ProductID; itemModel.ProductTitle = item.ProductName; itemModel.Quantity = item.Quantity; itemModel.ImageUrl = ProductFacade.BuildProductImage(imageSizeCombo, item.DefaultImage); itemModel.CurrentPrice = item.CurrentPrice; var tariffPrice = item.TariffRate * item.CurrentPrice; itemModel.TariffPrice = tariffPrice; itemModel.Discount = item.Discount; if (tariffPrice <= ConstValue.TariffFreeLimit) { originalTotal += item.CurrentPrice * item.Quantity; } else { originalTotal += (item.CurrentPrice + tariffPrice) * item.Quantity; } discount += item.Discount * item.Quantity; comboItemList.Add(itemModel); } ComboInfoModel model = new ComboInfoModel(); if (combo.SysNo.HasValue) { model.SysNo = combo.SysNo.Value; } model.SaleRuleName = combo.SaleRuleName; model.OriginalPrice = originalTotal; model.DiscountPrice = discount; model.TotalPrice = originalTotal + (discount > 0 ? -discount : discount); model.Items = comboItemList; result.ComboInfo.Add(model); } return(result); }
public static void SalesOrderMailSuccessful(OrderInfo order) { foreach (var subOrder in order.SubOrderList.Values) { if (subOrder.SOType == (int)SOType.VirualGroupBuy) { continue; } ECommerce.Entity.Member.CustomerInfo customer = CustomerDA.GetCustomerByID(subOrder.Customer.ID); if (string.IsNullOrEmpty(customer.Email)) { return; } AsyncEmail email = new AsyncEmail(); email.MailAddress = customer.Email; email.CustomerID = customer.CustomerID; email.Status = (int)EmailStatus.NotSend; string token = Guid.NewGuid().ToString("N"); email.ImgBaseUrl = ConfigurationManager.AppSettings["CDNWebDomain"].ToString(); email.SetNewTokenUrl = "/EmailVerifySucceed?token=" + token + "&sysno=" + customer.SysNo.ToString() + "&email=" + System.Web.HttpUtility.HtmlEncode(customer.Email); string subject = string.Empty; email.MailBody = MailHelper.GetMailTemplateBody("SalesOrderMailSuccessful", out subject); email.MailSubject = subject.Replace("[SOSysNo]", subOrder.ID.ToString()); //订单内容 email.MailBody = email.MailBody.Replace("[SOSysNo]", subOrder.ID.ToString()); email.MailBody = email.MailBody.Replace("[OrderTime]", subOrder.InDate.ToString("yyyy年MM月dd日 HH时mm分")); email.MailBody = email.MailBody.Replace("[CustomerID]", subOrder.Customer.ID); email.MailBody = email.MailBody.Replace("[CustomerName]", subOrder.Customer.Name); email.MailBody = email.MailBody.Replace("[ContactName]", subOrder.Contact.Name); email.MailBody = email.MailBody.Replace("[ContactMobilePhone]", subOrder.Contact.MobilePhone); email.MailBody = email.MailBody.Replace("[ContactPhone]", subOrder.Contact.Phone); var area = CommonFacade.GetArea(subOrder.Contact.AddressAreaID); string address = string.Format("{0} {1} {2} {3}", area.ProvinceName, area.CityName, area.DistrictName, subOrder.Contact.AddressDetail); email.MailBody = email.MailBody.Replace("[ContactAddress]", address); email.MailBody = email.MailBody.Replace("[ContactZipCode]", subOrder.Contact.ZipCode); email.MailBody = email.MailBody.Replace("[ShipTypeName]", (string)subOrder["ShipTypeName"]); email.MailBody = email.MailBody.Replace("[PayTypeName]", subOrder.PayTypeName); email.MailBody = email.MailBody.Replace("[CashPayAmountWithTax]", (subOrder.CashPayAmount + subOrder.TaxAmount).ToString("F2")); email.MailBody = email.MailBody.Replace("[TotalWeight]", (((decimal)subOrder.TotalWeight) / 1000).ToString("F3")); email.MailBody = email.MailBody.Replace("[ShippingAmount]", subOrder.ShippingAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[TaxAmount]", subOrder.TaxAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[CouponAmount]", subOrder.CouponAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[GiftCardPayAmount]", subOrder.GiftCardPayAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[BalancePayAmount]", subOrder.BalancePayAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[TotalDiscountAmount]", subOrder.TotalDiscountAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[PointPayAmount]", subOrder.PointPayAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[SOAmount]", subOrder.SOAmount.ToString("F2")); email.MailBody = email.MailBody.Replace("[SOMemo]", subOrder.Memo); email.MailBody = email.MailBody.Replace("[SendTime]", DateTime.Now.ToString("yyyy-MM-dd")); email.MailBody = email.MailBody.Replace("[Year]", DateTime.Now.Year.ToString()); string domain = ConfigurationManager.AppSettings["WebDomain"].ToString(); StringBuilder sb = new StringBuilder(); if (subOrder.OrderItemGroupList != null) { subOrder.OrderItemGroupList.ForEach(groupItem => { groupItem.ProductItemList.ForEach(item => { sb.Append("<tr style=\"background:#fff;\">"); sb.AppendFormat("<td align=\"center\" valign=\"middle\" style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"><a href=\"{0}\"><img src=\"{1}\" width=\"50\" height=\"50\" border=\"0\" /></a></td>", domain + "/product/detail/" + item.ProductSysNo, ProductFacade.BuildProductImage(ImageSize.P60, item.DefaultImage)); sb.AppendFormat("<td align=\"center\" style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"><p>{0}</p></td>", item.ProductID); sb.AppendFormat("<td valign=\"middle\" style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee; border-right:1px solid #eeeeee;\"><a href=\"{0}\" style=\"color:#ff6600; text-decoration:none; line-height:18px;\">{1}</a></td>", domain + "/product/detail/" + item.ProductSysNo, item.ProductName); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.UnitSalePrice.ToString("F2")); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">{0}</td>", item.UnitQuantity); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.TotalSalePrice.ToString("F2")); sb.Append("</tr>"); }); }); } if (subOrder.GiftItemList != null) { var mergedSaleGiftList = new List <OrderGiftItem>(); subOrder.GiftItemList.ForEach(gift => { if (!mergedSaleGiftList.Exists(g => { if (g.ProductSysNo == gift.ProductSysNo) { g.UnitQuantity += gift.UnitQuantity; return(true); } return(false); })) { mergedSaleGiftList.Add(gift); } }); foreach (var item in mergedSaleGiftList) { sb.Append("<tr style=\"background:#FFF4F2;\">"); sb.AppendFormat("<td style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"> </td>"); sb.AppendFormat("<td style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"> </td>"); sb.AppendFormat("<td valign=\"middle\" style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee; border-right:1px solid #eeeeee;line-height:18px;\"><span style=\"color:#ff6600; padding-right:8px;\">[赠品]</span>{0}</td>", item.ProductName); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.UnitSalePrice.ToString("F2")); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">{0}</td>", item.UnitQuantity); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.TotalSalePrice.ToString("F2")); sb.Append("</tr>"); } } if (subOrder.AttachmentItemList != null) { foreach (var item in subOrder.AttachmentItemList) { sb.Append("<tr style=\"background:#FFF4F2;\">"); sb.AppendFormat("<td style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"> </td>"); sb.AppendFormat("<td style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee;\"> </td>"); sb.AppendFormat("<td valign=\"middle\" style=\"padding-left:5px; border-left:1px solid #eeeeee; border-top:1px solid #eeeeee; border-right:1px solid #eeeeee;line-height:18px;\"><span style=\"color:#ff6600; padding-right:8px;\">[附件]</span>{0}</td>", item.ProductName); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.UnitSalePrice.ToString("F2")); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">{0}</td>", item.UnitQuantity); sb.AppendFormat("<td align=\"center\" style=\"border-right:1px solid #eeeeee; border-top:1px solid #eeeeee;\">¥{0}</td>", item.TotalSalePrice.ToString("F2")); sb.Append("</tr>"); } } if (subOrder.TotalRewardedPoint >= 0) { sb.Append("<tr style=\"background:#fff;\">"); sb.AppendFormat("<td colspan=\"6\" style=\"border-bottom:1px solid #eeeeee; border-top:1px solid #eeeeee; height:41px; text-align:center; font-weight:bold;\" align=\"center\">本单交易成功后您可以获得积分:<strong style=\"color:#c40000; font-size:12px; font-family:microsoft yahei;\">{0}</strong></td>", subOrder.TotalRewardedPoint); sb.Append("</tr>"); } email.MailBody = email.MailBody.Replace("[OrderContent]", sb.ToString()).Replace("[WebBaseUrl]", domain).Replace("[ImgBaseUrl]", email.ImgBaseUrl); EmailDA.SendEmail(email); } }