Пример #1
0
        /// <summary>
        /// 商城收到客户邮寄的商品
        /// </summary>
        public ActionResult ReceiveOrderAfterService(int asId)
        {
            OrderAfterServiceInfo orderAfterServiceInfo = AdminOrderAfterServices.GetOrderAfterServiceByASId(asId);

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

            if (orderAfterServiceInfo.Type == 0)
            {
                AdminOrderAfterServices.CompleteOrderAfterService(asId);
                OrderInfo orderInfo = AdminOrders.GetOrderByOid(orderAfterServiceInfo.Oid);
                OrderRefunds.ApplyRefund(new OrderRefundInfo()
                {
                    State         = (int)OrderRefundState.Applied,
                    Oid           = orderInfo.Oid,
                    OSN           = orderInfo.OSN,
                    Uid           = orderInfo.Uid,
                    ASId          = orderAfterServiceInfo.ASId,
                    PaySystemName = orderInfo.PaySystemName,
                    PayFriendName = orderInfo.PayFriendName,
                    PaySN         = orderInfo.PaySN,
                    PayMoney      = orderAfterServiceInfo.Money,
                    RefundMoney   = orderAfterServiceInfo.Money,
                    ApplyTime     = DateTime.Now
                });
            }
            else
            {
                AdminOrderAfterServices.ReceiveOrderAfterService(asId, DateTime.Now);
            }
            return(PromptView("操作成功"));
        }
Пример #2
0
        public ActionResult UpdateOrderDiscount(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.WaitPaying || (orderInfo.OrderState == (int)OrderState.Confirming && orderInfo.PayMode == 0)))
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "不能修改订单折扣"));
            }

            UpdateOrderDiscountModel model = new UpdateOrderDiscountModel();

            model.Discount        = orderInfo.Discount;
            ViewData["orderInfo"] = orderInfo;
            return(View(model));
        }
Пример #3
0
        public ActionResult PayOrder(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

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

            if (orderInfo.PayMode != 2)
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "付款操作只适用于线下付款"));
            }
            if (orderInfo.OrderState != (int)OrderState.WaitPaying)
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "当前不能支付订单"));
            }

            PayOrderModel model = new PayOrderModel();

            ViewData["orderInfo"] = orderInfo;
            return(View(model));
        }
Пример #4
0
        /// <summary>
        /// 取消订单
        /// </summary>
        public ActionResult CancelOrder(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.WaitPaying || (orderInfo.OrderState == (int)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.Cancel, "订单已取消");
            AddStoreAdminLog("取消订单", "取消订单,订单ID为:" + oid);
            return(PromptView(Url.Action("orderinfo", new { oid = oid }), "取消订单成功"));
        }
Пример #5
0
        /// <summary>
        /// 订单信息
        /// </summary>
        /// <param name="oid">订单id</param>
        /// <returns></returns>
        public ActionResult OrderInfo(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

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

            OrderInfoModel model = new OrderInfoModel();

            model.OrderInfo        = orderInfo;
            model.RegionInfo       = Regions.GetRegionById(orderInfo.RegionId);
            model.UserInfo         = Users.GetUserById(orderInfo.Uid);
            model.UserRankInfo     = AdminUserRanks.GetUserRankById(model.UserInfo.UserRid);
            model.OrderProductList = AdminOrders.GetOrderProductList(oid);
            model.OrderActionList  = OrderActions.GetOrderActionList(oid);

            string[] sizeList = StringHelper.SplitString(WorkContext.MallConfig.ProductShowThumbSize);

            ViewData["size"]    = sizeList[sizeList.Length / 2];
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
Пример #6
0
        /// <summary>
        /// 退货
        /// </summary>
        public ActionResult ReturnOrderProduct(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.Sended && orderInfo.OrderState != (int)OrderState.Completed)
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单当前不能退货"));
            }

            PartUserInfo partUserInfo = Users.GetPartUserById(orderInfo.Uid);

            AdminOrders.ReturnOrder(ref partUserInfo, orderInfo, WorkContext.Uid, DateTime.Now);
            CreateOrderAction(oid, OrderActionType.Return, "订单已退货");
            AddStoreAdminLog("退货", "退货,订单ID为:" + oid);
            return(PromptView(Url.Action("orderinfo", new { oid = oid }), "退货成功"));
        }
Пример #7
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 }), "操作已完成"));
        }
Пример #8
0
        public ActionResult OperateOrder(int oid = -1, int actionType = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);

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

            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 }), "买家还未付款,不能确认订单"));
                }
            }
            else if (orderActionType == OrderActionType.PreProduct)//备货
            {
                if (orderState != OrderState.Confirmed)
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未确认,不能备货"));
                }
            }
            else if (orderActionType == OrderActionType.Send)//发货
            {
                if (orderState != OrderState.PreProducting)
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未备货,不能发货"));
                }
            }
            else if (orderActionType == OrderActionType.Lock)//锁定订单
            {
                if (!(orderState == OrderState.WaitPaying || (orderState == OrderState.Confirming && orderInfo.PayMode == 0)))
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单当前不能锁定"));
                }
            }
            else if (orderActionType == OrderActionType.Cancel)//取消订单
            {
                if (!(orderState == OrderState.WaitPaying || (orderState == OrderState.Confirming && orderInfo.PayMode == 0)))
                {
                    return(PromptView(Url.Action("orderinfo", new { oid = oid }), "订单当前不能取消"));
                }
            }
            else
            {
                return(PromptView(Url.Action("orderinfo", new { oid = oid }), "当前操作不存在"));
            }

            OperateOrderModel model = new OperateOrderModel();

            model.Oid             = oid;
            model.OrderInfo       = orderInfo;
            model.OrderActionType = orderActionType;
            model.ActionDes       = "";

            return(View(model));
        }