예제 #1
0
        /// <summary>
        /// 备货
        /// </summary>
        public ActionResult PreOrderProduct(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

            if (orderInfo == null)
            {
                return(PromptView("订单不存在"));
            }
            if (orderInfo.OrderState != (int)OrderState.Confirmed)
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未确认,请先确认"));
            }

            AdminOrders.PreProduct(orderInfo);
            CreateOrderAction(oid, OrderActionType.PreProduct, "您的订单已经备货完成");
            AddMallAdminLog("备货", "备货,订单ID为:" + oid);
            return(PromptView(Url.Action("orderinfo", new { oid = oid }), "备货成功"));
        }
예제 #2
0
        public ActionResult OperateOrder(int oid = -1, int actionType = -1, string actionDes = "")
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

            if (orderInfo == null)
            {
                return(PromptView("订单不存在"));
            }

            if (actionDes.Length > 125)
            {
                OperateOrderModel model = new OperateOrderModel();
                model.Oid             = oid;
                model.OrderInfo       = orderInfo;
                model.OrderActionType = (OrderActionType)actionType;
                model.ActionDes       = actionDes;

                ModelState.AddModelError("actionDes", "最多只能输入125个字");
                return(View(model));
            }

            OrderActionType orderActionType = (OrderActionType)actionType;
            OrderState      orderState      = (OrderState)orderInfo.OrderState;

            if (orderActionType == OrderActionType.Confirm)//确认订单
            {
                if (orderState != OrderState.Confirming)
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "买家还未付款,不能确认订单"));
                }

                AdminOrders.ConfirmOrder(orderInfo);
                CreateOrderAction(oid, orderActionType, actionDes.Length == 0 ? "您的订单已经确认" : actionDes);
            }
            else if (orderActionType == OrderActionType.PreProduct)//备货
            {
                if (orderState != OrderState.Confirmed)
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未确认,不能备货"));
                }

                AdminOrders.PreProduct(orderInfo);
                CreateOrderAction(oid, orderActionType, actionDes.Length == 0 ? "您的订单正在备货" : actionDes);
            }
            else if (orderActionType == OrderActionType.Send)//发货
            {
                if (orderState != OrderState.PreProducting)
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未备货,不能发货"));
                }

                string shipSN = WebHelper.GetFormString("shipSN").Trim();
                if (shipSN.Length < 1)
                {
                    OperateOrderModel model = new OperateOrderModel();
                    model.Oid             = oid;
                    model.OrderInfo       = orderInfo;
                    model.OrderActionType = orderActionType;
                    model.ActionDes       = actionDes;

                    ModelState.AddModelError("shipSN", "请填写配送单号");
                    return(View(model));
                }
                AdminOrders.SendOrder(oid, OrderState.Sended, shipSN, DateTime.Now);
                CreateOrderAction(oid, orderActionType, actionDes.Length == 0 ? "您的订单已经发货,发货方式为:" + orderInfo.ShipFriendName + ",单号为:" + shipSN : actionDes);
            }
            else if (orderActionType == OrderActionType.Lock)//锁定订单
            {
                if (!(orderState == OrderState.WaitPaying || (orderState == OrderState.Confirming && orderInfo.PayMode == 0)))
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单当前不能锁定"));
                }

                AdminOrders.LockOrder(orderInfo);
                CreateOrderAction(oid, orderActionType, "订单已锁定:" + actionDes);
            }
            else if (orderActionType == OrderActionType.Cancel)//取消订单
            {
                if (!(orderState == OrderState.WaitPaying || (orderState == OrderState.Confirming && orderInfo.PayMode == 0)))
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单当前不能取消"));
                }

                PartUserInfo partUserInfo = Users.GetPartUserById(orderInfo.Uid);
                AdminOrders.CancelOrder(ref partUserInfo, orderInfo, WorkContext.Uid, DateTime.Now);
                CreateOrderAction(oid, orderActionType, actionDes.Length == 0 ? "订单已取消" : actionDes);
            }
            else
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "当前操作不存在"));
            }

            AddAdminOperateLog("操作订单", "操作订单,订单ID为:" + oid);
            return(PromptView(Url.Action("orderinfo", new { oid = oid }), "操作已完成"));
        }