예제 #1
0
        public ActionResult Edit(long id)
        {
            var model = _iCollocationService.GetCollocation(id);

            if (model.ShopId != CurrentSellerManager.ShopId)
            {
                RedirectToAction("Management");
            }
            CollocationDataModel m = new CollocationDataModel();

            m.CreateTime = model.CreateTime.Value;
            m.EndTime    = model.EndTime;
            m.ShopId     = model.ShopId;
            m.ShortDesc  = model.ShortDesc;
            m.Title      = model.Title;
            m.StartTime  = model.StartTime;
            m.Id         = model.Id;
            var cProducts = _iCollocationService.GetProducts(new List <long> {
                model.Id
            });
            var cAllSKUs = _iCollocationService.GetSKUs(cProducts.Select(p => p.Id).ToList());
            var products = ProductManagerApplication.GetProductByIds(cProducts.Select(p => p.ProductId).ToList());
            var allSKUs  = ProductManagerApplication.GetSKUByProducts(products.Select(p => p.Id).ToList());

            m.CollocationPoruducts = cProducts.Select(a =>
            {
                var product = products.FirstOrDefault(p => p.Id == a.ProductId);
                var skus    = allSKUs.Where(p => p.ProductId == a.ProductId);
                var cSKUs   = cAllSKUs.Where(p => p.ColloProductId == a.Id);
                return(new CollocationPoruductModel()
                {
                    Id = a.Id,
                    ColloId = a.ColloId,
                    DisplaySequence = a.DisplaySequence,
                    IsMain = a.IsMain,
                    ProductId = a.ProductId,
                    ProductName = product ? .ProductName,
                    ImagePath = product ? .ImagePath,
                    CollocationSkus = cSKUs.Select(b =>
                    {
                        var sku = skus.FirstOrDefault(t => t.Id == b.SkuID);
                        return new CollocationSkus()
                        {
                            Id = b.Id,
                            Price = b.Price,
                            SkuID = b.SkuID,
                            SKUName = sku == null ? "" : sku.Color + " " + sku.Size + " " + sku.Version,
                            SkuPirce = b.SkuPirce,
                            ColloProductId = b.ColloProductId,
                            ProductId = b.ProductId
                        };
                    }).ToList()
                });
            }).OrderBy(a => a.DisplaySequence).ToList();

            var market = _iMarketService.GetMarketService(CurrentSellerManager.ShopId, MarketType.Collocation);

            ViewBag.EndTime = MarketApplication.GetServiceEndTime(market.Id).ToString("yyyy-MM-dd");
            return(View(m));
        }
        public JsonResult List(int page, int rows, string Keywords, int shopid = 0, bool?isReply = null)
        {
            var query = new ConsultationQuery {
                PageNo = page, PageSize = rows, KeyWords = Keywords, ShopID = shopid, IsReply = isReply
            };
            var data     = _iConsultationService.GetConsultations(query);
            var products = ProductManagerApplication.GetProductByIds(data.Models.Select(p => p.ProductId));
            var list     = data.Models.Select(item => {
                var product = products.FirstOrDefault(p => p.Id == item.ProductId);
                return(new ProductConsultationModel()
                {
                    Id = item.Id,
                    ConsultationContent = HTMLEncode(item.ConsultationContent),
                    Date = item.ConsultationDate.ToString("yyyy-MM-dd HH:mm:ss"),
                    ProductName = (product == null) ? "" : product.ProductName,
                    ProductId = item.ProductId,
                    UserName = item.UserName,
                    ReplyContent = HTMLEncode(item.ReplyContent),
                    ImagePath = (product == null) ? "" : product.GetImage(ImageSize.Size_50),
                    ReplyDate = item.ReplyDate,
                });
            });
            var model = new DataGridModel <ProductConsultationModel>()
            {
                rows = list, total = data.Total
            };

            return(Json(model));
        }
예제 #3
0
        public JsonResult GetProductsByIds(string productids)
        {
            if (string.IsNullOrWhiteSpace(productids))
            {
                throw new MallException("错误的参数");
            }

            var selproids = productids.Split(',')
                            .Where(d => !string.IsNullOrWhiteSpace(d))
                            .Select(d => long.Parse(d))
                            .ToList();

            var products = ProductManagerApplication.GetProductByIds(selproids);
            var temp     = products.Select(p => p.Id).ToList();
            var noproids = selproids.Where(p => !temp.Contains(p)).ToList();


            List <ActiveProductModel> result = products.Select(item =>
            {
                return(new ActiveProductModel()
                {
                    Name = item.ProductName,
                    Id = item.Id,
                    Image = item.GetImage(ImageSize.Size_50),
                    Price = item.MinSalePrice,
                    ProductCode = item.ProductCode,
                    IsException = noproids.Any(d => d == item.Id)
                });
            }).ToList();

            return(Json(result));
        }
예제 #4
0
        public JsonResult GetProducts(long[] ids)
        {
            var products = ProductManagerApplication.GetProductByIds(ids).ToList().Select(item => new
            {
                item.Id,
                item.ProductName,
                item.MarketPrice,
                item.MinSalePrice,
                item.SaleStatus,
                item.ImagePath
            });

            return(Json(products, true));
        }
        // GET: Web/Register
        public ActionResult Index(int pageNo = 1, int pageSize = 20)
        {
            var query = new ConsultationQuery
            {
                UserID   = CurrentUser.Id,
                PageNo   = pageNo,
                PageSize = pageSize
            };
            var model        = _iConsultationService.GetConsultations(query);
            var products     = ProductManagerApplication.GetProductByIds(model.Models.Select(p => p.ProductId));
            var consultation = model.Models.Select(item =>
            {
                var product = products.FirstOrDefault(p => p.Id == item.ProductId);
                return(new ProductConsultationModel()
                {
                    Id = item.Id,
                    ConsultationContent = item.ConsultationContent,
                    ConsultationDate = item.ConsultationDate,
                    ProductName = product.ProductName,
                    ProductPic = product.ImagePath,
                    ProductId = item.ProductId,
                    UserName = item.UserName,
                    ReplyContent = item.ReplyContent,
                    ReplyDate = item.ReplyDate,
                });
            });

            #region 分页控制
            PagingInfo info = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = model.Total
            };
            ViewBag.pageInfo = info;
            #endregion
            ViewBag.Keyword  = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords = SiteSettings.HotKeyWords;
            return(View(consultation));
        }
예제 #6
0
        public static List <ProductBrowsedHistoryModel> GetBrowsingProducts(int num, long userId = 0)
        {
            List <ProductBrowsedHistoryModel> productIdList = new List <ProductBrowsedHistoryModel>();
            string productIds = Core.Helper.WebHelper.GetCookie(CookieKeysCollection.Mall_PRODUCT_BROWSING_HISTORY);

            if (!string.IsNullOrEmpty(productIds))
            {
                var arr = productIds.Split(',');
                foreach (var a in arr)
                {
                    var item = a.Split('#');
                    if (item.Length > 1)
                    {
                        productIdList.Add(new ProductBrowsedHistoryModel()
                        {
                            ProductId = long.Parse(item[0]), BrowseTime = DateTime.Parse(item[1])
                        });
                    }
                    else
                    {
                        productIdList.Add(new ProductBrowsedHistoryModel()
                        {
                            ProductId = long.Parse(item[0]), BrowseTime = DateTime.Now
                        });
                    }
                }
            }

            var ids = productIdList.Select(p => p.ProductId).ToList();
            List <FlashSalePrice> flashSaleList = LimitTimeApplication.GetPriceByProducrIds(ids);

            List <ProductBrowsedHistoryModel> model = new List <ProductBrowsedHistoryModel>();

            if (userId == 0)
            {
                var products = ProductManagerApplication.GetProductByIds(productIdList.Select(a => a.ProductId))
                               .Where(d => d.SaleStatus == Entities.ProductInfo.ProductSaleStatus.OnSale &&
                                      d.AuditStatus == Entities.ProductInfo.ProductAuditStatus.Audited).ToArray()
                               .Select(a => new ProductBrowsedHistoryModel()
                {
                    ImagePath    = Core.MallIO.GetProductSizeImage(a.RelativePath, 1, (int)ImageSize.Size_100),
                    ProductId    = a.Id,
                    ProductName  = a.ProductName,
                    ProductPrice = GetRealPrice(flashSaleList, a.Id, a.MinSalePrice),
                    ShopId       = a.ShopId
                }).ToList();


                return(products.OrderByDescending(a => a.BrowseTime).ToList());
            }
            else
            {
                foreach (var m in productIdList)
                {
                    AddBrowsingProduct(m.ProductId, userId);
                }
                var browsing = ProductManagerApplication.GetBrowsingProducts(userId);
                var products = ProductManagerApplication.GetOnSaleProducts(browsing.Select(p => p.ProductId).ToList());
                browsing = browsing.Where(p => products.Select(o => o.Id).Contains(p.ProductId)).ToList();
                model    =
                    browsing.OrderByDescending(a => a.BrowseTime).Take(num)
                    .Select(a => {
                    var product = products.FirstOrDefault(p => p.Id == a.ProductId);
                    return(new ProductBrowsedHistoryModel()
                    {
                        ImagePath = Core.MallIO.GetProductSizeImage(product.RelativePath, 1, (int)ImageSize.Size_100),
                        ProductId = a.ProductId,
                        ProductName = product.ProductName,
                        ProductPrice = GetRealPrice(flashSaleList, a.ProductId, product.MinSalePrice),
                        BrowseTime = a.BrowseTime,
                        ShopId = product.ShopId
                    });
                }).ToList();
            }
            return(model);
        }
예제 #7
0
        public ActionResult Home()
        {
            UserCenterHomeModel viewModel = new UserCenterHomeModel();

            viewModel.userCenterModel = MemberApplication.GetUserCenterModel(CurrentUser.Id);
            viewModel.UserName        = CurrentUser.Nick == "" ? CurrentUser.UserName : CurrentUser.Nick;
            viewModel.Logo            = CurrentUser.Photo;
            var items = _iCartService.GetCart(CurrentUser.Id).Items.OrderByDescending(a => a.AddTime).Select(p => p.ProductId).Take(3).ToArray();

            viewModel.ShoppingCartItems = ProductManagerApplication.GetProductByIds(items).ToArray();
            var UnEvaluatProducts = _iCommentService.GetUnEvaluatProducts(CurrentUser.Id).ToArray();

            viewModel.UnEvaluatProductsNum  = UnEvaluatProducts.Count();
            viewModel.Top3UnEvaluatProducts = UnEvaluatProducts.Take(3).ToArray();
            viewModel.Top3RecommendProducts = _iProductService.GetPlatHotSaleProductByNearShop(8, CurrentUser.Id).ToArray();
            viewModel.BrowsingProducts      = BrowseHistrory.GetBrowsingProducts(4, CurrentUser == null ? 0 : CurrentUser.Id);

            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item => new PluginsInfo
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(_iMessageService.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, Entities.MemberContactInfo.UserTypes.General))
            });

            viewModel.BindContactInfo = data;

            var statistic = StatisticApplication.GetMemberOrderStatistic(CurrentUser.Id);

            viewModel.OrderCount            = statistic.OrderCount;
            viewModel.OrderWaitReceiving    = statistic.WaitingForRecieve;
            viewModel.OrderWaitPay          = statistic.WaitingForPay;
            viewModel.OrderEvaluationStatus = statistic.WaitingForComments;
            viewModel.Balance = MemberCapitalApplication.GetBalanceByUserId(CurrentUser.Id);
            //TODO:[YZG]增加账户安全等级
            MemberAccountSafety memberAccountSafety = new MemberAccountSafety
            {
                AccountSafetyLevel = 1
            };

            if (CurrentUser.PayPwd != null)
            {
                memberAccountSafety.PayPassword         = true;
                memberAccountSafety.AccountSafetyLevel += 1;
            }
            var ImessageService = _iMessageService;

            foreach (var messagePlugin in data)
            {
                if (messagePlugin.PluginId.IndexOf("SMS") > 0)
                {
                    if (messagePlugin.IsBind)
                    {
                        memberAccountSafety.BindPhone           = true;
                        memberAccountSafety.AccountSafetyLevel += 1;
                    }
                }
                else
                {
                    if (messagePlugin.IsBind)
                    {
                        memberAccountSafety.BindEmail           = true;
                        memberAccountSafety.AccountSafetyLevel += 1;
                    }
                }
            }
            viewModel.memberAccountSafety = memberAccountSafety;
            ViewBag.Keyword  = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords = SiteSettings.HotKeyWords;
            return(View(viewModel));
        }
예제 #8
0
        // GET: Admin/TemplateVisualizationProcess
        public ActionResult GoodsListAction()
        {
            var    data = this.ControllerContext.RouteData.Values;
            var    layout = data["Layout"];
            string ids = "";
            bool   showIco = false, showPrice = false, showName = false;
            bool   showWarp = true;
            string warpId   = "";

            if (layout != null)
            {
                ids       = data["IDs"].ToString();
                showIco   = bool.Parse(data["ShowIco"].ToString());
                showPrice = bool.Parse(data["showPrice"].ToString());
                showName  = data["showName"].ToString() == "1";
                warpId    = data["ID"].ToString();
                showWarp  = true;
            }
            else
            {
                layout    = Request["Layout"];
                ids       = Request["IDs"];
                showIco   = bool.Parse(Request["ShowIco"]);
                showPrice = bool.Parse(Request["showPrice"]);
                showName  = Request["showName"] == "1";
                if (!string.IsNullOrWhiteSpace(Request["showWarp"]))
                {
                    showWarp = bool.Parse(Request["showWarp"]);
                }
            }
            var name = "~/Views/Shared/GoodGroup" + layout + ".cshtml";
            ProductAjaxModel model = new ProductAjaxModel()
            {
                list = new List <ProductContent>()
            };

            model.showIco   = showIco;
            model.showPrice = showPrice;
            model.showName  = showName;
            model.showWarp  = showWarp;
            model.warpId    = warpId;
            var         productSaleCountOnOff = SiteSettingApplication.SiteSettings.ProductSaleCountOnOff == 1;
            List <long> idArray = new List <long>();

            idArray = ids.Split(',').Where(d => !string.IsNullOrWhiteSpace(d)).Select(d => long.Parse(d)).ToList();
            if (idArray != null && idArray.Count > 0)
            {
                var products = ProductManagerApplication.GetProductByIds(idArray);
                model.list = new List <ProductContent>();
                var     selfshop = _iShopService.GetSelfShop();
                decimal discount = 1m;
                if (CurrentUser != null)
                {
                    discount = CurrentUser.MemberDiscount;
                }
                foreach (var id in idArray)
                {
                    Entities.ProductInfo d = products.FirstOrDefault(p => p.Id == id);
                    if (null == d)
                    {
                        continue;
                    }
                    decimal minprice = d.MinSalePrice;
                    if (selfshop != null && d.ShopId == selfshop.Id)
                    {
                        minprice = d.MinSalePrice * discount;
                    }
                    var _tmp = new ProductContent
                    {
                        product_id            = d.Id,
                        link                  = "/m-wap/Product/Detail/" + d.Id.ToString(),
                        price                 = minprice.ToString("f2"),
                        original_price        = d.MarketPrice.ToString("f2"),
                        pic                   = Core.HimallIO.GetProductSizeImage(d.RelativePath, 1, (int)ImageSize.Size_350),
                        title                 = d.ProductName,
                        is_limitbuy           = _iProductService.IsLimitBuy(d.Id),
                        SaleCounts            = d.SaleCounts + (int)d.VirtualSaleCounts,
                        ProductSaleCountOnOff = productSaleCountOnOff,
                        productType           = d.ProductType
                    };
                    model.list.Add(_tmp);
                }
            }
            return(PartialView(name, model));
        }
예제 #9
0
        public ActionResult Detail(long id)
        {
            var order      = _iOrderService.GetOrder(id, CurrentUser.Id);//限制到用户
            var orderItems = _iOrderService.GetOrderItemsByOrderId(order.Id);
            //补充商品货号
            var proids      = orderItems.Select(d => d.ProductId);
            var procodelist = ProductManagerApplication.GetProductByIds(proids).Select(d => new { d.Id, d.ProductCode, d.FreightTemplateId }).ToList();

            foreach (var item in orderItems)
            {
                var _tmp = procodelist.Find(d => d.Id == item.ProductId);
                if (_tmp != null)
                {
                    item.ProductCode = _tmp.ProductCode;
                    item.FreightId   = _tmp.FreightTemplateId;
                }
            }
            var service = ServiceApplication.Create <Mall.IServices.IProductService>();
            //  string RegionIdPath = regionService.GetRegionPath(order.RegionId);
            var freightProductGroup = orderItems.GroupBy(a => a.FreightId);

            if (order.DeliveryType != CommonModel.DeliveryType.SelfTake)
            {
                var regionService = ServiceApplication.Create <Mall.IServices.IRegionService>();
                var region        = regionService.GetRegion(order.RegionId);
                int cityId        = 0;
                if (region != null)
                {
                    cityId = region.Id;
                }
                //foreach (var f in freightProductGroup)
                //{
                //    var productIds = f.Select(a => a.ProductId);
                //    var counts = f.Select(a => Convert.ToInt32(a.Quantity));
                //    decimal freight = service.GetFreight(productIds, counts, cityId);

                //    foreach (var item in f)
                //    {
                //        item.Freight = freight;
                //    }
                //}
            }

            ViewBag.freightProductGroup = freightProductGroup;

            ViewBag.Coupon = 0;
            var coupon = _iCouponService.GetCouponRecordInfo(order.UserId, order.Id);
            var bonus  = _iShopBonusService.GetUsedPrice(order.Id, order.UserId);

            if (coupon != null)
            {
                ViewBag.Coupon = CouponApplication.GetCouponInfo(coupon.CouponId).Price;
            }
            else if (bonus > 0)
            {
                ViewBag.Coupon = bonus;
            }

            if (order.OrderType == Entities.OrderInfo.OrderTypes.FightGroup)
            {
                var fgord = _iFightGroupService.GetFightGroupOrderStatusByOrderId(order.Id);
                order.FightGroupOrderJoinStatus = fgord.GetJoinStatus;
                order.FightGroupCanRefund       = fgord.CanRefund;
            }
            //使用OrderListModel
            //   AutoMapper.Mapper.CreateMap<OrderInfo, OrderListModel>();
            // AutoMapper.Mapper.CreateMap<OrderItemInfo, OrderItemListModel>();
            var orderModel = order.Map <OrderListModel>();

            orderModel.OrderItemList = orderItems.Map <IEnumerable <OrderItemListModel> >();
            if (order.ShopBranchId > 0)
            {//补充数据
                var branch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
                if (branch != null)
                {
                    orderModel.ShopBranchName         = branch.ShopBranchName;
                    orderModel.ShopBranchAddress      = branch.AddressFullName;
                    orderModel.ShopBranchContactPhone = branch.ContactPhone;
                }
            }
            if (order.FightGroupOrderJoinStatus.HasValue)
            {
                orderModel.FightGroupJoinStatus = order.FightGroupOrderJoinStatus.Value;
            }
            orderModel.UserRemark = order.OrderRemarks;
            ViewBag.Keyword       = SiteSettings.Keyword;
            string shipperAddress = string.Empty, shipperTelPhone = string.Empty;

            #region 虚拟订单
            if (order.OrderType == OrderInfo.OrderTypes.Virtual)
            {
                orderModel.OrderVerificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>()
                {
                    order.Id
                });
                orderModel.OrderVerificationCodes.ForEach(a =>
                {
                    a.QRCode = GetQRCode(a.VerificationCode);
                });
                orderModel.VirtualOrderItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id);
                if (order.ShopBranchId > 0)//门店订单取门店地址
                {
                    var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
                    if (shopBranch != null)
                    {
                        shipperAddress  = RegionApplication.GetFullName(shopBranch.AddressId) + " " + shopBranch.AddressDetail;
                        shipperTelPhone = shopBranch.ContactPhone;
                    }
                }
                else
                {
                    var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(order.ShopId);
                    if (verificationShipper != null)
                    {
                        shipperAddress  = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address;
                        shipperTelPhone = verificationShipper.TelPhone;
                    }
                }
            }
            ViewBag.ShipperAddress  = shipperAddress;
            ViewBag.ShipperTelPhone = shipperTelPhone;
            #endregion
            orderModel.PaymentTypeName = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName;
            //发票信息
            orderModel.OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id);
            return(View(orderModel));
        }