// 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));
        }
        // 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));
        }
        // 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());
        }
Beispiel #4
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>("该订单不存在或者已评论过")));
            }
        }