Exemplo n.º 1
0
        public ActionResult Detail(long id)
        {
            OrderInfo       order          = ServiceHelper.Create <IOrderService>().GetOrder(id, base.CurrentUser.Id);
            IShopService    shopService    = ServiceHelper.Create <IShopService>();
            IProductService productService = ServiceHelper.Create <IProductService>();
            OrderDetail     orderDetail    = new OrderDetail()
            {
                ShopName   = shopService.GetShop(order.ShopId, false).ShopName,
                ShopId     = order.ShopId,
                OrderItems =
                    from item in order.OrderItemInfo
                    select new OrderItem()
                {
                    ProductId    = item.ProductId,
                    ProductName  = item.ProductName,
                    Count        = item.Quantity,
                    Price        = item.SalePrice,
                    ProductImage = productService.GetProduct(item.ProductId).GetImage(ProductInfo.ImageSize.Size_100, 1)
                }
            };

            ViewBag.Detail = orderDetail;
            ViewBag.Bonus  = (dynamic)null;
            if (base.PlatformType == ChemCloud.Core.PlatformType.WeiXin)
            {
                IShopBonusService  shopBonusService = ServiceHelper.Create <IShopBonusService>();
                ShopBonusGrantInfo grantByUserOrder = shopBonusService.GetGrantByUserOrder(id, base.CurrentUser.Id);

                if (grantByUserOrder != null)
                {
                    ViewBag.Bonus = grantByUserOrder;
                    dynamic  viewBag = base.ViewBag;
                    object[] host    = new object[] { "http://", base.Request.Url.Host, "/m-weixin/shopbonus/index/", shopBonusService.GetGrantIdByOrderId(id) };
                    viewBag.ShareHref = string.Concat(host);
                }
            }
            ViewBag.Logo = base.CurrentSiteSetting.Logo;
            return(View(order));
        }
 public static long GetGrantIdByOrderId(long orderid)
 {
     return(_iShopBonusService.GetGrantIdByOrderId(orderid));
 }