/// <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("订单不存在")); } if (orderInfo.StoreId != WorkContext.StoreId) { 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); ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie(); return(View(model)); }
/// <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("订单不存在")); } if (orderInfo.StoreId != WorkContext.StoreId) { 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.GetStoreAdminRefererCookie(); return(View(model)); }
/// <summary> /// 打印订单 /// </summary> /// <param name="oid">订单id</param> /// <returns></returns> public ActionResult PrintOrder(int oid) { OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid); if (orderInfo == null) { return(PromptView("订单不存在")); } PrintOrderModel model = new PrintOrderModel() { OrderInfo = orderInfo, RegionInfo = Regions.GetRegionById(orderInfo.RegionId), OrderProductList = AdminOrders.GetOrderProductList(oid), }; return(View(model)); }
/// <summary> /// 订单信息 /// </summary> public ActionResult OrderInfo() { int oid = WebHelper.GetQueryInt("oid"); OrderInfo orderInfo = Orders.GetOrderByOid(oid); if (orderInfo == null || orderInfo.Uid != WorkContext.Uid) { return(PromptView("订单不存在")); } OrderInfoModel model = new OrderInfoModel(); model.OrderInfo = orderInfo; model.RegionInfo = Regions.GetRegionById(orderInfo.RegionId); model.OrderProductList = AdminOrders.GetOrderProductList(oid); return(View(model)); }
/// <summary> /// 打印订单 /// </summary> /// <param name="oid">订单id</param> /// <returns></returns> public ActionResult PrintOrder(int oid) { OrderInfo orderInfo = AdminOrders.GetOrderByOid(oid); if (orderInfo == null) { return(PromptView("订单不存在")); } PrintOrderModel model = new PrintOrderModel() { OrderInfo = orderInfo, RegionInfo = Regions.GetRegionById(orderInfo.RegionId), OrderProductList = AdminOrders.GetOrderProductList(oid), AdminRealName = AdminUsers.GetUserDetailById(WorkContext.Uid).RealName }; return(View(model)); }
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); //邮件通知 if (!string.IsNullOrWhiteSpace(orderInfo.Email)) { Emails.SendOrderConfirmEmail(orderInfo.Email, orderInfo.OSN); } } 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); //邮件通知 if (!string.IsNullOrWhiteSpace(orderInfo.Email)) { List <OrderProductInfo> vList = AdminOrders.GetOrderProductList(oid); string vUIDStr = string.Join(",", vList.ConvertAll(AItem => AItem.Gid)); Emails.SendOrderFinishedEmail(orderInfo.Email, orderInfo.OSN, vUIDStr, shipSN + "(" + orderInfo.ShipFriendName + ")"); } } 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 }), "操作已完成")); }