public ActionResult RefundDetail(long id)
        {
            var refundinfo = _iRefundService.GetOrderRefund(id, CurrentUser.Id);

            ViewBag.RefundPayType           = refundinfo.RefundPayType.ToDescription();
            refundinfo.IsOrderRefundTimeOut = _iOrderService.IsRefundTimeOut(refundinfo.OrderId);
            var    order  = _iOrderService.GetOrder(refundinfo.OrderId, CurrentUser.Id);
            string status = refundinfo.RefundStatus;

            if (order.DeliveryType == DeliveryType.SelfTake || order.ShopBranchId > 0)
            {
                status = refundinfo.RefundStatus.Replace("商家", "门店");
            }
            var shopBranch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
            var branchName = shopBranch == null ? "" : shopBranch.ShopBranchName;

            ViewBag.OrderInfo      = order;
            ViewBag.ShopBranchId   = order.ShopBranchId;
            ViewBag.ShopBranchName = branchName;
            ViewBag.RefundStatus   = status;
            if (order.OrderType == OrderInfo.OrderTypes.Virtual)
            {
                var list = refundinfo.VerificationCodeIds.Split(',').ToList();
                if (list.Count > 0)
                {
                    list = list.Select(a => a = Regex.Replace(a, @"(\d{4})", "$1 ")).ToList();
                    ViewBag.VerificationCodeIds = list;
                }
            }
            return(View(refundinfo));
        }
        public object GetCancelDadaExpress(long orderId, int reasonId, string cancelReason)
        {
            CheckUserLogin();
            long shopid = CurrentShopBranch.ShopId;
            long sbid   = CurrentUser.ShopBranchId;
            var  order  = OrderApplication.GetOrder(orderId);

            if (order == null || order.ShopBranchId != sbid || order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitReceiving || order.DeliveryType != DeliveryType.CityExpress)
            {
                throw new HimallApiException("错误的订单编号");
            }
            if (order.DadaStatus > DadaStatus.WaitTake.GetHashCode())
            {
                throw new HimallApiException("订单配送不可取消!");
            }
            var    sbdata    = ShopBranchApplication.GetShopBranchById(sbid);
            string json      = ExpressDaDaHelper.orderFormalCancel(shopid, orderId.ToString(), reasonId, cancelReason);
            var    resultObj = JsonConvert.DeserializeObject(json) as JObject;
            string status    = resultObj["status"].ToString();

            if (status != "success")
            {
                throw new HimallApiException(resultObj["msg"].ToString());
            }
            ExpressDaDaApplication.SetOrderCancel(orderId, "商家主动取消");
            var result = JsonConvert.DeserializeObject(resultObj["result"].ToString()) as JObject;

            return(new
            {
                success = true,
                deduct_fee = result["deduct_fee"].ToString()
            });
        }
        /// <summary>
        /// 订单详细信息页面
        /// </summary>
        /// <param name="id">订单Id</param>
        public ActionResult Detail(long id)
        {
            OrderDetailView view = OrderApplication.Detail(id, UserId, PlatformType, Request.Url.Host);

            ViewBag.Detail          = view.Detail;
            ViewBag.Bonus           = view.Bonus;
            ViewBag.ShareHref       = view.ShareHref;
            ViewBag.IsRefundTimeOut = view.IsRefundTimeOut;
            ViewBag.Logo            = CurrentSiteSetting.Logo;
            view.Order.FightGroupOrderJoinStatus = view.FightGroupJoinStatus;
            view.Order.FightGroupCanRefund       = view.FightGroupCanRefund;

            var customerServices = CustomerServiceApplication.GetMobileCustomerService(view.Order.ShopId);
            var meiqia           = CustomerServiceApplication.GetPreSaleByShopId(view.Order.ShopId).FirstOrDefault(p => p.Tool == CustomerServiceInfo.ServiceTool.MeiQia);

            if (meiqia != null)
            {
                customerServices.Insert(0, meiqia);
            }
            ViewBag.CustomerServices = customerServices;
            #region 门店信息
            if (view.Order.ShopBranchId.HasValue && view.Order.ShopBranchId > 0)
            {
                ViewBag.ShopBranchInfo = ShopBranchApplication.GetShopBranchById(view.Order.ShopBranchId.Value);
            }
            #endregion
            return(View(view.Order));
        }
 public void GetPrintBroadcastShape(string userKey)
 {
     Core.Log.Info("GetPrintBroadcastShape方法的进入");
     if (CurrentShopBranch != null && IsBranchManager)//必须是门店管理员才能启动自动打印服务
     {
         _userKey = userKey;
         Core.Log.Info("GetPrintBroadcastShape" + userKey);
         var currentInfo = PrintHub.ConnectedUsers.FirstOrDefault(p => p.UserKey == userKey);
         if (currentInfo != null)
         {
             Core.Log.Info("74行代码进入");
             var shopBranchInfo = ShopBranchApplication.GetShopBranchById(CurrentShopBranch.Id);
             if (shopBranchInfo != null)
             {
                 currentInfo.IsAutoPrint = shopBranchInfo.IsAutoPrint;
                 currentInfo.PrintCount  = shopBranchInfo.PrintCount;
                 Core.Log.Info("打印状态" + currentInfo.IsAutoPrint);
             }
             currentInfo.BroadcastLoop = new Timer(
                 DoWorker,
                 null, BroadcastInterval, BroadcastInterval);
         }
         //StartAutoPrint();//登录后调用
     }
     // return Json(new { Msg = "success" });
 }
Beispiel #5
0
        /// <summary>
        /// 快递信息
        /// </summary>
        /// <param name="orderId">订单Id</param>
        public ActionResult ExpressInfo(long orderId)
        {
            var order = OrderApplication.GetOrder(orderId);

            if (order == null)
            {
                throw new HimallException("错误的订单编号");
            }
            if (order.ShopBranchId > 0)
            {
                var sbdata = ShopBranchApplication.GetShopBranchById(order.ShopBranchId);
                if (sbdata != null)
                {
                    ViewBag.StoreLat = sbdata.Latitude;
                    ViewBag.Storelng = sbdata.Longitude;
                }
            }
            else
            {
                var shopshiper = ShopShippersApplication.GetDefaultSendGoodsShipper(order.ShopId);
                if (shopshiper != null)
                {
                    ViewBag.StoreLat = shopshiper.Latitude;
                    ViewBag.Storelng = shopshiper.Longitude;
                }
            }
            return(View(order));
        }
Beispiel #6
0
        public ActionResult Detail(long id)
        {
            long?           nullable;
            OrderDetailView view = OrderApplication.Detail(id, base.UserId, base.PlatformType, base.Request.Url.Host);

            ViewBag.Detail          = view.Detail;
            ViewBag.Bonus           = view.Bonus;
            ViewBag.ShareHref       = view.ShareHref;
            ViewBag.IsRefundTimeOut = view.IsRefundTimeOut;
            ViewBag.Logo            = base.CurrentSiteSetting.Logo;
            view.Order.FightGroupOrderJoinStatus = new FightGroupOrderJoinStatus?(view.FightGroupJoinStatus);
            view.Order.FightGroupCanRefund       = new bool?(view.FightGroupCanRefund);
            List <CustomerService> mobileCustomerService = CustomerServiceApplication.GetMobileCustomerService(view.Order.ShopId);
            CustomerService        item = CustomerServiceApplication.GetPreSaleByShopId(view.Order.ShopId).FirstOrDefault <CustomerService>(p => p.Tool == CustomerServiceInfo.ServiceTool.MeiQia);

            if (item != null)
            {
                mobileCustomerService.Insert(0, item);
            }
            ViewBag.CustomerServices = mobileCustomerService;
            if (view.Order.ShopBranchId.HasValue && (((nullable = view.Order.ShopBranchId).GetValueOrDefault() > 0L) && nullable.HasValue))
            {
                ViewBag.ShopBranchInfo = ShopBranchApplication.GetShopBranchById(view.Order.ShopBranchId.Value);
            }
            return(base.View(view.Order));
        }
Beispiel #7
0
        /// <summary>
        /// 门店首页
        /// </summary>
        /// <param name="shopBranchId">门店ID</param>
        /// <returns></returns>
        public object GetStoreHome(long shopBranchId)
        {
            var shopBranch = ShopBranchApplication.GetShopBranchById(shopBranchId);

            if (shopBranch == null)
            {
                return(Json(new { Success = false, Message = "获取当前门店信息错误!" }));
            }

            shopBranch.ShopImages    = string.IsNullOrWhiteSpace(shopBranch.ShopImages) ? "" : Core.HimallIO.GetRomoteImagePath(shopBranch.ShopImages);
            shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2);
            var shopCategory = ShopCategoryApplication.GetCategoryByParentId(0, shopBranch.ShopId).Select(item =>
            {
                return(new
                {
                    Id = item.Id,
                    Name = item.Name
                });
            });

            var result = new
            {
                Success      = true,
                StoreInfo    = shopBranch,
                ShopCategory = shopCategory
            };

            return(Json(result));
        }
        /// <summary>
        /// 门店商品管理
        /// </summary>
        /// <param name="shopBranchId"></param>
        /// <returns></returns>
        public ActionResult ProductManagement(long shopBranchId)
        {
            var shopBranch = ShopBranchApplication.GetShopBranchById(shopBranchId);

            ViewBag.ShopBranchName = shopBranch.ShopBranchName;
            ViewBag.ShopCategorys  = ShopCategoryApplication.GetShopCategory(shopBranch.ShopId);
            return(View());
        }
Beispiel #9
0
 public ActionResult Edit(ShopBranch shopBranch)
 {
     try
     {
         if (!string.Equals(shopBranch.PasswordOne, shopBranch.PasswordTwo))
         {
             throw new HimallException("两次密码输入不一致!");
         }
         if (shopBranch.ShopBranchName.Length > 15)
         {
             throw new HimallException("门店名称不能超过15个字!");
         }
         if (shopBranch.AddressDetail.Length > 50)
         {
             throw new HimallException("详细地址不能超过50个字!");
         }
         if ((shopBranch.Latitude <= 0f) || (shopBranch.Longitude <= 0f))
         {
             throw new HimallException("请搜索地址地图定位!");
         }
         shopBranch.ShopId = base.CurrentSellerManager.ShopId;
         ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(shopBranch.Id);
         if ((shopBranchById != null) && (shopBranchById.ShopId != shopBranch.ShopId))
         {
             throw new HimallException("不能修改其他商家的门店!");
         }
         try
         {
             string[] strs      = new string[] { shopBranch.Id.ToString() };
             string[] strArray2 = (shopBranch.ShopBranchTagId == null) ? new string[0] : shopBranch.ShopBranchTagId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
             ShopBranchApplication.SetShopBrandTagInfos(this.convertLongs(strs), this.convertLongs(strArray2));
         }
         catch
         {
         }
         ShopBranchApplication.UpdateShopBranch(shopBranch);
     }
     catch (Exception exception)
     {
         BaseController.Result result = new BaseController.Result
         {
             success = false,
             msg     = exception.Message
         };
         return(base.Json(result));
     }
     BaseController.Result data = new BaseController.Result
     {
         success = true
     };
     return(base.Json(data));
 }
        /// <summary>
        /// 门店商品管理
        /// </summary>
        /// <param name="shopBranchId"></param>
        /// <returns></returns>
        public ActionResult ProductManagement(long shopBranchId)
        {
            var shopBranch     = ShopBranchApplication.GetShopBranchById(shopBranchId);
            var shopBranchName = string.Empty;

            if (shopBranch != null)
            {
                shopBranchName = shopBranch.ShopBranchName;
            }
            ViewBag.ShopBranchName = shopBranchName;
            ViewBag.ShopCategorys  = ShopCategoryApplication.GetShopCategory(CurrentSellerManager.ShopId);
            return(View());
        }
        private List <OrderRefundApiModel> FullModel(List <OrderRefund> refunds)
        {
            var orders     = Application.OrderApplication.GetOrders(refunds.Select(p => p.OrderId));
            var orderItems = Application.OrderApplication.GetOrderItemsByOrderItemId(refunds.Select(p => p.OrderItemId));
            var members    = Application.MemberApplication.GetMembers(orders.Select(p => p.UserId));

            AutoMapper.Mapper.CreateMap <OrderRefund, OrderRefundApiModel>();
            var result = refunds.Select(item =>
            {
                var orderItem            = orderItems.FirstOrDefault(oi => oi.Id == item.OrderItemId);
                var order                = orders.FirstOrDefault(o => o.Id == item.OrderId);
                var member               = members.FirstOrDefault(m => m.Id == order.UserId);
                orderItem.ThumbnailsUrl  = HimallIO.GetRomoteProductSizeImage(orderItem.ThumbnailsUrl, 1, (int)Himall.CommonModel.ImageSize.Size_100);
                ProductTypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetTypeByProductId(orderItem.ProductId);
                orderItem.ColorAlias     = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias;
                orderItem.SizeAlias      = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias;
                orderItem.VersionAlias   = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias;
                orderItem.ShipTo         = order.ShipTo;
                orderItem.CellPhone      = order.CellPhone;
                orderItem.RegionFullName = order.RegionFullName;
                orderItem.Address        = order.Address;

                var model    = item.Map <OrderRefundApiModel>();
                model.Status = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? (int)item.ManagerConfirmStatus : (int)item.SellerAuditStatus;
                //model.StatusDescription = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? item.ManagerConfirmStatus.ToDescription() : ((CommonModel.Enum.OrderRefundShopAuditStatus)item.SellerAuditStatus).ToDescription();
                model.StatusDescription = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? item.ManagerConfirmStatus.ToDescription() : (order.ShopBranchId.HasValue && order.ShopBranchId.Value > 0 ?
                                                                                                                                                                  ((CommonModel.Enum.OrderRefundShopAuditStatus)item.SellerAuditStatus).ToDescription() : item.SellerAuditStatus.ToDescription());
                model.UserName        = member == null ? "" : member.RealName;
                model.UserCellPhone   = member == null ? "" : member.CellPhone;
                model.OrderItem       = orderItem;
                model.CertPics        = new string[3];
                model.CertPics[0]     = HimallIO.GetRomoteImagePath(model.CertPic1);
                model.CertPics[1]     = HimallIO.GetRomoteImagePath(model.CertPic2);
                model.CertPics[2]     = HimallIO.GetRomoteImagePath(model.CertPic3);
                string shopBranchName = "总店";
                if (order.ShopBranchId.HasValue && order.ShopBranchId.Value > 0)
                {
                    var shopBranchInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId.Value);
                    if (shopBranchInfo != null)
                    {
                        shopBranchName = shopBranchInfo.ShopBranchName;
                    }
                }
                model.ShopName = shopBranchName;

                return(model);
            });

            return(result.ToList());
        }
Beispiel #12
0
        public object GetShopBranchPrintInfo()
        {
            var shopBranchInfo = ShopBranchApplication.GetShopBranchById(CurrentShopBranch.Id);

            if (shopBranchInfo != null)
            {
                return(new
                {
                    PrintCount = shopBranchInfo.PrintCount,
                    IsAutoPrint = shopBranchInfo.IsAutoPrint
                });
            }
            return(null);
        }
Beispiel #13
0
        private string GetShopBranchName(long?branchId)
        {
            string branchName = "";

            if (branchId.HasValue)
            {
                var branch = ShopBranchApplication.GetShopBranchById(branchId.Value);
                if (branch != null)
                {
                    branchName = branch.ShopBranchName;
                }
            }
            return(branchName);
        }
        public object GetSubmitByCartModel(string cartItemIds = "")
        {
            this.CheckUserLogin();
            MobileOrderDetailConfirmModel mobileSubmiteByCart = OrderApplication.GetMobileSubmiteByCart(this.CurrentUserId, cartItemIds);

            if (mobileSubmiteByCart.shopBranchInfo == null)
            {
                throw new HimallException("获取门店信息失败,不可提交非门店商品");
            }
            ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(mobileSubmiteByCart.shopBranchInfo.Id);
            object     obj1           = (object)new ExpandoObject();
            object     obj2;

            if (mobileSubmiteByCart.Address != null)
            {
                string str = mobileSubmiteByCart.Address.AddressDetail ?? "";
                var    fAnonymousType30 = new
                {
                    Id       = mobileSubmiteByCart.Address.Id,
                    ShipTo   = mobileSubmiteByCart.Address.ShipTo,
                    Phone    = mobileSubmiteByCart.Address.Phone,
                    Address  = mobileSubmiteByCart.Address.RegionFullName + " " + mobileSubmiteByCart.Address.Address + " " + str,
                    RegionId = mobileSubmiteByCart.Address.RegionId
                };
                obj2 = (object)fAnonymousType30;
            }
            else
            {
                obj2 = (object)null;
            }
            return((object)this.Json(new
            {
                Success = "true",
                Address = obj2,
                IsCashOnDelivery = mobileSubmiteByCart.IsCashOnDelivery,
                InvoiceContext = mobileSubmiteByCart.InvoiceContext,
                InvoiceTitle = OrderApplication.GetInvoiceTitles(this.CurrentUserId),
                products = mobileSubmiteByCart.products,
                integralPerMoney = mobileSubmiteByCart.integralPerMoney,
                userIntegrals = mobileSubmiteByCart.userIntegrals,
                TotalAmount = mobileSubmiteByCart.totalAmount,
                Freight = mobileSubmiteByCart.Freight,
                orderAmount = mobileSubmiteByCart.orderAmount,
                shopBranchInfo = shopBranchById,
                IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore,
                capitalAmount = mobileSubmiteByCart.capitalAmount
            }));
        }
        /// <summary>
        /// 当前门店信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private DTO.ShopBranch GetShopBranchById(long id)
        {
            DTO.ShopBranch result   = null;
            string         cachekey = SB_CACHE_KEY_PREFIX + id;

            result = Cache.Get <DTO.ShopBranch>(cachekey);
            if (result == null)
            {
                result = ShopBranchApplication.GetShopBranchById(id);
                if (result != null && result.Id > 0)
                {
                    Cache.Insert <DTO.ShopBranch>(cachekey, result);
                }
            }
            return(result);
        }
        /// <summary>
        /// 门店发货
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public object PostShopSendGood(OrderDeliveryModel model)
        {
            CheckUserLogin();
            string shopkeeperName = "";
            long   shopid         = CurrentShopBranch.ShopId;
            long   sbid           = CurrentUser.ShopBranchId;

            shopkeeperName = CurrentShopBranch.UserName;
            var returnurl = String.Format("{0}/Common/ExpressData/SaveExpressData", CurrentUrlHelper.CurrentUrlNoPort());

            if (model.deliveryType == DeliveryType.CityExpress.GetHashCode())  //同城物流
            {
                var dadaconfig = CityExpressConfigApplication.GetDaDaCityExpressConfig(shopid);
                if (!dadaconfig.IsEnable)
                {
                    throw new HimallApiException("未开启同城合作物流");
                }
                var order = OrderApplication.GetOrder(model.orderId);
                if (order == null || order.ShopId != shopid || !(order.ShopBranchId > 0) || order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitDelivery)
                {
                    throw new HimallApiException("错误的订单编号");
                }
                //Log.Error("达达发货ShopBranchOrder-开始01:orderId:" + model.orderId);

                var sbdata = ShopBranchApplication.GetShopBranchById(sbid);

                string json      = ExpressDaDaHelper.addAfterQuery(shopid, sbdata.DaDaShopId, model.shipOrderNumber);
                var    resultObj = JsonConvert.DeserializeObject(json) as JObject;
                string status    = resultObj["status"].ToString();

                //Log.Error("达达发货ShopBranchOrder-开始02:status:" + status);
                if (status != "success")
                {
                    //订单码过期,重发单
                    json = SendDaDaExpress(model.orderId, shopid, sbid, false);
                    var    rObj2   = JsonConvert.DeserializeObject(json) as JObject;
                    string status2 = rObj2["status"].ToString();
                    if (status2 != "success")
                    {
                        string msg = rObj2["msg"].ToString();
                        return(ErrorResult(msg));
                    }
                }
            }
            OrderApplication.ShopSendGood(model.orderId, model.deliveryType, shopkeeperName, model.companyName, model.shipOrderNumber, returnurl);
            return(SuccessResult("发货成功"));
        }
Beispiel #17
0
        public ActionResult Management(long?shopBranchId)
        {
            ViewBag.hasHistory = SiteSettingApplication.SiteSettings.IsOpenHistoryOrder;
            var model          = PaymentApplication.GetPaymentTypeDesc();
            var shopbranchName = "";

            if (shopBranchId.HasValue)
            {
                var shopbranch = ShopBranchApplication.GetShopBranchById(shopBranchId.Value);
                if (shopbranch != null)
                {
                    shopbranchName = shopbranch.ShopBranchName;
                }
            }
            ViewBag.ShopBranchName = shopbranchName;
            return(View(model));
        }
Beispiel #18
0
        public object PostUpdtePrintCount(ShopBranch info)
        {
            var shopBranchInfo = ShopBranchApplication.GetShopBranchById(CurrentShopBranch.Id);

            if (shopBranchInfo != null)
            {
                shopBranchInfo.PrintCount = info.PrintCount;
                ShopBranchApplication.UpdateShopBranch(shopBranchInfo);
                string userkey     = WebHelper.GetFormString("userkey");
                var    currentInfo = PrintHub.ConnectedUsers.FirstOrDefault(p => p.UserKey == userkey);
                if (currentInfo != null)
                {
                    currentInfo.PrintCount = info.PrintCount;
                }
            }
            return(new { success = true });
        }
        public JsonResult UnFreeze(long shopBranchId)
        {
            var branch = ShopBranchApplication.GetShopBranchById(shopBranchId);

            if (branch == null)
            {
                return(Json(new { success = false, msg = "门店有误!" }));
            }
            var shop = ShopApplication.GetShopBasicInfo(branch.ShopId);

            if (shop == null || shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze)
            {
                return(Json(new { success = false, msg = "该门店所属商家已冻结或过期,解冻失败!" }));
            }
            ShopBranchApplication.UnFreeze(shopBranchId);
            return(Json(new { success = true, msg = "解冻成功!" }));
        }
        public object JumpShopBranch(long branchId)
        {
            var branch = ShopBranchApplication.GetShopBranchById(branchId);

            if (branch.ShopId != CurrentUser.ShopId)
            {
                return(ErrorResult("非法操作,非所属门店。"));//越权至非当前商家的门店
            }
            if (!branch.EnableSellerManager)
            {
                return(ErrorResult("门店未开启商家管理"));
            }
            var manager = ShopBranchApplication.GetShopBranchManagerByShopBranchId(branch.Id);
            var userkey = UserCookieEncryptHelper.Encrypt(manager.Id, CookieKeysCollection.USERROLE_USER);

            return(new { success = true, userKey = userkey });
        }
Beispiel #21
0
        public ActionResult Detail(long id)
        {
            OrderInfo order    = _iOrderService.GetOrder(id);
            var       Newmodel = GetNewmodel(order.Id);

            if (order == null)
            {
                throw new HimallException("错误的预约单信息");
            }
            if (order.OrderType == OrderInfo.OrderTypes.FightGroup)
            {
                var fgord = _iFightGroupService.GetFightGroupOrderStatusByOrderId(order.Id);
                order.FightGroupOrderJoinStatus = fgord.GetJoinStatus;
                order.FightGroupCanRefund       = fgord.CanRefund;
            }
            //if (order.ShopBranchId.HasValue && order.ShopBranchId.Value!=0)
            //{//补充数据
            //    var branch = ShopBranchApplication.GetShopBranchById(order.ShopBranchId.Value);
            //    ViewBag.ShopBranchContactUser = branch.UserName;
            //}
            order.ReceiveDate      = Newmodel[0].ReceiveDate.ToString("yyyy-MM-dd");
            order.ReceiveStartTime = Newmodel[0].ReceiveStartTime;
            order.ReceiveEndTime   = Newmodel[0].ReceiveEndTime;
            order.doctorName       = Newmodel[0].doctorName;
            ViewBag.Coupon         = 0;
            //var coupon = ServiceHelper.Create<ICouponService>().GetCouponRecordInfo( order.UserId , order.Id );
            //if( coupon != null )
            //{
            //    ViewBag.Coupon = coupon.Himall_Coupon.Price;
            //}
            #region 门店信息
            if (order.ShopBranchId.HasValue && order.ShopBranchId.Value > 0)
            {
                var shopBranchInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId.Value);
                if (shopBranchInfo != null)
                {
                    ViewBag.ShopBranchInfo = shopBranchInfo;
                    if (order.OrderStatus == OrderInfo.OrderOperateStatus.Finish)
                    {
                        ViewBag.ShopBranchContactUser = shopBranchInfo.UserName;
                    }
                }
            }
            #endregion
            return(View(order));
        }
Beispiel #22
0
        public object GetUpdateCartItem(string skuId, int count, long shopBranchId)
        {
            CheckUserLogin();
            CheckSkuIdIsValid(skuId, shopBranchId);
            //判断库存
            var sku = ProductManagerApplication.GetSKU(skuId);

            if (sku == null)
            {
                throw new MallException("错误的SKU");
            }
            //if (count > sku.Stock)
            //{
            //    throw new MallException("库存不足");
            //}
            var shopBranch = ShopBranchApplication.GetShopBranchById(shopBranchId);

            if (shopBranch == null)
            {
                throw new MallException("错误的门店id");
            }
            var shopBranchSkuList = ShopBranchApplication.GetSkusByIds(shopBranchId, new List <string> {
                skuId
            });

            if (shopBranchSkuList == null || shopBranchSkuList.Count == 0)
            {
                throw new MallException("门店没有该商品");
            }
            if (shopBranchSkuList[0].Status == ShopBranchSkuStatus.InStock)
            {
                throw new MallException("此商品已下架");
            }
            var sbsku = shopBranchSkuList.FirstOrDefault();

            if (sbsku.Stock < count)
            {
                throw new MallException("门店库存不足");
            }
            long memberId = CurrentUser.Id;

            CartApplication.UpdateShopBranchCart(skuId, count, memberId, shopBranchId);
            return(Json(""));
        }
        ///// <summary>
        ///// 修改同步小程序状态
        ///// </summary>
        ///// <param name="type"></param>
        ///// <param name="status"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public JsonResult ShopBranchSettingUpdateAppletSyncStatus(int type, bool status)
        //{
        //    var setting = SiteSettingApplication.SiteSettings;
        //    switch (type)
        //    {
        //        case 1:
        //            setting.O2OApplet_IsUseTopSlide = status;
        //            break;
        //        case 2:
        //            setting.O2OApplet_IsUseIconArea = status;
        //            break;
        //        case 3:
        //            setting.O2OApplet_IsUseAdArea = status;
        //            break;
        //        case 4:
        //            setting.O2OApplet_IsUseMiddleSlide = status;
        //            break;
        //        default:
        //            return Json(new Result { success = false, status = -1, msg = "错误的操作参数" });
        //    }
        //    SiteSettingApplication.SaveChanges();
        //    return Json(new Result { success = true, status = 1, msg = "操作成功" });
        //}

        private string GetLinkName(string url)
        {
            var arr = url.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            if (arr.Length == 2)
            {
                var  strID = arr[1].Substring(arr[1].LastIndexOf('/') + 1);
                long id    = 0;
                long.TryParse(strID, out id);
                switch (arr[0])
                {
                case "1":
                {
                    var model = ShopBranchApplication.GetShopBranchTagInfo(id, false);
                    if (null != model)
                    {
                        return(model.Title);
                    }
                }
                break;

                case "2":
                {
                    var model = ShopBranchApplication.GetShopBranchById(id);
                    if (null != model)
                    {
                        return(model.ShopBranchName);
                    }
                }
                break;

                case "3":
                {
                    var model = TopicApplication.GetTopic(id);
                    if (null != model)
                    {
                        return(model.Name);
                    }
                }
                break;
                }
            }
            return("");
        }
 public object GetShopGetAddress(long shopId, long shopBranchId = 0)
 {
     if (shopBranchId <= 0)
     {
         var data = ShopShippersApplication.GetDefaultGetGoodsShipper(shopId);
         if (data == null)
         {
             data = new DTO.ShopShipper()
             {
             };
         }
         else
         {
             data.RegionStr = RegionApplication.GetFullName(data.RegionId);
         }
         var model = new
         {
             success     = true,
             Region      = data.RegionStr,
             Address     = data.Address,
             Phone       = data.TelPhone,
             ShipperName = data.ShipperName
         };
         return(model);
     }
     else
     {
         var    data      = ShopBranchApplication.GetShopBranchById(shopBranchId);
         string redionstr = "";
         if (data != null)
         {
             redionstr = RegionApplication.GetFullName(data.AddressId);
         }
         var model = new
         {
             success     = true,
             Region      = redionstr,
             Address     = data.AddressDetail,
             Phone       = data.ContactPhone,
             ShipperName = data.ContactUser
         };
         return(model);
     }
 }
Beispiel #25
0
        public ActionResult Edit(long id)
        {
            ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(id);
            List <ShopBranchTagModel> allShopBranchTagInfos = ShopBranchApplication.GetAllShopBranchTagInfos();
            List <SelectListItem>     list2 = new List <SelectListItem>();

            foreach (ShopBranchTagModel model in allShopBranchTagInfos)
            {
                SelectListItem item = new SelectListItem
                {
                    Selected = (shopBranchById.ShopBranchTagId == null) ? false : (shopBranchById.ShopBranchTagId.Split(new char[] { ',' }).Contains <string>(model.Id.ToString()) ? true : false),
                    Value    = model.Id.ToString(),
                    Text     = model.Title
                };
                list2.Add(item);
            }
            ((dynamic)base.ViewBag).ShopBranchTags = list2;
            return(base.View(shopBranchById));
        }
Beispiel #26
0
        /// <summary>
        /// 获取门店信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetStoreInfo(long id, string fromLatLng = "")
        {
            CheckOpenStore();
            var shopBranch = ShopBranchApplication.GetShopBranchById(id);

            if (shopBranch == null)
            {
                throw new HimallApiException(ApiErrorCode.Parameter_Error, "id");
            }
            var shop = ShopApplication.GetShop(shopBranch.ShopId);

            if (null != shop && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.HasExpired)
            {
                return(Json(ErrorResult <dynamic>("此店铺已过期")));
            }
            if (null != shop && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze)
            {
                return(Json(ErrorResult <dynamic>("此店铺已冻结")));
            }
            if (!string.IsNullOrWhiteSpace(fromLatLng))
            {
                shopBranch.Distance = ShopBranchApplication.GetLatLngDistances(fromLatLng, string.Format("{0},{1}", shopBranch.Latitude, shopBranch.Longitude));
            }
            shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2);
            shopBranch.ShopImages    = HimallIO.GetRomoteImagePath(shopBranch.ShopImages);
            Mapper.CreateMap <ShopBranch, HomeGetShopBranchInfoModel>();
            var store          = Mapper.Map <ShopBranch, HomeGetShopBranchInfoModel>(shopBranch);
            var homepageBranch = ProcessBranchHomePageData(new List <ShopBranch>()
            {
                shopBranch
            }, true).FirstOrDefault();

            //过滤不能领取的优惠券
            homepageBranch.ShopAllActives.ShopCoupons = homepageBranch.ShopAllActives.ShopCoupons.ToList();
            //统计门店访问人数
            StatisticApplication.StatisticShopBranchVisitUserCount(shopBranch.ShopId, shopBranch.Id);
            return(JsonResult <dynamic>(new
            {
                Store = store,
                homepageBranch.ShopAllActives,
                CommentScore = ShopBranchApplication.GetServiceMark(store.Id).ComprehensiveMark,   //评分
            }));
        }
 public JsonResult GetShopGetAddress(long shopId, long shopBranchId = 0)
 {
     if (shopBranchId <= 0)
     {
         var data = ShopShippersApplication.GetDefaultGetGoodsShipper(shopId);
         if (data == null)
         {
             data = new DTO.ShopShipper()
             {
             };
         }
         else
         {
             data.RegionStr = RegionApplication.GetFullName(data.RegionId);
         }
         var model = new
         {
             Region      = string.IsNullOrEmpty(data.RegionStr) ? "" : data.RegionStr,
             Address     = string.IsNullOrEmpty(data.Address) ? "" : data.Address,
             Phone       = string.IsNullOrEmpty(data.TelPhone) ? "" : data.TelPhone,
             ShipperName = string.IsNullOrEmpty(data.ShipperName) ? "" : data.ShipperName
         };
         return(Json <dynamic>(true, data: model));
     }
     else
     {
         var    data      = ShopBranchApplication.GetShopBranchById(shopBranchId);
         string redionstr = "";
         if (data != null)
         {
             redionstr = RegionApplication.GetFullName(data.AddressId);
         }
         var model = new
         {
             Region      = redionstr,
             Address     = data == null ? "" : data.AddressDetail,
             Phone       = data == null ? "" : data.ContactPhone,
             ShipperName = data == null ? "" : data.ContactUser
         };
         return(Json <dynamic>(true, data: model));
     }
 }
Beispiel #28
0
 private string GetLinkName(string url)
 {
     string[] strArray = url.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
     if (strArray.Length == 2)
     {
         string s      = strArray[1].Substring(strArray[1].LastIndexOf('/') + 1);
         long   result = 0L;
         long.TryParse(s, out result);
         string str3 = strArray[0];
         if (str3 != null)
         {
             if (!(str3 == "1"))
             {
                 if (str3 == "2")
                 {
                     ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(result);
                     if (null != shopBranchById)
                     {
                         return(shopBranchById.ShopBranchName);
                     }
                 }
                 else if (str3 == "3")
                 {
                     TopicInfo topicInfo = this._iTopicService.GetTopicInfo(result);
                     if (null != topicInfo)
                     {
                         return(topicInfo.Name);
                     }
                 }
             }
             else
             {
                 ShopBranchTagModel shopBranchTagInfo = ShopBranchApplication.GetShopBranchTagInfo(result);
                 if (null != shopBranchTagInfo)
                 {
                     return(shopBranchTagInfo.Title);
                 }
             }
         }
     }
     return("");
 }
Beispiel #29
0
        /// <summary>
        /// 门店首页
        /// </summary>
        /// <param name="id">门店ID</param>
        /// <returns></returns>
        public ActionResult Index(long id = 0)
        {
            bool isOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore;

            if (!isOpenStore)
            {
                throw new Core.HimallException("门店未授权!");
            }
            var shopBranch = ShopBranchApplication.GetShopBranchById(id);

            if (shopBranch == null)
            {
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }
            shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2);
            ViewBag.ShopBranch       = shopBranch;
            ViewBag.ShopCategory     = ShopCategoryApplication.GetCategoryByParentId(0, shopBranch.ShopId);

            return(View());
        }
        public ActionResult Edit(long id)
        {
            var shopBranch = ShopBranchApplication.GetShopBranchById(id);

            //门店标签
            var shopBranchTagInfos        = ShopBranchApplication.GetAllShopBranchTagInfos();
            List <SelectListItem> tagList = new List <SelectListItem>();

            foreach (var item in shopBranchTagInfos)
            {
                tagList.Add(new SelectListItem
                {
                    Selected = (shopBranch.ShopBranchTagId == null ? false : shopBranch.ShopBranchTagId.Split(',').Contains(item.Id.ToString()) ? true : false),
                    Value    = item.Id.ToString(),
                    Text     = item.Title
                });
            }
            ViewBag.ShopBranchTags = tagList;
            return(View(shopBranch));
        }