Example #1
0
        public object GetComment(long orderId)
        {
            CheckUserLogin();
            var order = ServiceProvider.Instance <IOrderService> .Create.GetOrder(orderId);

            var comments = OrderApplication.GetOrderComment(orderId);

            if (order != null && comments.Count == 0)
            {
                var model = ServiceProvider.Instance <ICommentService> .Create.GetProductEvaluationByOrderId(orderId, CurrentUser.Id).Select(item => new
                {
                    item.ProductId,
                    item.ProductName,
                    Image = Core.MallIO.GetRomoteProductSizeImage(item.ThumbnailsUrl, 1, (int)Mall.CommonModel.ImageSize.Size_220) //商城App评论时获取商品图片
                });

                var orderEvaluation = ServiceProvider.Instance <ITradeCommentService> .Create.GetOrderCommentInfo(orderId, CurrentUser.Id);

                var orderitems = OrderApplication.GetOrderItems(order.Id);
                var isVirtual  = order.OrderType == Mall.Entities.OrderInfo.OrderTypes.Virtual ? 1 : 0;
                return(new { success = true, Product = model, orderItemIds = orderitems.Select(item => item.Id), isVirtual = isVirtual });
            }
            else
            {
                throw new MallApiException("该订单不存在或者已评论过");
            }
        }
Example #2
0
        /// <summary>
        /// 根据订单ID获取评价
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetComment(long orderId)
        {
            CheckUserLogin();
            var order   = OrderApplication.GetOrderInfo(orderId);
            var comment = OrderApplication.GetOrderCommentCount(order.Id);

            if (order != null && comment == 0)
            {
                var model = CommentApplication.GetProductEvaluationByOrderId(orderId, CurrentUser.Id).Select(item => new
                {
                    ProductId   = item.ProductId,
                    ProductName = item.ProductName,
                    Image       = Core.HimallIO.GetRomoteProductSizeImage(item.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_220) //商城App评论时获取商品图片
                });
                var orderitems      = OrderApplication.GetOrderItems(order.Id);
                var orderEvaluation = TradeCommentApplication.GetOrderCommentInfo(orderId, CurrentUser.Id);
                var isVirtual       = order.OrderType == Himall.Entities.OrderInfo.OrderTypes.Virtual ? 1 : 0;
                return(JsonResult <dynamic>(new { Product = model, orderItemIds = orderitems.Select(item => item.Id), isVirtual = isVirtual }));
            }
            else
            {
                return(Json(ErrorResult <dynamic>("该订单不存在或者已评论过")));
            }
        }
Example #3
0
        /// <summary>
        /// 显示售后记录
        /// </summary>
        /// <param name="applyDate"></param>
        /// <param name="status"></param>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="showtype">0 所有 1 订单退款 2 仅退款(包含订单退款) 3 退货 4 仅退款</param>
        /// <returns></returns>
        public ActionResult List(string applyDate, int?status, int pageNo = 1, int pageSize = 10, int showtype = 0)
        {
            DateTime?startDate = null;
            DateTime?endDate   = null;

            if (!string.IsNullOrEmpty(applyDate) && applyDate.ToLower() != "all")
            {
                switch (applyDate.ToLower())
                {
                case "threemonth":
                    startDate = DateTime.Now.AddMonths(-3);
                    break;

                case "threemonthago":
                    endDate = DateTime.Now.AddMonths(-3);
                    break;
                }
            }
            if (status.HasValue)
            {
                if (status == 0)
                {
                    status = null;
                }
            }

            var queryModel = new RefundQuery()
            {
                StartDate      = startDate,
                EndDate        = endDate,
                UserId         = CurrentUser.Id,
                PageSize       = pageSize,
                PageNo         = pageNo,
                ShowRefundType = showtype,
                IsOngoing      = true//取正在进行中的售后
            };

            if (showtype > 0)
            {
                queryModel.IsOngoing = false;
            }

            if (status.HasValue)
            {
                if (status > (int)OrderRefundInfo.OrderRefundAuditStatus.Audited)
                {
                    queryModel.AuditStatus   = OrderRefundInfo.OrderRefundAuditStatus.Audited;
                    queryModel.ConfirmStatus = (Entities.OrderRefundInfo.OrderRefundConfirmStatus)status;
                }
                else
                {
                    queryModel.AuditStatus = (Entities.OrderRefundInfo.OrderRefundAuditStatus)status;
                }
            }

            var refunds = _iRefundService.GetOrderRefunds(queryModel);
            var orders  = OrderApplication.GetOrders(refunds.Models.Select(p => p.OrderId));

            var        orderitems = OrderApplication.GetOrderItems(refunds.Models.Select(p => p.OrderItemId));
            PagingInfo info       = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = refunds.Total
            };

            ViewBag.pageInfo   = info;
            ViewBag.UserId     = CurrentUser.Id;
            ViewBag.ShowType   = showtype;
            ViewBag.ApplyDate  = applyDate;
            ViewBag.Status     = status;
            ViewBag.Orders     = orders;
            ViewBag.Keyword    = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords   = SiteSettings.HotKeyWords;
            ViewBag.OrderItems = orderitems;
            return(View(refunds.Models));
        }
        public JsonResult List(DateTime?startDate, DateTime?endDate, long?orderId, int?auditStatus, string shopName, string ProductName, string userName, int page, int rows, int showtype = 0)
        {
            var queryModel = new RefundQuery()
            {
                StartDate      = startDate,
                EndDate        = endDate,
                OrderId        = orderId,
                ProductName    = ProductName,
                AuditStatus    = (Entities.OrderRefundInfo.OrderRefundAuditStatus?)auditStatus,
                ShopName       = shopName,
                UserName       = userName,
                PageSize       = rows,
                PageNo         = page,
                ShowRefundType = showtype
            };

            if (auditStatus.HasValue && auditStatus.Value == (int)OrderRefundInfo.OrderRefundAuditStatus.Audited)
            {
                queryModel.ConfirmStatus = Entities.OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm;
            }

            var refunds      = _iRefundService.GetOrderRefunds(queryModel);
            var orders       = OrderApplication.GetOrders(refunds.Models.Select(p => p.OrderId));
            var orderitems   = OrderApplication.GetOrderItems(refunds.Models.Select(p => p.OrderItemId));
            var refundModels = refunds.Models.Select(item =>
            {
                var order     = orders.FirstOrDefault(p => p.Id == item.OrderId);
                var orderitem = orderitems.FirstOrDefault(p => p.Id == item.OrderItemId);
                string spec   = ((string.IsNullOrWhiteSpace(orderitem.Color) ? "" : orderitem.Color + ",")
                                 + (string.IsNullOrWhiteSpace(orderitem.Size) ? "" : orderitem.Size + ",")
                                 + (string.IsNullOrWhiteSpace(orderitem.Version) ? "" : orderitem.Version + ",")).TrimEnd(',');
                if (!string.IsNullOrWhiteSpace(spec))
                {
                    spec = "  【" + spec + " 】";
                }
                string showAuditStatus = "";
                //  showAuditStatus = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? item.ManagerConfirmStatus.ToDescription() : item.SellerAuditStatus.ToDescription();

                showAuditStatus = ((item.SellerAuditStatus == Entities.OrderRefundInfo.OrderRefundAuditStatus.Audited)
                                    ? item.ManagerConfirmStatus.ToDescription()
                                    : (order.DeliveryType == CommonModel.DeliveryType.SelfTake ? ((CommonModel.Enum.OrderRefundShopAuditStatus)item.SellerAuditStatus).ToDescription() : item.SellerAuditStatus.ToDescription()));
                if (item.SellerAuditStatus == Entities.OrderRefundInfo.OrderRefundAuditStatus.Audited &&
                    item.ManagerConfirmStatus == Entities.OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm &&
                    item.RefundPayStatus == Entities.OrderRefundInfo.OrderRefundPayStatus.Payed)
                {
                    showAuditStatus = "退款中";
                }
                var verificationCodeIds = new List <string>();
                if (!string.IsNullOrWhiteSpace(item.VerificationCodeIds))
                {
                    verificationCodeIds = item.VerificationCodeIds.Split(',').ToList();
                    verificationCodeIds = verificationCodeIds.Select(a => a = Regex.Replace(a, @"(\d{4})", "$1 ")).ToList();
                }
                return(new OrderRefundModel()
                {
                    RefundId = item.Id,
                    OrderId = item.OrderId,
                    AuditStatus = showAuditStatus,
                    ProductId = orderitem.ProductId,
                    ThumbnailsUrl = Core.HimallIO.GetProductSizeImage(orderitem.ThumbnailsUrl, 1, (int)ImageSize.Size_100),//截取图片所在目录,从而获取图片
                    ConfirmStatus = item.ManagerConfirmStatus.ToDescription(),
                    ApplyDate = item.ApplyDate.ToShortDateString(),
                    ShopId = item.ShopId,
                    ShopName = item.ShopName.Replace("'", "‘").Replace("\"", "”"),
                    UserId = item.UserId,
                    UserName = item.Applicant,
                    Amount = item.Amount.ToString("F2"),
                    SalePrice = item.EnabledRefundAmount.ToString("F2"),
                    ReturnQuantity = item.ShowReturnQuantity == 0 ? orderitem.ReturnQuantity : item.ShowReturnQuantity,
                    ProductName = orderitem.ProductName + spec,
                    Reason = string.IsNullOrEmpty(item.Reason) ? string.Empty : HTMLEncode(item.Reason.Replace("'", "‘").Replace("\"", "”")),
                    ReasonDetail = string.IsNullOrEmpty(item.ReasonDetail) ? string.Empty : item.ReasonDetail.Replace("'", "‘").Replace("\"", "”"),
                    RefundAccount = string.IsNullOrEmpty(item.RefundAccount) ? string.Empty : HTMLEncode(item.RefundAccount.Replace("'", "‘").Replace("\"", "”")),
                    ContactPerson = string.IsNullOrEmpty(item.ContactPerson) ? string.Empty : HTMLEncode(item.ContactPerson.Replace("'", "‘").Replace("\"", "”")),
                    ContactCellPhone = HTMLEncode(item.ContactCellPhone),
                    PayeeAccount = string.IsNullOrEmpty(item.PayeeAccount) ? string.Empty : HTMLEncode(item.PayeeAccount.Replace("'", "‘").Replace("\"", "”")),
                    Payee = string.IsNullOrEmpty(item.Payee) ? string.Empty : HTMLEncode(item.Payee),
                    RefundMode = (int)item.RefundMode,
                    SellerRemark = string.IsNullOrEmpty(item.SellerRemark) ? string.Empty : HTMLEncode(item.SellerRemark.Replace("'", "‘").Replace("\"", "”")),
                    ManagerRemark = string.IsNullOrEmpty(item.ManagerRemark) ? string.Empty : HTMLEncode(item.ManagerRemark.Replace("'", "‘").Replace("\"", "”")),
                    RefundStatus = ((item.SellerAuditStatus == Entities.OrderRefundInfo.OrderRefundAuditStatus.Audited)
                                    ? item.ManagerConfirmStatus.ToDescription()
                                    : ((order.DeliveryType == CommonModel.DeliveryType.SelfTake || order.ShopBranchId > 0) ? ((CommonModel.Enum.OrderRefundShopAuditStatus)item.SellerAuditStatus).ToDescription() : item.SellerAuditStatus.ToDescription())),
                    RefundPayType = item.RefundPayType.ToDescription(),
                    RefundPayStatus = (int)item.RefundPayStatus,
                    ApplyNumber = item.ApplyNumber,
                    CertPic1 = Core.HimallIO.GetImagePath(item.CertPic1),
                    CertPic2 = Core.HimallIO.GetImagePath(item.CertPic2),
                    CertPic3 = Core.HimallIO.GetImagePath(item.CertPic3),
                    IsVirtual = item.IsVirtual,
                    VerificationCodeIds = string.Join(",", verificationCodeIds),
                    RefundBatchNo = item.RefundBatchNo ?? ""
                });
            });

            DataGridModel <OrderRefundModel> dataGrid = new DataGridModel <OrderRefundModel>()
            {
                rows = refundModels, total = refunds.Total
            };

            return(Json(dataGrid));
        }
        public JsonResult List(int page, int rows, string productName, int shopid = 0, bool?isReply = null, int Rank = -1, bool hasAppend = false)
        {
            if (!string.IsNullOrEmpty(productName))
            {
                productName = productName.Trim();
            }
            var orderItemService = _iOrderService;
            var iTypeService     = _iTypeService;
            var query            = new CommentQuery()
            {
                PageNo = page, PageSize = rows, HasAppend = hasAppend, ProductName = productName, Rank = Rank, ShopID = shopid, IsReply = isReply
            };
            var result     = _iCommentService.GetComments(query);
            var orderItems = OrderApplication.GetOrderItems(result.Models.Select(a => a.SubOrderId).ToList()).ToDictionary(item => item.Id, item => item);
            var comments   = result.Models.Select(item => {
                var product = ProductManagerApplication.GetProduct(item.ProductId);
                return(new ProductCommentModel()
                {
                    CommentContent = item.ReviewContent,
                    CommentDate = item.ReviewDate,
                    ReplyContent = item.ReplyContent,
                    CommentMark = item.ReviewMark,
                    ReplyDate = item.ReplyDate,
                    AppendContent = item.AppendContent,
                    AppendDate = item.AppendDate,
                    ReplyAppendDate = item.ReplyAppendDate,
                    Id = item.Id,
                    ProductName = (product == null) ? "" : product.ProductName,
                    ProductId = item.ProductId,
                    ImagePath = orderItems[item.SubOrderId].ThumbnailsUrl,
                    UserName = item.UserName,
                    OderItemId = item.SubOrderId,
                    Color = "",
                    Version = "",
                    Size = "",
                    IsHidden = item.IsHidden
                });
            }).ToList();

            //TODO LRL 2015/08/06 从评价信息添加商品的规格信息
            foreach (var item in comments)
            {
                item.ImagePath = Core.MallIO.GetProductSizeImage(item.ImagePath, 1, 100);
                if (item.OderItemId.HasValue)
                {
                    var obj = orderItemService.GetOrderItem(item.OderItemId.Value);
                    if (obj != null)
                    {
                        item.Color   = obj.Color;
                        item.Size    = obj.Size;
                        item.Version = obj.Version;
                    }
                }
                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;
                if (productInfo != null)
                {
                    item.ColorAlias   = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : item.ColorAlias;
                    item.SizeAlias    = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : item.SizeAlias;
                    item.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : item.VersionAlias;
                }
            }
            DataGridModel <ProductCommentModel> model = new DataGridModel <ProductCommentModel>()
            {
                rows = comments, total = result.Total
            };

            return(Json(model));
        }
        public object GetOrderDetail(long id)
        {
            CheckUserLogin();
            long shopid = CurrentShopBranch.ShopId;
            long sbid   = CurrentUser.ShopBranchId;

            var ordser = ServiceProvider.Instance <IOrderService> .Create;

            Entities.OrderInfo order = ordser.GetOrder(id);
            if (order == null || order.ShopBranchId != sbid)
            {
                throw new HimallApiException("错误的订单编号");
            }
            var bonusService       = ServiceProvider.Instance <IShopBonusService> .Create;
            var orderRefundService = ServiceProvider.Instance <IRefundService> .Create;
            var shopService        = ServiceProvider.Instance <IShopService> .Create;
            var productService     = ServiceProvider.Instance <IProductService> .Create;
            var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShopByShopId(order.ShopId);

            var  orderitems = OrderApplication.GetOrderItems(order.Id);
            bool isCanApply = false;
            //获取订单商品项数据
            var orderDetail = new
            {
                ShopName   = shopService.GetShop(order.ShopId).ShopName,
                ShopId     = order.ShopId,
                OrderItems = orderitems.Select(item =>
                {
                    var productinfo = productService.GetProduct(item.ProductId);
                    if (order.OrderStatus == Entities.OrderInfo.OrderOperateStatus.WaitDelivery)
                    {
                        isCanApply = orderRefundService.CanApplyRefund(id, item.Id);
                    }
                    else
                    {
                        isCanApply = orderRefundService.CanApplyRefund(id, item.Id, false);
                    }

                    Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetType(productinfo.TypeId);
                    string colorAlias          = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias;
                    string sizeAlias           = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias;
                    string versionAlias        = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias;
                    if (productinfo != null)
                    {
                        colorAlias   = !string.IsNullOrWhiteSpace(productinfo.ColorAlias) ? productinfo.ColorAlias : colorAlias;
                        sizeAlias    = !string.IsNullOrWhiteSpace(productinfo.SizeAlias) ? productinfo.SizeAlias : sizeAlias;
                        versionAlias = !string.IsNullOrWhiteSpace(productinfo.VersionAlias) ? productinfo.VersionAlias : versionAlias;
                    }
                    return(new
                    {
                        ItemId = item.Id,
                        ProductId = item.ProductId,
                        ProductName = item.ProductName,
                        Count = item.Quantity,
                        Price = item.SalePrice,
                        //ProductImage = "http://" + Url.Request.RequestUri.Host + productService.GetProduct(item.ProductId).GetImage(ProductInfo.ImageSize.Size_100),
                        ProductImage = Core.HimallIO.GetRomoteProductSizeImage(productService.GetProduct(item.ProductId).RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_100),
                        color = item.Color,
                        size = item.Size,
                        version = item.Version,
                        IsCanRefund = isCanApply,
                        ColorAlias = colorAlias,
                        SizeAlias = sizeAlias,
                        VersionAlias = versionAlias
                    });
                })
            };

            VirtualProductInfo virtualProductInfo = null;
            List <dynamic>     codes = null;
            List <dynamic>     virtualItems = null;
            int validityType = 0; string startDate = string.Empty, endDate = string.Empty;

            if (order.OrderType == OrderInfo.OrderTypes.Virtual && orderDetail.OrderItems != null)
            {
                virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderDetail.OrderItems.FirstOrDefault().ProductId);
                if (virtualProductInfo != null)
                {
                    validityType = virtualProductInfo.ValidityType ? 1 : 0;
                    if (validityType == 1)
                    {
                        startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd");
                        endDate   = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd");
                    }
                }
                var verificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>()
                {
                    order.Id
                });
                if (verificationCodes != null)
                {
                    verificationCodes.ForEach(a =>
                    {
                        if (a.Status == OrderInfo.VerificationCodeStatus.WaitVerification || a.Status == OrderInfo.VerificationCodeStatus.Refund)
                        {
                            a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, "(\\d{4})\\d{4}(\\d{4})", "$1****$2");
                        }
                        a.VerificationCode = System.Text.RegularExpressions.Regex.Replace(a.VerificationCode, @"(\d{4})", "$1 ");
                    });
                }
                codes = verificationCodes.Select(p =>
                {
                    return(new
                    {
                        VerificationCode = p.VerificationCode,
                        Status = p.Status,
                        StatusText = p.Status.ToDescription()
                    });
                }).ToList <dynamic>();

                var virtualOrderItems = OrderApplication.GetVirtualOrderItemInfosByOrderId(order.Id);
                virtualItems = virtualOrderItems.Select(p =>
                {
                    return(new
                    {
                        VirtualProductItemName = p.VirtualProductItemName,
                        VirtualProductItemType = p.VirtualProductItemType,
                        Content = ReplaceImage(p.Content, p.VirtualProductItemType)
                    });
                }).ToList <dynamic>();
            }
            var orderModel = new
            {
                Id                 = order.Id,
                OrderType          = order.OrderType,
                OrderTypeName      = order.OrderType.ToDescription(),
                Status             = order.OrderStatus.ToDescription(),
                ShipTo             = order.ShipTo,
                Phone              = order.CellPhone,
                Address            = order.RegionFullName + " " + order.Address,
                HasExpressStatus   = !string.IsNullOrWhiteSpace(order.ShipOrderNumber),
                ExpressCompanyName = order.ExpressCompanyName,
                Freight            = order.Freight,
                Tax                = order.Tax,
                IntegralDiscount   = order.IntegralDiscount,
                RealTotalAmount    = order.OrderTotalAmount - order.RefundTotalAmount,
                CapitalAmount      = order.CapitalAmount,
                RefundTotalAmount  = order.RefundTotalAmount,
                ProductTotalAmount = order.ProductTotalAmount,
                OrderDate          = order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"),
                ShopName           = order.ShopName,
                ShopBranchName     = CurrentShopBranch.ShopBranchName,
                VShopId            = vshop == null ? 0 : vshop.Id,
                commentCount       = OrderApplication.GetOrderCommentCount(order.Id),
                ShopId             = order.ShopId,
                orderStatus        = (int)order.OrderStatus,
                //Invoice = order.InvoiceType.ToDescription(),
                //InvoiceValue = (int)order.InvoiceType,
                //InvoiceContext = order.InvoiceContext,
                //InvoiceTitle = order.InvoiceTitle,
                PaymentType      = order.PaymentType.ToDescription(),
                PaymentTypeValue = (int)order.PaymentType,
                PaymentTypeDesc  = order.PaymentTypeDesc,
                OrderPayAmount   = order.OrderPayAmount,
                PaymentTypeName  = PaymentApplication.GetPaymentTypeDescById(order.PaymentTypeGateway) ?? order.PaymentTypeName,
                FullDiscount     = order.FullDiscount,
                DiscountAmount   = order.DiscountAmount,
                OrderRemarks     = order.OrderRemarks,
                DeliveryType     = order.DeliveryType,
                //InvoiceCode = order.InvoiceCode,
                OrderInvoice = OrderApplication.GetOrderInvoiceInfo(order.Id)
            };

            return(new { success = true, Order = orderModel, OrderItem = orderDetail.OrderItems, VerificationCodes = codes, VirtualOrderItems = virtualItems, StartDate = startDate, EndDate = endDate, ValidityType = validityType });
        }
        /// <summary>
        /// 获取退款/售后列表
        /// </summary>
        /// <param name="pageNo">页码</param>
        /// <param name="pageSize">每页数量</param>
        /// <returns></returns>
        public object GetRefundList(int pageNo, int pageSize)
        {
            CheckUserLogin();
            var orderser  = ServiceProvider.Instance <IOrderService> .Create;
            var refundser = ServiceProvider.Instance <IRefundService> .Create;
            var vshopser  = ServiceProvider.Instance <IVShopService> .Create;

            DateTime?startDate  = null;
            DateTime?endDate    = null;
            var      queryModel = new RefundQuery()
            {
                StartDate      = startDate,
                EndDate        = endDate,
                UserId         = CurrentUser.Id,
                PageSize       = pageSize,
                PageNo         = pageNo,
                ShowRefundType = 0
            };
            var refunds = refundser.GetOrderRefunds(queryModel);
            var list    = refunds.Models.Select(item =>
            {
                var vshop = vshopser.GetVShopByShopId(item.ShopId) ?? new VShopInfo()
                {
                    Id = 0
                };
                var order     = orderser.GetOrder(item.OrderId, CurrentUser.Id);
                var orderItem = OrderApplication.GetOrderItem(item.OrderItemId);
                var status    = item.RefundStatus;
                if (order != null && order.ShopBranchId > 0)
                {
                    if (!string.IsNullOrWhiteSpace(status))
                    {
                        status = status.Replace("商家", "门店");
                    }
                }

                IEnumerable <Entities.OrderItemInfo> orderItems = null;
                if (item.RefundMode == Entities.OrderRefundInfo.OrderRefundMode.OrderRefund)
                {
                    var cOrder = orderser.GetOrder(item.OrderId, CurrentUser.Id);
                    orderItems = OrderApplication.GetOrderItems(cOrder.Id);
                }
                var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
                var branchName = shopBranch == null ? "" : shopBranch.ShopBranchName;
                return(new
                {
                    ShopName = item.ShopName,
                    Vshopid = vshop.Id,
                    ShopBranchId = order.ShopBranchId,
                    ShopBranchName = branchName,
                    RefundStatus = status,
                    Id = item.Id,
                    ProductName = orderItem.ProductName,
                    ColorAlias = orderItem.ColorAlias,
                    Color = orderItem.Color,
                    SizeAlias = orderItem.SizeAlias,
                    Size = orderItem.Size,
                    VersionAlias = orderItem.VersionAlias,
                    Version = orderItem.Version,
                    EnabledRefundAmount = item.EnabledRefundAmount,
                    Amount = item.Amount,
                    Img = Core.HimallIO.GetRomoteProductSizeImage(orderItem.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_350),
                    ShopId = item.ShopId,
                    RefundMode = item.RefundMode.ToDescription(),
                    RefundModeValue = (int)item.RefundMode,
                    OrderId = item.OrderId,
                    OrderTotal = order.OrderTotalAmount.ToString("f2"),
                    OrderItems = orderItems != null ? orderItems.Select(e => new
                    {
                        ThumbnailsUrl = Core.HimallIO.GetRomoteProductSizeImage(e.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_350),
                        ProductName = e.ProductName,
                        ColorAlias = e.ColorAlias,
                        Color = e.Color,
                        SizeAlias = e.SizeAlias,
                        Size = e.Size,
                        VersionAlias = e.VersionAlias,
                        Version = e.Version
                    }) : null,
                    SellerAuditStatus = item.SellerAuditStatus.ToDescription(),
                    SellerAuditStatusValue = (int)item.SellerAuditStatus,
                });
            });

            return(new { total = refunds.Total, data = list, success = true });
        }
        /// <summary>
        /// 获取申请售后的信息
        /// </summary>
        /// <param name="id">订单ID</param>
        /// <param name="itemId">子订单ID</param>
        /// <returns></returns>
        public object GetOrderRefundModel(long id, long?itemId = null, long?refundId = null)
        {
            CheckUserLogin();
            try
            {
                dynamic d         = new System.Dynamic.ExpandoObject();
                var     ordser    = ServiceProvider.Instance <IOrderService> .Create;
                var     refundser = ServiceProvider.Instance <IRefundService> .Create;

                var order = ordser.GetOrder(id, CurrentUser.Id);
                if (order == null)
                {
                    throw new Himall.Core.HimallException("该订单已删除或不属于该用户");
                }
                if (order.OrderType != OrderInfo.OrderTypes.Virtual && (int)order.OrderStatus < 2)
                {
                    throw new Himall.Core.HimallException("错误的售后申请,订单状态有误");
                }
                if (order.OrderType != OrderInfo.OrderTypes.Virtual && itemId == null && order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitDelivery && order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitSelfPickUp)
                {
                    throw new Himall.Core.HimallException("错误的订单退款申请,订单状态有误");
                }

                if (order.OrderType == OrderInfo.OrderTypes.Virtual)
                {
                    //如果为虚拟商品,则要判断该商品是否允许退款,且该订单中是否至少有一个待核销的核销码
                    var orderItemInfo = OrderApplication.GetOrderItemsByOrderId(order.Id).FirstOrDefault();
                    if (orderItemInfo != null)
                    {
                        itemId = orderItemInfo.Id;
                        var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(orderItemInfo.ProductId);
                        if (virtualProductInfo != null)
                        {
                            if (virtualProductInfo.SupportRefundType == 3)
                            {
                                return(new { success = false, msg = "该商品不支持退款" });
                            }
                            if (virtualProductInfo.SupportRefundType == 1 && DateTime.Now > virtualProductInfo.EndDate.Value)
                            {
                                return(new { success = false, msg = "该商品不支持过期退款" });
                            }
                            var orderVerificationCodes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>()
                            {
                                order.Id
                            });
                            long num = orderVerificationCodes.Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification).Count();
                            if (num == 0)
                            {
                                return(new { success = false, msg = "该商品没有可退的核销码" });
                            }
                            int validityType = 0; string startDate = string.Empty, endDate = string.Empty;
                            validityType = virtualProductInfo.ValidityType ? 1 : 0;
                            if (validityType == 1)
                            {
                                startDate = virtualProductInfo.StartDate.Value.ToString("yyyy-MM-dd");
                                endDate   = virtualProductInfo.EndDate.Value.ToString("yyyy-MM-dd");
                            }
                            d.ValidityType = validityType;
                            d.StartDate    = startDate;
                            d.EndDate      = endDate;
                        }
                    }
                }


                //计算可退金额 预留
                ordser.CalculateOrderItemRefund(id);
                var orderitems = OrderApplication.GetOrderItems(order.Id);
                OrderRefundModel refundModel = new OrderRefundModel();
                var item = new OrderItemInfo();
                refundModel.MaxRGDNumber    = 0;
                refundModel.MaxRefundAmount = order.OrderEnabledRefundAmount;
                if (itemId == null)
                {
                    item = orderitems.FirstOrDefault();
                }
                else
                {
                    item = orderitems.Where(a => a.Id == itemId).FirstOrDefault();
                    refundModel.MaxRGDNumber    = item.Quantity - item.ReturnQuantity;
                    refundModel.MaxRefundAmount = (decimal)(item.EnabledRefundAmount - item.RefundPrice);
                }
                if (order.OrderType == OrderInfo.OrderTypes.Virtual)
                {
                    var count = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>()
                    {
                        order.Id
                    }).Where(a => a.Status != OrderInfo.VerificationCodeStatus.WaitVerification).ToList().Count;
                    if (item.EnabledRefundAmount.HasValue)
                    {
                        decimal price = item.EnabledRefundAmount.Value / item.Quantity;
                        refundModel.MaxRefundAmount = item.EnabledRefundAmount.Value - Math.Round(count * price, 2, MidpointRounding.AwayFromZero);
                    }
                }
                bool isCanApply = false;
                if (refundModel.MaxRefundAmount <= 0)
                {
                    return(new { success = false, msg = "此为优惠券全额抵扣订单不支持退款" });
                }
                if (order.OrderStatus == OrderInfo.OrderOperateStatus.WaitDelivery)
                {
                    isCanApply = refundser.CanApplyRefund(id, item.Id);
                }
                else
                {
                    isCanApply = refundser.CanApplyRefund(id, item.Id, false);
                }

                if (!refundId.HasValue)
                {
                    if (!isCanApply)
                    {
                        throw new Himall.Core.HimallException("您已申请过售后,不可重复申请");
                    }
                    d.ContactPerson    = string.IsNullOrEmpty(order.ShipTo) ? CurrentUser.RealName : order.ShipTo;
                    d.ContactCellPhone = string.IsNullOrEmpty(order.CellPhone) ? CurrentUser.CellPhone : order.CellPhone;
                    d.OrderItemId      = itemId;
                    d.RefundType       = 0;
                    d.IsRefundOrder    = false;
                    if (!itemId.HasValue)
                    {
                        d.IsRefundOrder = true;
                        d.RefundType    = 1;
                    }
                    var reasonlist = refundser.GetRefundReasons();
                    d.Id               = order.Id;
                    d.MaxRGDNumber     = refundModel.MaxRGDNumber;
                    d.MaxRefundAmount  = refundModel.MaxRefundAmount;
                    d.OrderStatus      = order.OrderStatus.ToDescription();
                    d.OrderStatusValue = (int)order.OrderStatus;
                    d.BackOut          = false;
                    d.RefundReasons    = reasonlist;
                    if (order.CanBackOut())
                    {
                        d.BackOut = true;
                    }
                }
                else
                {
                    var refunddata = refundser.GetOrderRefund(refundId.Value, CurrentUser.Id);
                    if (refunddata == null)
                    {
                        throw new Himall.Core.HimallException("错误的售后数据");
                    }
                    if (order.OrderType != OrderInfo.OrderTypes.Virtual && refunddata.SellerAuditStatus != Entities.OrderRefundInfo.OrderRefundAuditStatus.UnAudit)
                    {
                        throw new Himall.Core.HimallException("错误的售后状态,不可激活");
                    }
                    d.ContactPerson    = refunddata.ContactPerson;
                    d.ContactCellPhone = refunddata.ContactCellPhone;
                    d.OrderItemId      = refunddata.OrderItemId;
                    d.IsRefundOrder    = (refunddata.RefundMode == Entities.OrderRefundInfo.OrderRefundMode.OrderRefund);
                    d.RefundType       = (refunddata.RefundMode == Entities.OrderRefundInfo.OrderRefundMode.OrderRefund ? 1 : 0);
                    var reasonlist = refundser.GetRefundReasons();
                    d.RefundReasons    = reasonlist; //理由List
                    d.Id               = id;
                    d.MaxRGDNumber     = refundModel.MaxRGDNumber;
                    d.MaxRefundAmount  = refundModel.MaxRefundAmount;
                    d.OrderStatus      = order.OrderStatus.ToDescription();
                    d.OrderStatusValue = (int)order.OrderStatus;
                    d.BackOut          = false;
                    d.ReasonDetail     = refunddata.ReasonDetail;
                    d.CertPic1         = Himall.Core.HimallIO.GetRomoteImagePath(refunddata.CertPic1);
                    d.CertPic2         = Himall.Core.HimallIO.GetRomoteImagePath(refunddata.CertPic2);
                    d.CertPic3         = Himall.Core.HimallIO.GetRomoteImagePath(refunddata.CertPic3);
                    if (order.CanBackOut())
                    {
                        d.BackOut = true;
                    }
                }

                if (!d.IsRefundOrder && item.EnabledRefundAmount.HasValue)
                {
                    d.RefundGoodsPrice = item.EnabledRefundAmount.Value / item.Quantity;
                }
                d.DeliveryType = order.DeliveryType;
                if (order.DeliveryType == CommonModel.DeliveryType.SelfTake)
                {
                    var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
                    d.ReturnGoodsAddress  = RegionApplication.GetFullName(shopBranch.AddressId);
                    d.ReturnGoodsAddress += " " + shopBranch.AddressDetail;
                    d.ReturnGoodsAddress += " " + shopBranch.ContactPhone;
                }

                d.IsVirtual = order.OrderType == OrderInfo.OrderTypes.Virtual ? 1 : 0;
                if (order.OrderType == OrderInfo.OrderTypes.Virtual)
                {
                    var codes = OrderApplication.GetOrderVerificationCodeInfosByOrderIds(new List <long>()
                    {
                        order.Id
                    }).Where(a => a.Status == OrderInfo.VerificationCodeStatus.WaitVerification).ToList();
                    d.OrderVerificationCode = codes.Select(a => a.VerificationCode).Select(p => p = Regex.Replace(p, @"(\d{4})", "$1 "));
                }

                return(new { success = true, RefundMode = d });
            }
            catch (HimallException himallex)
            {
                return(ErrorResult(himallex.Message));
            }
            catch (Exception ex)
            {
                return(ErrorResult("系统异常:" + ex.Message));
            }
        }