Esempio n. 1
0
        public ActionResult CompleteOrder(CompleteOrderModel model, int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);
            if (orderInfo == null)
                return PromptView("订单不存在");
            if (orderInfo.OrderState != (int)OrderState.Sended)
                return PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未发货,不能完成订单");
            if (orderInfo.PayMode != 0)
                return PromptView(Url.Action("orderinfo", new { oid = oid }), "只有货到付款订单才需要填写支付单号");

            if (string.IsNullOrWhiteSpace(model.PaySN))
                ModelState.AddModelError("PaySN", "请填写支付单号");

            if (ModelState.IsValid)
            {
                AdminOrders.PayOrder(oid, OrderState.Sended, model.PaySN, DateTime.Now);

                PartUserInfo partUserInfo = Users.GetPartUserById(orderInfo.Uid);
                AdminOrders.CompleteOrder(ref partUserInfo, orderInfo, DateTime.Now, WorkContext.IP);
                CreateOrderAction(oid, OrderActionType.Complete, "订单已完成,感谢您在" + WorkContext.MallConfig.MallName + "购物,欢迎您再次光临");
                AddMallAdminLog("完成订单", "完成订单,订单ID为:" + oid);
                return PromptView(Url.Action("orderinfo", new { oid = oid }), "完成订单成功");
            }
            ViewData["orderInfo"] = orderInfo;
            return View(model);
        }
Esempio n. 2
0
        public ActionResult CompleteOrder(int oid = -1)
        {
            OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid);
            if (orderInfo == null)
                return PromptView("订单不存在");
            if (orderInfo.OrderState != (int)OrderState.Sended)
                return PromptView(Url.Action("orderinfo", new { oid = oid }), "订单还未发货,不能完成订单");

            if (orderInfo.PayMode != 0)
            {
                PartUserInfo partUserInfo = Users.GetPartUserById(orderInfo.Uid);
                AdminOrders.CompleteOrder(ref partUserInfo, orderInfo, DateTime.Now, WorkContext.IP);
                CreateOrderAction(oid, OrderActionType.Complete, "订单已完成,感谢您在" + WorkContext.MallConfig.MallName + "购物,欢迎您再次光临");
                AddMallAdminLog("完成订单", "完成订单,订单ID为:" + oid);
                return PromptView(Url.Action("orderinfo", new { oid = oid }), "完成订单成功");
            }
            else
            {
                CompleteOrderModel model = new CompleteOrderModel();
                ViewData["orderInfo"] = orderInfo;
                return View(model);
            }
        }