public JsonResult CalcFreight(int addressId, CalcFreightparameter[] parameters) { var result = OrderApplication.CalcFreight(addressId, parameters.GroupBy(p => p.ShopId).ToDictionary(p => p.Key, p => p.GroupBy(pp => pp.ProductId).ToDictionary(pp => pp.Key, pp => pp.Sum(ppp => ppp.Count)))); if (result.Count == 0) { return(Json(new { success = false, msg = "计算运费失败" })); } else { return(Json(new { success = true, freights = result.Select(p => new { shopId = p.Key, freight = p.Value }).ToArray() })); } }
public JsonResult CalcFreight(int addressId, CalcFreightparameter[] parameters) { var result = OrderApplication.CalcFreight(addressId, parameters.GroupBy(p => p.ShopId).ToDictionary(p => p.Key, p => p.GroupBy(pp => pp.ProductId).ToDictionary(pp => pp.Key, pp => string.Format("{0}${1}", pp.Sum(ppp => ppp.Count), pp.Sum(ppp => ppp.Amount))))); if (result.Count == 0) { return(ErrorResult("计算运费失败")); } else { return(SuccessResult <dynamic>(data: result.Select(p => new { shopId = p.Key, freight = p.Value }).ToArray())); } }
public JsonResult SubmitOrder(OrderPostModel model, string payPwd) { model.CurrentUser = base.CurrentUser; model.DistributionUserLinkId = base.GetDistributionUserLinkId(); model.PlatformType = base.PlatformType.GetHashCode(); model.IsShopbranchOrder = true; OrderReturnModel model2 = OrderApplication.SubmitOrder(model, payPwd); base.ClearDistributionUserLinkId(); OrderApplication.AddVshopBuyNumber(model2.OrderIds); base.Session.Remove("OrderTag"); return(base.Json(new { success = model2.Success, orderIds = model2.OrderIds, realTotalIsZero = model2.OrderTotal == 0M })); }
//TODO:增加资产充值 /// <summary> /// 增加资产充值 /// </summary> /// <param name="orderIds">订单id集合</param> /// <returns></returns> public ActionResult ChargePay(string orderIds) { string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); if (string.IsNullOrEmpty(orderIds)) { return(RedirectToAction("index", "userCenter", new { url = "/UserCapital", tar = "UserCapital" })); } var viewmodel = OrderApplication.ChargePay(UserId, orderIds, webRoot); ViewBag.Keyword = SiteSettings.Keyword; return(View(viewmodel)); }
public object GetShopBranchOrderCount() { CheckUserLogin(); long shopid = CurrentShopBranch.ShopId; long sbid = CurrentUser.ShopBranchId; var waitPayCount = OrderApplication.GetWaitingForPayOrders(shopId: shopid, shopBranchId: sbid); var waitSelfPickUp = OrderApplication.GetWaitingForSelfPickUp(shopid, sbid); var waitReceive = OrderApplication.GetWaitingForReceive(shopid, sbid); var waitDelivery = OrderApplication.GetWaitingForDelivery(shopid, sbid); return(Json(new { success = true, waitPayCount = waitPayCount, waitReceive = waitReceive, waitDelivery = waitDelivery, waitSelfPickUp = waitSelfPickUp })); }
public JsonResult SubmitOrder(CommonModel.OrderPostModel model) { model.CurrentUser = CurrentUser; model.DistributionUserLinkId = GetDistributionUserLinkId(); model.PlatformType = PlatformType.GetHashCode(); var result = OrderApplication.SubmitOrder(model); ClearDistributionUserLinkId(); //清理分销cookie OrderApplication.AddVshopBuyNumber(result.OrderIds); Session.Remove("OrderTag"); return(Json(new { success = result.Success, orderIds = result.OrderIds, realTotalIsZero = result.OrderTotal == 0 })); }
public static IServiceProvider SetIoCService(this IServiceCollection services, IConfiguration config) { var containerBuilder = new ContainerBuilder(); containerBuilder.AddMediatR(typeof(OrderApplication).Assembly); OrderApplication.Load(containerBuilder, config); containerBuilder.Populate(services); var container = containerBuilder.Build(); return(new AutofacServiceProvider(container)); }
/// <summary> /// 点击立即购买调用的GET方法,但是重定向到了Submit页面 /// </summary> /// <param name="skuIds">多个库存Id</param> /// <param name="counts">每个库存对应的数据量</param> /// <param name="regionId">客户收货地区的id</param> /// <param name="collpids">组合购Id集合</param> /// <returns>订单提交页面的数据</returns> public ActionResult SubmitByProductId(string skuIds, string counts, long?regionId, string collpids = null, string CouponIds = "", sbyte productType = 0, long productId = 0) { //Logo ViewBag.Logo = SiteSettings.Logo; //获取Logo //设置会员信息 ViewBag.Member = CurrentUser; var coupons = CouponApplication.ConvertUsedCoupon(CouponIds); var submitModel = OrderApplication.SubmitByProductId(UserId, skuIds, counts, regionId, collpids, coupons, productType); ViewBag.IsCashOnDelivery = submitModel.IsCashOnDelivery; ViewBag.IsLimitBuy = submitModel.IsLimitBuy; InitOrderSubmitModel(submitModel); #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; #endregion #region 是否提供发票 //bool ProvideInvoice = false; //if (submitModel.products != null) // ProvideInvoice = ShopApplication.HasProvideInvoice(submitModel.products.Select(p => p.shopId).ToList()); //ViewBag.ProvideInvoice = ProvideInvoice; #endregion bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); ViewBag.CanIntegralPerMoney = canIntegralPerMoney; ViewBag.CanCapital = canCapital; ViewBag.Keyword = SiteSettings.Keyword; if (productType == 1 && productId > 0) { submitModel.VirtualProductItemInfos = ProductManagerApplication.GetVirtualProductItemInfoByProductId(productId); var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(productId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new MallException("该虚拟商品已过期,不支持下单"); } } submitModel.ProductType = productType; if (productType == 1 && submitModel.products != null && submitModel.products.Count > 0) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(submitModel.products.FirstOrDefault().shopId); if (verificationShipper != null) { ViewBag.ShipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; ViewBag.ShipperTelPhone = verificationShipper.TelPhone; } } return(View("Submit", submitModel)); }
public JsonResult CloseOrder(long orderId) { MemberInfo umi = CurrentUser; bool isClose = OrderApplication.CloseOrder(orderId, umi.Id, umi.UserName); if (isClose) { return(SuccessResult("取消成功")); } else { return(ErrorResult("取消失败,该订单已删除或者不属于当前用户!")); } }
public JsonResult CheckIsComment(long orderId) { var order = OrderApplication.GetOrder(orderId); var orderComments = OrderApplication.GetOrderCommentCount(new[] { orderId }); bool valid = false; if (order != null && (!orderComments.ContainsKey(orderId) || orderComments[orderId] == 0)) { // 订单还未被评价过,有效 valid = true; } return(SuccessResult <dynamic>(data: new { valid = valid })); }
/// <summary> /// 进入购物车提交页面 /// </summary> /// <param name="cartItemIds">购物车物品id集合</param> public ActionResult SubmiteByCart(string cartItemIds, long shippingAddressId = 0, string couponIds = "") { var coupons = CouponApplication.ConvertUsedCoupon(couponIds); var result = OrderApplication.GetMobileSubmiteByCart(UserId, cartItemIds, shippingAddressId, coupons); ViewBag.InvoiceContext = result.InvoiceContext; ViewBag.InvoiceTitle = result.InvoiceTitle; ViewBag.IsCashOnDelivery = result.IsCashOnDelivery; ViewBag.address = null == result.Address || result.Address.NeedUpdate ? null : result.Address; ViewBag.ConfirmModel = result; if (result.products.Count == 0) { return(Redirect("/" + ViewBag.AreaName)); } if (result.shopBranchInfo == null) { throw new MallException("获取门店信息失败,不可提交非门店商品"); } var orderTag = Guid.NewGuid().ToString("N"); ViewBag.OrderTag = orderTag; HttpContext.Session.Set <string>("OrderTag", orderTag); InitOrderSubmitModel(result); #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; #endregion #region 是否提供发票 bool ProvideInvoice = false; if (result.products != null) { ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(p => p.shopId).ToList()); } ViewBag.ProvideInvoice = ProvideInvoice; #endregion bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); ViewBag.CanIntegralPerMoney = canIntegralPerMoney; ViewBag.CanCapital = canCapital; ViewBag.productType = 0; ViewBag.ShipperAddress = ""; ViewBag.ShipperTelPhone = ""; return(View("submit")); }
/// <summary> /// 获取一条退货记录 /// </summary> /// <param name="id"></param> public static OrderRefund GetOrderRefund(long id, long?userId = null, long?shopId = null) { var data = Service.GetOrderRefund(id, userId); if (data == null) { return(null); } var order = OrderApplication.GetOrder(data.OrderId); var result = data.Map <DTO.OrderRefund>(); result.IsShopBranchOrder = order.ShopBranchId > 0; result.IsVirtual = order.OrderType == OrderInfo.OrderTypes.Virtual; return(result); }
public JsonResult GetUserShippingAddresses(long addressId) { ShippingAddressInfo userAddress = OrderApplication.GetUserAddress(addressId); var data = new { id = userAddress.Id, fullRegionName = userAddress.RegionFullName, address = userAddress.Address, phone = userAddress.Phone, shipTo = userAddress.ShipTo, fullRegionIdPath = userAddress.RegionIdPath }; return(base.Json(data)); }
public JsonResult GetUserShippingAddresses(long addressId) { var addresses = OrderApplication.GetUserAddress(addressId); var json = new { id = addresses.Id, fullRegionName = addresses.RegionFullName, address = addresses.Address, phone = addresses.Phone, shipTo = addresses.ShipTo, fullRegionIdPath = addresses.RegionIdPath }; return(SuccessResult <dynamic>(data: json)); }
public object GetShopBranchOrderCount() { CheckUserLogin(); var statistic = StatisticApplication.GetBranchOrderStatistic(CurrentUser.ShopBranchId); return(new { success = true, waitPayCount = statistic.WaitingForPay, waitReceive = statistic.WaitingForRecieve, waitDelivery = statistic.WaitingForDelivery, waitSelfPickUp = statistic.WaitingForSelfPickUp, waitConsumption = OrderApplication.GetWaitConsumptionOrderNumByUserId(shopBranchId: CurrentUser.ShopBranchId) }); }
static void OrderService_OnOrderPaySuccessed(long orderId) { try { var orderData = _orderService.GetOrder(orderId); _iMemberService.UpdateNetAmount(orderData.UserId, orderData.TotalAmount); _iMemberService.IncreaseMemberOrderNumber(orderData.UserId); _iMemberService.UpdateLastConsumptionTime(orderData.UserId, DateTime.Now); OrderApplication.DealDithOrderCategoryByUserId(orderId, orderData.UserId); } catch (Exception e) { Log.Error("处理付款成功消息出错", e); } }
/// <summary> /// 获得编辑收获地址页面 /// </summary> /// <param name="addressId">收货地址Id</param> /// <param name="returnURL">返回url路径</param> public ActionResult EditShippingAddress(long addressId = 0, string returnURL = "") { var ShipngInfo = OrderApplication.GetUserAddress(addressId); ViewBag.addId = addressId; if (ShipngInfo != null) { ViewBag.fullPath = RegionApplication.GetRegionPath(ShipngInfo.RegionId); ViewBag.fullName = RegionApplication.GetFullName(ShipngInfo.RegionId); } #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; #endregion return(View(ShipngInfo)); }
public object GetSubmitByCartModel(string cartItemIds = "") { this.CheckUserLogin(); MobileOrderDetailConfirmModel mobileSubmiteByCart = OrderApplication.GetMobileSubmiteByCart(this.CurrentUserId, cartItemIds); if (mobileSubmiteByCart.shopBranchInfo == null) { throw new HimallException("获取门店信息失败,不可提交非门店商品"); } ShopBranch shopBranchById = ShopBranchApplication.GetShopBranchById(mobileSubmiteByCart.shopBranchInfo.Id); object obj1 = (object)new ExpandoObject(); object obj2; if (mobileSubmiteByCart.Address != null) { string str = mobileSubmiteByCart.Address.AddressDetail ?? ""; var fAnonymousType30 = new { Id = mobileSubmiteByCart.Address.Id, ShipTo = mobileSubmiteByCart.Address.ShipTo, Phone = mobileSubmiteByCart.Address.Phone, Address = mobileSubmiteByCart.Address.RegionFullName + " " + mobileSubmiteByCart.Address.Address + " " + str, RegionId = mobileSubmiteByCart.Address.RegionId }; obj2 = (object)fAnonymousType30; } else { obj2 = (object)null; } return((object)this.Json(new { Success = "true", Address = obj2, IsCashOnDelivery = mobileSubmiteByCart.IsCashOnDelivery, InvoiceContext = mobileSubmiteByCart.InvoiceContext, InvoiceTitle = OrderApplication.GetInvoiceTitles(this.CurrentUserId), products = mobileSubmiteByCart.products, integralPerMoney = mobileSubmiteByCart.integralPerMoney, userIntegrals = mobileSubmiteByCart.userIntegrals, TotalAmount = mobileSubmiteByCart.totalAmount, Freight = mobileSubmiteByCart.Freight, orderAmount = mobileSubmiteByCart.orderAmount, shopBranchInfo = shopBranchById, IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore, capitalAmount = mobileSubmiteByCart.capitalAmount })); }
/// <summary> /// 发货 /// </summary> /// <param name="context"></param> /// <returns></returns> public string Send(HttpContext context) { string bizcontent = context.Request["bizcontent"]; JObject jo = (JObject)JsonConvert.DeserializeObject(bizcontent); string SendType = GetJObjectValue <string>(jo, "SendType"); string LogisticName = GetJObjectValue <string>(jo, "LogisticName"); string LogisticType = GetJObjectValue <string>(jo, "LogisticType"); string LogisticNo = GetJObjectValue <string>(jo, "LogisticNo"); long OrderId = GetJObjectValue <long>(jo, "PlatOrderNo"); int? IsSplit = GetJObjectValue <int?>(jo, "IsSplit"); string SenderName = GetJObjectValue <string>(jo, "SenderName"); string SenderTel = GetJObjectValue <string>(jo, "SenderTel"); string SenderAddress = GetJObjectValue <string>(jo, "SenderAddress"); int IsHwgFlag = GetJObjectValue <int>(jo, "IsHwgFlag"); if (OrderId <= 0) { throw new HimallApiException("订单号错误"); } Entities.OrderInfo order = OrderApplication.GetOrderInfo(OrderId); if (order == null) { throw new HimallApiException("未找到此订单"); } if (order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitDelivery) { throw new HimallApiException("当前订单状态没有付款或不是等待发货的订单,所以不能发货!"); } if (string.IsNullOrEmpty(LogisticNo)) { throw new HimallApiException("运单号码不能为空!"); } OrderApplication.SellerSendGood(OrderId, "网店管家", LogisticName, LogisticNo); StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("\"code\":" + "\"10000\""); sb.Append(",\"message\":" + "\"SUCCESS\""); sb.Append("}"); return(sb.ToString()); }
public JsonResult FinalizarPedido(FormOfPayment formaPagamento) { if (Session["MeuCarrinho"] != null) { var order = (Order)Session["MeuCarrinho"]; order.FormOfPayment = (int)formaPagamento; var orderApplication = new OrderApplication(SessionManager.GetInstance()); orderApplication.Save(order); Session["MeuCarrinho"] = null; return(Json(new { Resultado = "Sucesso" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Resultado = "Erro" }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 普通商品是否可购买(过滤活动购买数量) /// </summary> /// <param name="userId"></param> /// <param name="productId"></param> /// <param name="count"></param> /// <param name="reason"></param> /// <returns></returns> public static bool CanBuy(long userId, long productId, int count, out int reason) { //TODO:FG 禁止使用 数字常量直接表示意义。 返回值不推荐使用out进行方法返回 var product = Service.GetProduct(productId); if (product.SaleStatus != Entities.ProductInfo.ProductSaleStatus.OnSale || product.AuditStatus != Entities.ProductInfo.ProductAuditStatus.Audited) { reason = 1; return(false); } var skus = Service.GetSKUs(productId); long stock = skus.Sum(p => p.Stock); if (stock == 0) { reason = 9; return(false); } if (product.IsDeleted) { reason = 2; return(false); } if (product.MaxBuyCount <= 0) { reason = 0; return(true); } if (product.IsOpenLadder) { reason = 0; return(true); } var buyedCounts = OrderApplication.GetProductBuyCount(userId, new long[] { productId }); if (product.MaxBuyCount < count + (buyedCounts.ContainsKey(productId) ? buyedCounts[productId] : 0)) { reason = 3; return(false); } reason = 0; return(true); }
/// <summary> /// 门店发货 /// </summary> /// <param name="model"></param> /// <returns></returns> public object PostShopSendGood(OrderDeliveryModel model) { CheckUserLogin(); string shopkeeperName = ""; long shopid = CurrentShopBranch.ShopId; long sbid = CurrentUser.ShopBranchId; shopkeeperName = CurrentShopBranch.UserName; var returnurl = String.Format("{0}/Common/ExpressData/SaveExpressData", CurrentUrlHelper.CurrentUrlNoPort()); if (model.deliveryType == DeliveryType.CityExpress.GetHashCode()) //同城物流 { var dadaconfig = CityExpressConfigApplication.GetDaDaCityExpressConfig(shopid); if (!dadaconfig.IsEnable) { throw new HimallApiException("未开启同城合作物流"); } var order = OrderApplication.GetOrder(model.orderId); if (order == null || order.ShopId != shopid || !(order.ShopBranchId > 0) || order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitDelivery) { throw new HimallApiException("错误的订单编号"); } //Log.Error("达达发货ShopBranchOrder-开始01:orderId:" + model.orderId); var sbdata = ShopBranchApplication.GetShopBranchById(sbid); string json = ExpressDaDaHelper.addAfterQuery(shopid, sbdata.DaDaShopId, model.shipOrderNumber); var resultObj = JsonConvert.DeserializeObject(json) as JObject; string status = resultObj["status"].ToString(); //Log.Error("达达发货ShopBranchOrder-开始02:status:" + status); if (status != "success") { //订单码过期,重发单 json = SendDaDaExpress(model.orderId, shopid, sbid, false); var rObj2 = JsonConvert.DeserializeObject(json) as JObject; string status2 = rObj2["status"].ToString(); if (status2 != "success") { string msg = rObj2["msg"].ToString(); return(ErrorResult(msg)); } } } OrderApplication.ShopSendGood(model.orderId, model.deliveryType, shopkeeperName, model.companyName, model.shipOrderNumber, returnurl); return(SuccessResult("发货成功")); }
public ActionResult PaymentToOrders(string ids) { //红包数据 var bonusGrantIds = new Dictionary <long, Entities.ShopBonusInfo>(); string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/"; if (!string.IsNullOrEmpty(ids)) { string[] strIds = ids.Split(','); List <long> longIds = new List <long>(); foreach (string id in strIds) { longIds.Add(long.Parse(id)); } var result = PaymentHelper.GenerateBonus(longIds, Request.Url.Host.ToString()); foreach (var item in result) { bonusGrantIds.Add(item.Key, item.Value); } } ViewBag.Path = url; ViewBag.BonusGrantIds = bonusGrantIds; ViewBag.Shops = ShopApplication.GetShops(bonusGrantIds.Select(p => p.Value.ShopId)); ViewBag.BaseAddress = CurrentUrlHelper.CurrentUrlNoPort(); var statistic = StatisticApplication.GetMemberOrderStatistic(CurrentUser.Id); ViewBag.WaitingForComments = statistic.WaitingForComments; ViewBag.AllOrders = statistic.OrderCount; ViewBag.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(CurrentUser.Id); ViewBag.WaitingForPay = statistic.WaitingForPay; ViewBag.WaitingForDelivery = statistic.WaitingForDelivery; var order = OrderApplication.GetUserOrders(CurrentUser.Id, 1).FirstOrDefault(); if (order != null && order.OrderType == OrderInfo.OrderTypes.FightGroup) { var gpord = FightGroupApplication.GetOrder(order.Id); if (gpord != null) { return(Redirect(string.Format("/m-{0}/FightGroup/GroupOrderOk?orderid={1}", PlatformType.ToString(), order.Id))); } } return(View("~/Areas/Mobile/Templates/Default/Views/Member/Orders.cshtml")); }
/// <summary> /// 获取拼团订单信息Model /// </summary> /// <param name="skuId"></param> /// <param name="count"></param> /// <param name="GroupActionId"></param> /// <param name="GroupId"></param> /// <returns></returns> public object GetGroupOrderModel(string skuId, int count, long GroupActionId, long?GroupId = null) { CheckUserLogin(); dynamic d = SuccessResult(); Himall.DTO.MobileOrderDetailConfirmModel result = OrderApplication.SubmitByGroupId(CurrentUser.Id, skuId, count, GroupActionId, GroupId); if (result.Address != null) { //result.Address.MemberInfo = new UserMemberInfo(); d.Address = result.Address; } bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); d.canIntegralPerMoney = canIntegralPerMoney; d.canCapital = canCapital; d.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; d.ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(s => s.shopId).Distinct().ToList()); d.products = result.products; d.totalAmount = result.totalAmount; d.Freight = result.Freight; d.orderAmount = result.orderAmount; d.integralPerMoney = result.integralPerMoney; d.integralPerMoneyRate = result.integralPerMoneyRate; d.userIntegralMaxDeductible = result.userIntegralMaxDeductible; d.IntegralDeductibleRate = result.IntegralDeductibleRate; d.userIntegrals = result.userIntegrals; d.capitalAmount = result.capitalAmount; d.memberIntegralInfo = result.memberIntegralInfo; //d.InvoiceContext = result.InvoiceContext; //d.InvoiceTitle = result.InvoiceTitle; d.InvoiceContext = result.InvoiceContext; //发票类容 d.InvoiceTitle = result.InvoiceTitle; //发票抬头 d.cellPhone = result.cellPhone; //默认收票人手机 d.email = result.email; //默认收票人邮箱 d.vatInvoice = result.vatInvoice; //默认增值税发票 d.invoiceName = result.invoiceName; //默认抬头(普通、电子) d.invoiceCode = result.invoiceCode; //默认税号(普通、电子) d.IsCashOnDelivery = result.IsCashOnDelivery; d.Sku = result.Sku; d.Count = result.Count; d.shopBranchInfo = result.shopBranchInfo; return(d); }
/// <summary> /// 点击立即购买调用的GET方法,但是重定向到了Submit页面 /// </summary> /// <param name="skuIds">多个库存Id</param> /// <param name="counts">每个库存对应的数据量</param> /// <param name="regionId">客户收货地区的id</param> /// <param name="collpids">组合购Id集合</param> /// <returns>订单提交页面的数据</returns> public ActionResult SubmitByProductId(string skuIds, string counts, long?regionId, string collpids = null) { //Logo ViewBag.Logo = CurrentSiteSetting.Logo; //获取Logo //设置会员信息 ViewBag.Member = CurrentUser; var submitModel = OrderApplication.SubmitByProductId(UserId, skuIds, counts, regionId, collpids); ViewBag.IsCashOnDelivery = submitModel.IsCashOnDelivery; ViewBag.IsLimitBuy = submitModel.IsLimitBuy; InitOrderSubmitModel(submitModel); #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore; #endregion return(View("Submit", submitModel)); }
public ActionResult Orders(int?orderStatus) { //判断是否需要跳转到支付地址 if (this.Request.Url.AbsolutePath.EndsWith("/member/orders", StringComparison.OrdinalIgnoreCase) && (orderStatus == null || orderStatus == 0 || orderStatus == 1)) { var returnUrl = Request.QueryString["returnUrl"]; return(Redirect(Url.RouteUrl("PayRoute") + "?area=mobile&platform=" + this.PlatformType.ToString() + "&controller=member&action=orders&orderStatus=" + orderStatus + (string.IsNullOrEmpty(returnUrl) ? "" : "&returnUrl=" + HttpUtility.UrlEncode(returnUrl)))); } var statistic = StatisticApplication.GetMemberOrderStatistic(CurrentUser.Id); ViewBag.AllOrders = statistic.OrderCount; ViewBag.WaitingForComments = statistic.WaitingForComments; ViewBag.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(CurrentUser.Id); ViewBag.WaitingForPay = statistic.WaitingForPay; ViewBag.WaitingForDelivery = statistic.WaitingForDelivery; return(View()); }
public ActionResult EditShippingAddress(long addressId = 0L, string returnURL = "", long shopBranchId = 0L) { if (shopBranchId == 0L) { throw new HimallException("获取门店ID失败,不可提交非门店商品"); } ((dynamic)base.ViewBag).shopBranchId = shopBranchId; ShippingAddressInfo userAddress = OrderApplication.GetUserAddress(addressId); ((dynamic)base.ViewBag).addId = addressId; if (userAddress != null) { ((dynamic)base.ViewBag).fullPath = RegionApplication.GetRegionPath(userAddress.RegionId); ((dynamic)base.ViewBag).fullName = RegionApplication.GetFullName(userAddress.RegionId, " "); } return(base.View(userAddress)); }
/// <summary> /// 获取购物车提交页面的数据 /// </summary> /// <param name="cartItemIds">购物车物品id集合</param> /// <returns></returns> object GetSubmitByCartModel(string cartItemIds = "") { CheckUserLogin(); var result = OrderApplication.GetMobileSubmiteByCart(CurrentUserId, cartItemIds); //解决循环引用的序列化的问题 dynamic address = new System.Dynamic.ExpandoObject(); if (result.Address != null) { var add = new { ShippingId = result.Address.Id, ShipTo = result.Address.ShipTo, CellPhone = result.Address.Phone, FullRegionName = result.Address.RegionFullName, FullAddress = result.Address.RegionFullName + " " + result.Address.Address, Address = result.Address.Address, RegionId = result.Address.RegionId }; address = add; } else { address = null; } return(Json(new { Status = "OK", Data = new { Address = address, IsCashOnDelivery = result.IsCashOnDelivery, InvoiceContext = result.InvoiceContext, products = result.products, integralPerMoney = result.integralPerMoney, userIntegrals = result.userIntegrals, TotalAmount = result.totalAmount, Freight = result.Freight, orderAmount = result.orderAmount, IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore } })); }
/// <summary> /// 订单退款减少销量 /// </summary> /// <param name="orderids"></param> public void ReduceSaleCount(OrderRefundInfo refund) { var order = DbFactory.Default.Get <OrderInfo>().Where(p => p.Id == refund.OrderId).FirstOrDefault(); if (order == null) { return; } var orderItem = OrderApplication.GetOrderItem(refund.OrderItemId); //限时购销量 var orderid = orderItem.OrderId; long productid = orderItem.ProductId; var result = DbFactory.Default.Get <FlashSaleInfo>().Where(p => p.Id == orderItem.FlashSaleId && p.ProductId == productid && p.BeginDate <DateTime.Now && p.EndDate> DateTime.Now && p.Status == FlashSaleInfo.FlashSaleStatus.Ongoing).FirstOrDefault(); if (result != null) { var refoundInfo = DbFactory.Default.Get <OrderRefundInfo>().Where(p => p.OrderId == orderid).FirstOrDefault(); if (refoundInfo != null) { long saleCount = 0; //退款取订单详情数量 if (refoundInfo.RefundMode == OrderRefundInfo.OrderRefundMode.OrderRefund) { saleCount = orderItem.Quantity; } //退货退款,取退货数量 else if (refoundInfo.RefundMode == OrderRefundInfo.OrderRefundMode.ReturnGoodsRefund) { if (refund.IsReturn) { //判断是否有会员发货,没有会员发货视为弃货,不扣销量 if (!string.IsNullOrEmpty(refoundInfo.ExpressCompanyName) && !string.IsNullOrEmpty(refoundInfo.ShipOrderNumber)) { saleCount = refoundInfo.ReturnQuantity; } } } //弃货不扣销量 var count = result.SaleCount - (int)saleCount; result.SaleCount = count < 0 ? 0 : count; DbFactory.Default.Update(result); } } }
/// <summary> /// 获得编辑收获地址页面 /// </summary> /// <param name="addressId">收货地址Id</param> /// <param name="returnURL">返回url路径</param> public ActionResult EditShippingAddress(long addressId = 0, string returnURL = "", long shopBranchId = 0) { if (shopBranchId == 0) { throw new MallException("获取门店ID失败,不可提交非门店商品"); } ViewBag.shopBranchId = shopBranchId; var ShipngInfo = OrderApplication.GetUserAddress(addressId); ViewBag.addId = addressId; if (ShipngInfo != null) { ViewBag.fullPath = RegionApplication.GetRegionPath(ShipngInfo.RegionId); ViewBag.fullName = RegionApplication.GetFullName(ShipngInfo.RegionId); } return(View(ShipngInfo)); }