// GET: Web/OrderEvaluation public ActionResult Index(long id) { var model = CommentApplication.GetProductEvaluationByOrderId(id, CurrentUser.Id); var orderEvaluation = TradeCommentApplication.GetOrderComment(id, CurrentUser.Id); if (orderEvaluation != null) { ViewBag.Mark = Math.Round((orderEvaluation.PackMark + orderEvaluation.ServiceMark + orderEvaluation.DeliveryMark) / 3D); } else { ViewBag.Mark = 0; } ViewBag.OrderId = id; //检查当前产品是否产自官方自营店 ViewBag.IsSellerAdminProdcut = OrderApplication.GetOrder(id).ShopId.Equals(1L); ViewBag.Keyword = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword; ViewBag.Keywords = SiteSettings.HotKeyWords; var orderInfo = OrderApplication.GetOrder(id); if (orderInfo != null) { ViewBag.IsVirtual = orderInfo.OrderType == Himall.Entities.OrderInfo.OrderTypes.Virtual ? 1 : 0; } return(View(model)); }
public JsonResult AddOrderEvaluationAndComment(int packMark, int deliveryMark, int serviceMark, long orderId, string productCommentsJSON) { if (packMark != 0 || deliveryMark != 0 || serviceMark == 0) { var info = new DTO.OrderComment(); info.UserId = CurrentUser.Id; info.PackMark = packMark; info.DeliveryMark = deliveryMark; info.ServiceMark = serviceMark; info.OrderId = orderId; TradeCommentApplication.Add(info); } var productComments = JsonConvert.DeserializeObject <List <ProductCommentsModel> >(productCommentsJSON); var list = new List <DTO.ProductComment>(); foreach (var productComment in productComments) { var model = new ProductComment(); model.ReviewDate = DateTime.Now; model.ReviewContent = productComment.content; model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.Email = CurrentUser.Email; model.SubOrderId = productComment.subOrderId; model.ReviewMark = productComment.star; if (productComment.proimages != null && productComment.proimages.Length > 0) { model.Images = new List <ProductCommentImage>(); foreach (var img in productComment.proimages) { var p = new ProductCommentImage(); p.CommentType = 0; //0代表默认的表示评论的图片 p.CommentImage = MoveImages(img, CurrentUser.Id); model.Images.Add(p); } } list.Add(model); } var comments = CommentApplication.GetProductEvaluationByOrderIdNew(orderId, CurrentUser.Id); foreach (var item in comments) { var addComment = productComments.FirstOrDefault(e => e.subOrderId == item.Id); if (addComment != null) { return(Json(new Result() { success = false, msg = "您已进行过评价!", status = -1 })); } } CommentApplication.Add(list); return(Json(new Result() { success = true, msg = "评价成功" })); }
public JsonResult AddOrderEvaluation(DTO.OrderComment model) { model.UserId = CurrentUser.Id; TradeCommentApplication.Add(model); return(Json(new Result() { success = true, msg = "评价成功" })); }
void AddOrderComment(OrderCommentModel comment) { TradeCommentApplication.Add(new OrderComment() { OrderId = comment.OrderId, DeliveryMark = comment.DeliveryMark, ServiceMark = comment.ServiceMark, PackMark = comment.PackMark, UserId = CurrentUser.Id, }); }
void AddOrderComment(OrderCommentModel comment, int productNum) { TradeCommentApplication.Add(new DTO.OrderComment() { OrderId = comment.OrderId, DeliveryMark = comment.DeliveryMark, ServiceMark = comment.ServiceMark, PackMark = comment.PackMark, UserId = CurrentUser.Id }, productNum); }
public ActionResult Details(long orderId) { var orderComment = TradeCommentApplication.GetOrderComment(orderId, CurrentUser.Id); ViewBag.PackMark = orderComment != null ? orderComment.PackMark - 1 : -1; ViewBag.DeliveryMark = orderComment != null ? orderComment.DeliveryMark - 1 : -1; ViewBag.ServiceMark = orderComment != null ? orderComment.ServiceMark - 1 : -1; var model = CommentApplication.GetProductEvaluationByOrderIdNew(orderId, CurrentUser.Id); ViewBag.IsSellerAdminProdcut = OrderApplication.GetOrder(orderId).ShopId.Equals(1L); return(View(model)); }
public static ShopServiceMarkModel GetShopComprehensiveMark(long shopId) { var result = new ShopServiceMarkModel(); var orderComment = TradeCommentApplication.GetOrderComments(shopId); result.PackMark = orderComment.Models.Count() == 0 ? 0 : Math.Round(orderComment.Models.ToList().Average(o => ((decimal)o.PackMark + o.DeliveryMark) / 2), 2); result.ServiceMark = orderComment.Models.Count() == 0 ? 0 : Math.Round(orderComment.Models.ToList().Average(o => (decimal)o.ServiceMark), 2); result.ComprehensiveMark = Math.Round((result.PackMark + result.ServiceMark) / 2, 2); return(result); }
// GET: Web/OrderEvaluation public ActionResult Index(long id) { var model = CommentApplication.GetProductEvaluationByOrderId(id, CurrentUser.Id); var orderEvaluation = TradeCommentApplication.GetOrderComment(id, CurrentUser.Id); if (orderEvaluation != null) { ViewBag.Mark = Math.Round((orderEvaluation.PackMark + orderEvaluation.ServiceMark + orderEvaluation.DeliveryMark) / 3D); } else { ViewBag.Mark = 0; } ViewBag.OrderId = id; //检查当前产品是否产自官方自营店 ViewBag.IsSellerAdminProdcut = OrderApplication.GetOrder(id).ShopId.Equals(1L); return(View(model)); }
public ActionResult Details(long orderId) { var orderComment = TradeCommentApplication.GetOrderComment(orderId, CurrentUser.Id); ViewBag.PackMark = orderComment != null ? orderComment.PackMark - 1 : -1; ViewBag.DeliveryMark = orderComment != null ? orderComment.DeliveryMark - 1 : -1; ViewBag.ServiceMark = orderComment != null ? orderComment.ServiceMark - 1 : -1; var model = CommentApplication.GetProductEvaluationByOrderIdNew(orderId, CurrentUser.Id); var orderInfo = OrderApplication.GetOrder(orderId); bool isVirtual = false; if (orderInfo != null) { ViewBag.IsSellerAdminProdcut = orderInfo.ShopId.Equals(1L); isVirtual = orderInfo.OrderType == Entities.OrderInfo.OrderTypes.Virtual; } ViewBag.IsVirtual = isVirtual; ViewBag.Keyword = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword; ViewBag.Keywords = SiteSettings.HotKeyWords; return(View(model)); }
// GET: Mobile/Comment public ActionResult Index(long orderId) { var order = OrderApplication.GetOrder(orderId); var orderComments = OrderApplication.GetOrderCommentCount(new[] { orderId }); bool valid = false; if (order != null && (!orderComments.ContainsKey(orderId) || orderComments[orderId] == 0)) { // 订单还未被评价过,有效 valid = true; var model = CommentApplication.GetProductEvaluationByOrderId(orderId, CurrentUser.Id); var orderEvaluation = TradeCommentApplication.GetOrderComment(orderId, CurrentUser.Id); ViewBag.Products = model; var orderItems = OrderApplication.GetOrderItemsByOrderId(orderId); ViewBag.OrderItemIds = orderItems.Select(item => item.Id); } ViewBag.Valid = valid; return(View()); }
/// <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>("该订单不存在或者已评论过"))); } }