/// <summary> /// 获取退款/退货列表 /// </summary> /// <param name="refundQuery"></param> /// <returns></returns> public static QueryPageModel <DTO.OrderRefund> GetOrderRefunds(RefundQuery refundQuery) { var data = _iRefundService.GetOrderRefunds(refundQuery); return(new QueryPageModel <DTO.OrderRefund>() { Models = data.Models.Map <List <DTO.OrderRefund> >(), Total = data.Total }); }
/// <summary> /// 显示售后记录 /// </summary> /// <param name="applyDate"></param> /// <param name="auditStatus"></param> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <param name="showtype">0 所有 1 预约单退款 2 仅退款(包含预约单退款) 3 退货 4 仅退款</param> /// <returns></returns> public JsonResult List(int pageNo = 1, int pageSize = 10) { 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 = _iRefundService.GetOrderRefunds(queryModel); var list = refunds.Models.Select(item => { var vshop = _iVShopService.GetVShopByShopId(item.ShopId) ?? new VShopInfo() { Id = 0 }; IEnumerable <OrderItemInfo> orderItems = null; bool IsSelfTake = false; var order = _iOrderService.GetOrder(item.OrderId, CurrentUser.Id); if (order.DeliveryType == CommonModel.Enum.DeliveryType.SelfTake) { IsSelfTake = true; } if (item.RefundMode == OrderRefundInfo.OrderRefundMode.OrderRefund) { orderItems = order.OrderItemInfo.ToList(); } var status = string.Empty; if (IsSelfTake || (order.ShopBranchId.HasValue && order.ShopBranchId.Value > 0))//分配门店预约单与自提预约单一致 { status = item.RefundStatus.Replace("诊所", "门店"); } return(new { ShopName = item.ShopName, Vshopid = vshop.Id, RefundStatus = string.IsNullOrEmpty(status) ? item.RefundStatus : status, Id = item.Id, ProductName = item.OrderItemInfo.ProductName, EnabledRefundAmount = item.EnabledRefundAmount, Amount = item.Amount, Img = HimallIO.GetProductSizeImage(item.OrderItemInfo.ThumbnailsUrl, 1, (int)ImageSize.Size_100), ShopId = item.ShopId, RefundMode = item.RefundMode, OrderId = item.OrderId, OrderItems = orderItems != null ? orderItems.Select(e => new { ThumbnailsUrl = HimallIO.GetProductSizeImage(e.ThumbnailsUrl, 1, (int)ImageSize.Size_100), ProductName = e.ProductName }) : null, SellerAuditStatus = item.SellerAuditStatus }); }); return(Json(new { Data = list, Success = true })); }
/// <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 ActionResult Center() { MemberCenterModel model = new MemberCenterModel(); var orders = _iOrderService.GetTopOrders(int.MaxValue, CurrentUser.Id); var setting = _iDistributionService.GetDistributionSetting(); model.CanDistribution = false; if (setting != null && setting.Enable) { model.CanDistribution = true; } //待评价 //var queryModel = new OrderQuery() //{ // Status = Model.OrderInfo.OrderOperateStatus.Finish, // UserId = CurrentUser.Id, // PageSize = int.MaxValue, // PageNo = 1, // Commented = false //}; //ViewBag.WaitingForComments = _iOrderService.GetOrders<OrderInfo>(queryModel).Total; var member = _iMemberService.GetMember(CurrentUser.Id); model.Member = member; model.AllOrders = orders.Count(); model.WaitingForRecieve = orders.Count(item => item.UserId == CurrentUser.Id && (item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitReceiving || item.OrderStatus == OrderInfo.OrderOperateStatus.WaitSelfPickUp)); //获取待收货订单数 model.WaitingForPay = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitPay); //获取待支付订单数 var waitdelordnum = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.WaitDelivery); //获取待发货订单数 var fgwaitdelordnum = _iOrderService.GetFightGroupOrderByUser(CurrentUser.Id); model.WaitingForDelivery = waitdelordnum - fgwaitdelordnum; model.WaitingForComments = orders.Count(item => item.OrderStatus == Model.OrderInfo.OrderOperateStatus.Finish && item.OrderCommentInfo.Count == 0); //拼团 model.CanFightGroup = FightGroupApplication.IsOpenMarketService(); model.BulidFightGroupNumber = FightGroupApplication.CountJoiningOrder(CurrentUser.Id); RefundQuery query = new RefundQuery() { UserId = CurrentUser.Id, PageNo = 1, PageSize = int.MaxValue }; var refundPage = _iRefundService.GetOrderRefunds(query); DateTime endsrtime = DateTime.Now.Date; if (CurrentSiteSetting.SalesReturnTimeout > 0) { endsrtime = endsrtime.AddDays(-CurrentSiteSetting.SalesReturnTimeout).Date; } model.RefundOrders = refundPage.Models.Where(e => e.ManagerConfirmStatus == OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm || (e.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.UnAudit && e.OrderItemInfo.OrderInfo.FinishDate >= endsrtime)).Count(); var capital = _iMemberCapitalService.GetCapitalInfo(CurrentUser.Id); decimal cap; if (capital != null) { cap = capital.Balance.HasValue ? capital.Balance.Value : 0; } else { cap = 0; } model.Capital = cap; var CouponsCount = _iCouponService.GetAllUserCoupon(CurrentUser.Id).Count(); CouponsCount += _iShopBonusService.GetCanUseDetailByUserId(CurrentUser.Id).Count(); model.CouponsCount = CouponsCount; var userInte = MemberIntegralApplication.GetMemberIntegral(UserId); var userGrade = MemberGradeApplication.GetMemberGradeByUserIntegral(userInte.HistoryIntegrals); model.GradeName = userGrade.GradeName; model.MemberAvailableIntegrals = userInte.AvailableIntegrals; model.CollectionShop = _iVShopService.GetUserConcernVShops(CurrentUser.Id, 1, int.MaxValue).Count(); model.CanSignIn = _iMemberSignInService.CanSignInByToday(CurrentUser.Id); model.SignInIsEnable = _iMemberSignInService.GetConfig().IsEnable; model.userMemberInfo = CurrentUser; return(View(model)); }
/// <summary> /// 显示售后记录 /// </summary> /// <param name="applyDate"></param> /// <param name="auditStatus"></param> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <param name="showtype">0 所有 1 订单退款 2 仅退款(包含订单退款) 3 退货 4 仅退款</param> /// <returns></returns> public JsonResult List(int pageNo = 1, int pageSize = 10) { 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 = _iRefundService.GetOrderRefunds(queryModel); var list = refunds.Models.Select(item => { var vshop = _iVShopService.GetVShopByShopId(item.ShopId) ?? new Entities.VShopInfo() { Id = 0 }; bool IsSelfTake = false; var order = _iOrderService.GetOrder(item.OrderId, CurrentUser.Id); if (order.DeliveryType == CommonModel.DeliveryType.SelfTake) { IsSelfTake = true; } var status = string.Empty; if (IsSelfTake || order.ShopBranchId > 0)//分配门店订单与自提订单一致 { status = item.RefundStatus.Replace("商家", "门店"); } var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); var branchName = shopBranch == null ? "" : shopBranch.ShopBranchName; var orderItem = OrderApplication.GetOrderItem(item.OrderItemId); var orderItems = new List <Entities.OrderItemInfo>(); if (item.RefundMode == OrderRefundInfo.OrderRefundMode.OrderRefund) { orderItems = _iOrderService.GetOrderItemsByOrderId(item.OrderId); } else { orderItems.Add(orderItem); } return(new { ShopName = item.ShopName, Vshopid = vshop.Id, ShopBranchId = order.ShopBranchId, ShopBranchName = branchName, RefundStatus = string.IsNullOrEmpty(status) ? item.RefundStatus : status, Id = item.Id, ProductName = orderItem.ProductName, EnabledRefundAmount = item.EnabledRefundAmount, Amount = item.Amount, Img = MallIO.GetProductSizeImage(orderItem.ThumbnailsUrl, 1, (int)ImageSize.Size_100), ShopId = item.ShopId, RefundMode = item.RefundMode, OrderId = item.OrderId, OrderTotal = order.OrderTotalAmount.ToString("f2"), OrderItems = orderItems != null ? orderItems.Select(e => new { ThumbnailsUrl = MallIO.GetProductSizeImage(e.ThumbnailsUrl, 1, (int)ImageSize.Size_100), ProductName = e.ProductName, SkuText = e.Color + " " + e.Size + " " + e.Version, }) : null, SellerAuditStatus = item.SellerAuditStatus }); }); return(SuccessResult <dynamic>(data: list)); }