예제 #1
0
        public ActionResult SendOrderProduct(SendOrderProductModel model, int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

            if (orderInfo == null)
            {
                return(PromptView("订单不存在"));
            }
            if (orderInfo.StoreId != WorkContext.StoreId)
            {
                return(PromptView("不能操作其它店铺的订单"));
            }
            if (orderInfo.OrderState != (int)OrderState.PreProducting)
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未完成备货,不能发货"));
            }

            ShipCompanyInfo shipCompanyInfo = ShipCompanies.GetShipCompanyById(model.ShipCoId);

            if (shipCompanyInfo == null)
            {
                ModelState.AddModelError("ShipCoId", "请选择配送公司");
            }

            if (ModelState.IsValid)
            {
                AdminOrders.SendOrder(oid, OrderState.Sended, model.ShipSN, model.ShipCoId, shipCompanyInfo.Name, DateTime.Now);
                CreateOrderAction(oid, OrderActionType.Send, "您的订单已经发货,发货方式为:" + shipCompanyInfo.Name + ",单号为:" + model.ShipSN);
                AddStoreAdminLog("发货", "发货,订单ID为:" + oid);
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "发货成功"));
            }
            Load(orderInfo);
            return(View(model));
        }
예제 #2
0
        public ActionResult BackOrderAfterService(int asId, BackOrderAfterServiceModel model)
        {
            OrderAfterServiceInfo orderAfterServiceInfo = AdminOrderAfterServices.GetOrderAfterServiceByASId(asId);

            if (orderAfterServiceInfo == null || orderAfterServiceInfo.StoreId != WorkContext.StoreId)
            {
                return(PromptView("订单售后服务不存在"));
            }
            if (orderAfterServiceInfo.State != (int)OrderAfterServiceState.Received)
            {
                return(PromptView("不能执行此操作"));
            }

            ShipCompanyInfo shipCompanyInfo = ShipCompanies.GetShipCompanyById(model.ShipCoId);

            if (shipCompanyInfo == null)
            {
                ModelState.AddModelError("ShipCoId", "配送公司不存在");
            }

            if (ModelState.IsValid)
            {
                AdminOrderAfterServices.BackOrderAfterService(asId, model.ShipCoId, shipCompanyInfo.Name, model.ShipSN);
                return(PromptView("操作成功"));
            }

            ViewData["asId"] = asId;
            ViewData["orderAfterServiceInfo"] = orderAfterServiceInfo;
            ViewData["orderAfterServiceInfo"] = orderAfterServiceInfo;
            List <SelectListItem> shipCompanyList = new List <SelectListItem>();

            shipCompanyList.Add(new SelectListItem()
            {
                Text = "请选择", Value = "0"
            });
            foreach (ShipCompanyInfo item in ShipCompanies.GetShipCompanyList())
            {
                shipCompanyList.Add(new SelectListItem()
                {
                    Text = item.Name, Value = item.ShipCoId.ToString()
                });
            }
            ViewData["shipCompanyList"] = shipCompanyList;
            return(View(model));
        }