/// <summary> /// 获取立即购买提交页面的数据 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> public object GetSubmitModel(string skuId, int count) { CheckUserLogin(); var result = OrderApplication.GetMobileSubmit(CurrentUserId, skuId.ToString(), count.ToString()); dynamic d = new System.Dynamic.ExpandoObject(); if (result.Address != null) { var add = new { Id = result.Address.Id, ShipTo = result.Address.ShipTo, Phone = result.Address.Phone, Address = result.Address.RegionFullName + " " + result.Address.Address, RegionId = result.Address.RegionId }; d.Address = add; } else { d.Address = null; } d.Success = "true";; d.InvoiceContext = result.InvoiceContext; d.products = result.products; d.integralPerMoney = result.integralPerMoney; d.userIntegrals = result.userIntegrals; d.TotalAmount = result.totalAmount; d.Freight = result.Freight; d.orderAmount = result.orderAmount; d.IsCashOnDelivery = result.IsCashOnDelivery; d.IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore; return(d); }
/// <summary> /// 进入立即购买提交页面 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> /// <param name="GroupActionId">拼团活动编号</param> /// <param name="GroupId">拼团编号</param> public ActionResult Submit(string skuIds, string counts, int islimit = 0, long shippingAddressId = 0, string couponIds = "") { var coupons = CouponApplication.ConvertUsedCoupon(couponIds); var result = OrderApplication.GetMobileSubmit(UserId, skuIds, counts, shippingAddressId, coupons); ViewBag.InvoiceContext = result.InvoiceContext; ViewBag.InvoiceTitle = result.InvoiceTitle; ViewBag.skuIds = skuIds; ViewBag.counts = counts; ViewBag.IsCashOnDelivery = result.IsCashOnDelivery; ViewBag.address = null == result.Address || result.Address.NeedUpdate ? null : result.Address; ViewBag.ConfirmModel = result; ViewBag.Islimit = islimit == 1 ? true : false; var orderTag = Guid.NewGuid().ToString("N"); ViewBag.OrderTag = orderTag; Session["OrderTag"] = orderTag; InitOrderSubmitModel(result); #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; #endregion #region TDO:ZYF 3.2注释是否提供发票 //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 = result.ProductType; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (result.ProductType == 1) { var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new HimallException("该虚拟商品已过期,不支持下单"); } if (result.products != null && result.products.Count > 0) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(result.products.FirstOrDefault().shopId); if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } ViewBag.ShipperAddress = shipperAddress; ViewBag.ShipperTelPhone = shipperTelPhone; return(View()); }
/// <summary> /// 获取立即购买提交页面的数据 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> object GetSubmitModelById(string skuId, int count) { CheckUserLogin(); var result = OrderApplication.GetMobileSubmit(CurrentUserId, skuId.ToString(), count.ToString()); dynamic d = new System.Dynamic.ExpandoObject(); dynamic add = new System.Dynamic.ExpandoObject(); if (result.Address != null) { 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 }; } else { add = null; } d.Status = "OK"; d.Data = new { InvoiceContext = result.InvoiceContext, products = result.products, integralPerMoney = result.integralPerMoney, userIntegrals = result.userIntegrals, TotalAmount = result.totalAmount, Freight = result.Freight, orderAmount = result.orderAmount, IsCashOnDelivery = result.IsCashOnDelivery, IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore, Address = add }; return(d); }
public ActionResult Submit(string skuIds, string counts, int islimit = 0) { MobileOrderDetailConfirmModel model = OrderApplication.GetMobileSubmit(base.UserId, skuIds, counts); ViewBag.InvoiceContext = model.InvoiceContext; ViewBag.InvoiceTitle = model.InvoiceTitle; ViewBag.skuIds = skuIds; ViewBag.counts = counts; ViewBag.IsCashOnDelivery = model.IsCashOnDelivery; ViewBag.address = model.Address; ViewBag.ConfirmModel = model; ViewBag.Islimit = islimit == 1; string str = Guid.NewGuid().ToString("N"); ViewBag.OrderTag = str; base.Session["OrderTag"] = str; this.InitOrderSubmitModel(model); ViewBag.IsOpenStore = (SiteSettingApplication.GetSiteSettings() != null) && SiteSettingApplication.GetSiteSettings().IsOpenStore; bool flag = false; if (model.products != null) { foreach (MobileShopCartItemModel model2 in model.products) { if (model2.shopId > 0L) { ShopInfo shop = ShopApplication.GetShop(model2.shopId, false); if (!(!shop.ProvideInvoice.HasValue ? true : !shop.ProvideInvoice.Value)) { flag = true; } } } } ViewBag.ProvideInvoice = flag; return(base.View()); }
/// <summary> /// 进入立即购买提交页面 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> /// <param name="GroupActionId">拼团活动编号</param> /// <param name="GroupId">拼团编号</param> public ActionResult Submit(string skuIds, string counts, int islimit = 0) { var result = OrderApplication.GetMobileSubmit(UserId, skuIds, counts); ViewBag.InvoiceContext = result.InvoiceContext; ViewBag.skuIds = skuIds; ViewBag.counts = counts; ViewBag.IsCashOnDelivery = result.IsCashOnDelivery; ViewBag.address = result.Address; ViewBag.ConfirmModel = result; ViewBag.Islimit = islimit == 1 ? true : false; var orderTag = Guid.NewGuid().ToString("N"); ViewBag.OrderTag = orderTag; Session["OrderTag"] = orderTag; InitOrderSubmitModel(result); #region 是否开启门店授权 ViewBag.IsOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore; #endregion return(View()); }
public object GetSubmitModel(string skuId, int count, long shippingAddressId = 0, string couponIds = "", sbyte productType = 0, long shopBranchId = 0) { if (productType == 0) throw new MallException("门店订单暂时不允许立即购买"); //门店订单 Mall.DTO.ShopBranch storeInfo = Application.ShopBranchApplication.GetShopBranchById(shopBranchId); if (storeInfo == null) throw new MallException("获取门店信息失败,不可提交非门店商品"); CheckUserLogin(); var coupons = CouponApplication.ConvertUsedCoupon(couponIds); var result = OrderApplication.GetMobileSubmit(CurrentUserId, skuId.ToString(), count.ToString(), shippingAddressId, coupons, shopBranchId); dynamic d = SuccessResult(); bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); //解决循环引用的序列化的问题 dynamic address = new System.Dynamic.ExpandoObject(); if (result.Address != null) { var addDetail = result.Address.AddressDetail ?? ""; var add = new { Id = result.Address.Id, ShipTo = result.Address.ShipTo, Phone = result.Address.Phone, Address = result.Address.RegionFullName + " " + result.Address.Address + " " + addDetail, RegionId = result.Address.RegionId }; address = add; } else address = null; //d.InvoiceContext = result.InvoiceContext; //d.InvoiceTitle = OrderApplication.GetInvoiceTitles(CurrentUserId); 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.products = result.products; d.TotalAmount = result.totalAmount; d.Freight = result.Freight; d.orderAmount = result.orderAmount; d.IsCashOnDelivery = result.IsCashOnDelivery; d.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; d.ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(s => s.shopId).Distinct().ToList()); d.integralPerMoney = result.integralPerMoney; d.userIntegralMaxDeductible = result.userIntegralMaxDeductible; d.integralPerMoneyRate = result.integralPerMoneyRate; d.userIntegralMaxRate = SiteSettingApplication.SiteSettings.IntegralDeductibleRate; d.userIntegrals = result.userIntegrals; d.TotalMemberIntegral = result.memberIntegralInfo.AvailableIntegrals; d.canIntegralPerMoney = canIntegralPerMoney; d.canCapital = canCapital; d.capitalAmount = result.capitalAmount; d.productType = productType; d.shopBranchId = shopBranchId; d.shopBranchInfo = storeInfo; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (productType == 1) { var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new MallException("该虚拟商品已过期,不支持下单"); } if (storeInfo != null) { shipperAddress = RegionApplication.GetFullName(storeInfo.AddressId) + storeInfo.AddressDetail;//ShopBranchApplication.RenderAddress(storeInfo.AddressPath, storeInfo.AddressDetail, 2); shipperTelPhone = storeInfo.ContactPhone; } } d.shipperAddress = shipperAddress; d.shipperTelPhone = shipperTelPhone; return d; }
/// <summary> /// 进入立即购买提交页面 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> /// <param name="GroupActionId">拼团活动编号</param> /// <param name="GroupId">拼团编号</param> public ActionResult Submit(string skuIds, string counts, int islimit = 0, long shippingAddressId = 0, string couponIds = "", sbyte productType = 0, long shopBranchId = 0) { if (productType == 0) { throw new MallException("门店订单不支持立即购买"); } var coupons = CouponApplication.ConvertUsedCoupon(couponIds); var result = OrderApplication.GetMobileSubmit(UserId, skuIds, counts, shippingAddressId, coupons, shopBranchId); ViewBag.InvoiceContext = result.InvoiceContext; ViewBag.InvoiceTitle = result.InvoiceTitle; ViewBag.skuIds = skuIds; ViewBag.counts = counts; ViewBag.IsCashOnDelivery = result.IsCashOnDelivery; ViewBag.address = null == result.Address || result.Address.NeedUpdate ? null : result.Address; if (result.products != null) { var bid = result.products.FirstOrDefault().ShopBranchId; result.shopBranchInfo = ShopBranchApplication.GetShopBranchInfoById(bid); } ViewBag.ConfirmModel = result; ViewBag.Islimit = islimit == 1 ? true : false; string orderTag = Guid.NewGuid().ToString("N"); ViewBag.OrderTag = orderTag; //Session["OrderTag"] = orderTag; base.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 = productType; ViewBag.shopBranchId = shopBranchId; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (productType == 1) { var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new MallException("该虚拟商品已过期,不支持下单"); } if (result.shopBranchInfo != null) { shipperAddress = RegionApplication.GetFullName(result.shopBranchInfo.AddressId) + result.shopBranchInfo.AddressDetail; shipperTelPhone = result.shopBranchInfo.ContactPhone; } } ViewBag.ShipperAddress = shipperAddress; ViewBag.ShipperTelPhone = shipperTelPhone; return(View()); }
/// <summary> /// 获取立即购买提交页面的数据 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> object GetSubmitModelById(string skuId, int count, long shippingAddressId = 0, IEnumerable <string[]> CouponIdsStr = null, bool isStore = false, sbyte productType = 0, long shopBranchId = 0) { CheckUserLogin(); dynamic d = new System.Dynamic.ExpandoObject(); var siteconfig = SiteSettingApplication.SiteSettings; var result = OrderApplication.GetMobileSubmit(CurrentUserId, skuId.ToString(), count.ToString(), shippingAddressId, CouponIdsStr, shopBranchId); dynamic add = new System.Dynamic.ExpandoObject(); if (result.Address != null) { 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 + " " + result.Address.AddressDetail, Address = result.Address.Address, RegionId = result.Address.RegionId }; } else { add = null; } string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (isStore) { if (productType == 0) { throw new MallException("门店订单暂时不允许立即购买"); } //门店订单 Mall.DTO.ShopBranch storeInfo = Application.ShopBranchApplication.GetShopBranchById(shopBranchId); if (storeInfo == null) { throw new MallException("获取门店信息失败,不可提交非门店商品"); } d.shopBranchId = shopBranchId; d.shopBranchInfo = storeInfo; if (storeInfo != null) { shipperAddress = RegionApplication.GetFullName(storeInfo.AddressId) + storeInfo.AddressDetail; shipperTelPhone = storeInfo.ContactPhone; } } d.ProductType = productType; if (result.ProductType == 1) { d.VirtualProductItemInfos = ProductManagerApplication.GetVirtualProductItemInfoByProductId(result.ProductId); var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new MallException("该虚拟商品已过期,不支持下单"); } if (result.products != null && result.products.Count > 0 && !isStore) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(result.products.FirstOrDefault().shopId);//虚拟订单支持立即购买所以商家只有一个 if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } d.shipperAddress = shipperAddress; d.shipperTelPhone = shipperTelPhone; bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); 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.products = result.products; d.TotalAmount = result.totalAmount; d.Freight = result.Freight; d.orderAmount = result.orderAmount; d.IsCashOnDelivery = result.IsCashOnDelivery; d.IsOpenStore = siteconfig.IsOpenStore; d.Address = add; d.integralPerMoney = result.integralPerMoney; d.userIntegralMaxDeductible = result.userIntegralMaxDeductible; d.integralPerMoneyRate = result.integralPerMoneyRate; d.userIntegralMaxRate = siteconfig.IntegralDeductibleRate; d.userIntegrals = result.userIntegrals; d.TotalMemberIntegral = result.memberIntegralInfo.AvailableIntegrals; d.canIntegralPerMoney = canIntegralPerMoney; d.canCapital = canCapital; d.capitalAmount = result.capitalAmount; return(Json(d)); }
/// <summary> /// 获取立即购买提交页面的数据 /// </summary> /// <param name="skuIds">库存ID集合</param> /// <param name="counts">库存ID对应的数量</param> public object GetSubmitModel(string skuId, int count, long shippingAddressId = 0, string couponIds = "") { CheckUserLogin(); var coupons = CouponApplication.ConvertUsedCoupon(couponIds); var result = OrderApplication.GetMobileSubmit(CurrentUserId, skuId.ToString(), count.ToString(), shippingAddressId, coupons); dynamic d = SuccessResult(); if (result.Address != null && !result.Address.NeedUpdate) { var addDetail = result.Address.AddressDetail ?? ""; var add = new { Id = result.Address.Id, ShipTo = result.Address.ShipTo, Phone = result.Address.Phone, Address = result.Address.RegionFullName + " " + result.Address.Address + " " + addDetail, RegionId = result.Address.RegionId }; d.Address = add; } else { d.Address = null; } bool canIntegralPerMoney = true, canCapital = true; CanDeductible(out canIntegralPerMoney, out canCapital); d.canIntegralPerMoney = canIntegralPerMoney; d.canCapital = canCapital; //发票信息 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.products = result.products; d.capitalAmount = result.capitalAmount; d.TotalAmount = result.totalAmount; d.Freight = result.Freight; d.orderAmount = result.orderAmount; d.IsCashOnDelivery = result.IsCashOnDelivery; d.IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore; d.ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(s => s.shopId).Distinct().ToList()); d.integralPerMoney = result.integralPerMoney; d.userIntegralMaxDeductible = result.userIntegralMaxDeductible; d.integralPerMoneyRate = result.integralPerMoneyRate; d.userIntegralMaxRate = SiteSettingApplication.SiteSettings.IntegralDeductibleRate; d.userIntegrals = result.userIntegrals; d.TotalMemberIntegral = result.memberIntegralInfo.AvailableIntegrals; d.productType = result.ProductType; string shipperAddress = string.Empty, shipperTelPhone = string.Empty; if (result.ProductType == 1) { var virtualProductInfo = ProductManagerApplication.GetVirtualProductInfoByProductId(result.ProductId); if (virtualProductInfo != null && virtualProductInfo.ValidityType && DateTime.Now > virtualProductInfo.EndDate.Value) { throw new HimallException("该虚拟商品已过期,不支持下单"); } if (result.products != null && result.products.Count > 0) { var verificationShipper = ShopShippersApplication.GetDefaultVerificationShipper(result.products.FirstOrDefault().shopId);//虚拟订单支持立即购买所以商家只有一个 if (verificationShipper != null) { shipperAddress = RegionApplication.GetFullName(verificationShipper.RegionId) + " " + verificationShipper.Address; shipperTelPhone = verificationShipper.TelPhone; } } } d.shipperAddress = shipperAddress; d.shipperTelPhone = shipperTelPhone; return(d); }