예제 #1
0
        /// <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"));
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        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;
        }
예제 #4
0
        public object GetSubmitByCartModel(string cartItemIds = "", long shippingAddressId = 0, string couponIds = "")
        {
            CheckUserLogin();
            var coupons = CouponApplication.ConvertUsedCoupon(couponIds);
            var result = OrderApplication.GetMobileSubmiteByCart(CurrentUserId, cartItemIds, shippingAddressId, coupons);
            //门店订单
            Mall.DTO.ShopBranch storeInfo = null;
            if (result.shopBranchInfo == null)
                throw new MallException("获取门店信息失败,不可提交非门店商品");
            else
            {
                storeInfo = Application.ShopBranchApplication.GetShopBranchById(result.shopBranchInfo.Id);
            }

            //解决循环引用的序列化的问题
            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;

            bool canIntegralPerMoney = true, canCapital = true;
            CanDeductible(out canIntegralPerMoney, out canCapital);

            var _result = new
            {
                success = true,
                Address = address,
                IsCashOnDelivery = result.IsCashOnDelivery,
                InvoiceContext = result.InvoiceContext,
                InvoiceTitle = result.InvoiceTitle,
                cellPhone = result.cellPhone,
                email = result.email,
                vatInvoice = result.vatInvoice,
                invoiceName = result.invoiceName,//默认抬头(普通、电子)
                invoiceCode = result.invoiceCode,//默认税号(普通、电子)
                products = result.products,
                TotalAmount = result.totalAmount,
                Freight = result.Freight,
                orderAmount = result.orderAmount,
                shopBranchInfo = storeInfo,
                IsOpenStore = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore,
                capitalAmount = result.capitalAmount,
                ProvideInvoice = ShopApplication.HasProvideInvoice(result.products.Select(s => s.shopId).Distinct().ToList()),

                integralPerMoney = result.integralPerMoney,
                userIntegralMaxDeductible = result.userIntegralMaxDeductible,
                integralPerMoneyRate = result.integralPerMoneyRate,
                userIntegralMaxRate = SiteSettingApplication.SiteSettings.IntegralDeductibleRate,
                userIntegrals = result.userIntegrals,
                TotalMemberIntegral = result.memberIntegralInfo.AvailableIntegrals,
                canIntegralPerMoney = canIntegralPerMoney,
                canCapital = canCapital
            };
            return _result;
        }
예제 #5
0
        /// <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());
        }
예제 #6
0
        /// <summary>
        /// 获取购物车提交页面的数据
        /// </summary>
        /// <param name="cartItemIds">购物车物品id集合</param>
        /// <returns></returns>
        object GetSubmitByCartModel(string cartItemIds = "", long shippingAddressId = 0, IEnumerable <string[]> CouponIdsStr = null, bool isStore = false)
        {
            CheckUserLogin();
            var result = OrderApplication.GetMobileSubmiteByCart(CurrentUserId, cartItemIds, shippingAddressId, CouponIdsStr);

            Mall.DTO.ShopBranch storeInfo = null;
            if (isStore)
            {
                if (result.shopBranchInfo == null)
                {
                    throw new MallException("获取门店信息失败,不可提交非门店商品");
                }
                else
                {
                    storeInfo = Application.ShopBranchApplication.GetShopBranchById(result.shopBranchInfo.Id);
                }
            }
            //解决循环引用的序列化的问题
            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 + " " + result.Address.AddressDetail,
                    Address        = result.Address.Address,
                    RegionId       = result.Address.RegionId
                };
                address = add;
            }
            else
            {
                address = null;
            }

            bool canIntegralPerMoney = true, canCapital = true;

            CanDeductible(out canIntegralPerMoney, out canCapital);
            var data = new
            {
                Address                   = address,
                IsCashOnDelivery          = result.IsCashOnDelivery,
                InvoiceContext            = result.InvoiceContext,
                InvoiceTitle              = result.InvoiceTitle,
                cellPhone                 = result.cellPhone,
                email                     = result.email,
                vatInvoice                = result.vatInvoice,
                invoiceName               = result.invoiceName, //默认抬头(普通、电子)
                invoiceCode               = result.invoiceCode, //默认税号(普通、电子)
                products                  = result.products,
                TotalAmount               = result.totalAmount,
                Freight                   = result.Freight,
                orderAmount               = result.orderAmount,
                IsOpenStore               = SiteSettingApplication.SiteSettings != null && SiteSettingApplication.SiteSettings.IsOpenStore,
                integralPerMoney          = result.integralPerMoney,
                userIntegralMaxDeductible = result.userIntegralMaxDeductible,
                integralPerMoneyRate      = result.integralPerMoneyRate,
                userIntegralMaxRate       = SiteSettingApplication.SiteSettings.IntegralDeductibleRate,
                userIntegrals             = result.userIntegrals,
                TotalMemberIntegral       = result.memberIntegralInfo.AvailableIntegrals,
                canIntegralPerMoney       = canIntegralPerMoney,
                canCapital                = canCapital,
                capitalAmount             = result.capitalAmount,
                shopBranchInfo            = storeInfo,
                ProvideInvoice            = storeInfo == null ? false : ShopApplication.HasProvideInvoice(result.products.Select(s => s.shopId).Distinct().ToList())
            };

            return(Json(data));
        }
예제 #7
0
        /// <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);
        }