Example #1
0
        public ActionResult Index(int pageSize = 10, int pageNo = 1)
        {
            OrderQuery query = new OrderQuery();

            query.PageNo   = pageNo;
            query.PageSize = pageSize;
            query.UserId   = CurrentUser.Id;
            query.Status   = OrderInfo.OrderOperateStatus.Finish;
            var orders     = _iOrderService.GetOrders(query);
            var complaints = OrderApplication.GetOrderComplaintByOrders(orders.Models.Select(p => p.Id).ToList());
            var model      = orders.Models.Where(o => !complaints.Any(p => p.OrderId == o.Id));

            ViewBag.Complaints = complaints;
            var orderItems = _iOrderService.GetOrderItemsByOrderId(orders.Models.Select(p => p.Id));

            if (orderItems != null)
            {
                foreach (var item in orderItems)
                {
                    Entities.TypeInfo typeInfo = _iTypeService.GetTypeByProductId(item.ProductId);
                    var productInfo            = Mall.Application.ProductManagerApplication.GetProduct(item.ProductId);
                    item.ColorAlias   = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias;
                    item.SizeAlias    = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias;
                    item.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias;
                }
            }
            ViewBag.OrderItems = orderItems;
            #region 分页控制
            PagingInfo info = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = orders.Total
            };
            ViewBag.pageInfo  = info;
            ViewBag.UserPhone = CurrentUser.CellPhone;
            ViewBag.UserId    = CurrentUser.Id;
            #endregion
            ViewBag.Keyword  = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords = SiteSettings.HotKeyWords;
            return(View(model));
        }