Exemplo n.º 1
0
        public JsonResult Skip(string serviceProvider, string openId, string nickName, string realName, string headimgurl, MemberOpenIdInfo.AppIdTypeEnum appidtype = MemberOpenIdInfo.AppIdTypeEnum.Normal, string unionid = null, string sex = null, string city = null, string province = null)
        {
            int    num      = 0;
            string username = DateTime.Now.ToString("yyMMddHHmmssffffff");   //TODO:DZY[150916]未使用,在方法内会重新生成

            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            realName   = System.Web.HttpUtility.UrlDecode(realName);
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            UserMemberInfo memberInfo = _iMemberService.GetMemberByUnionId(openId);

            if (memberInfo == null)
            {
                memberInfo = _iMemberService.QuickRegister(username, realName, nickName, serviceProvider, openId, unionid, sex, headimgurl, appidtype, null, city, province);
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                _iBonusService.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                num = CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
            }

            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            WebHelper.SetCookie(CookieKeysCollection.HIMALL_ACTIVELOGOUT, "0", DateTime.MaxValue);
            return(Json(new { success = true, num = num }));
        }
        /// <summary>
        /// 修改注册赠送优惠券设置
        /// </summary>
        /// <param name="CouponRegisterId">设置主键ID</param>
        /// <param name="status">状态</param>
        /// <param name="couponIds">优惠券ID,用','隔开</param>
        /// <returns></returns>
        public JsonResult Update(long CouponRegisterId, CouponSendByRegisterStatus status, string couponIds)
        {
            var coupons = couponIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(p => long.Parse(p))
                          .ToList();

            if (status == CouponSendByRegisterStatus.Open && coupons.Count == 0)
            {
                return(Json(new Result()
                {
                    success = false, msg = "请选择优惠券"
                }));
            }

            var model = new CouponSendByRegisterModel()
            {
                Id        = CouponRegisterId,
                Link      = "#",
                Status    = status,
                CouponIds = coupons.Select(p => new CouponModel {
                    Id = p
                }).ToList()
            };

            CouponApplication.SetCouponSendByRegister(model);
            return(Json(new Result()
            {
                success = true, msg = "设置成功"
            }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 提交订单页面显示
        /// </summary>
        /// <param name="cartItemIds">提交的购物车物品集合</param>
        /// <param name="regionId">客户送货区域标识</param>
        public ActionResult Submit(string cartItemIds, long?regionId, string CouponIds = "")
        {
            //Logo
            ViewBag.Logo = SiteSettings.Logo;//获取Logo
            ViewBag.Step = 2;
            //设置会员信息
            ViewBag.Member = CurrentUser;
            string cartInfo    = WebHelper.GetCookie(CookieKeysCollection.Mall_CART);
            var    coupons     = CouponApplication.ConvertUsedCoupon(CouponIds);
            var    submitModel = OrderApplication.Submit(cartItemIds, regionId, UserId, cartInfo, coupons);

            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;
            return(View(submitModel));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取优惠券信息
        /// </summary>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetCouponDetail(string openId, int couponId = 0)
        {
            if (couponId <= 0)
            {
                return(Json(ErrorResult <dynamic>("参数错误")));
            }
            CouponInfo coupon = CouponApplication.GetCouponInfo(couponId);

            if (coupon == null)
            {
                return(Json(ErrorResult <dynamic>("错误的优惠券编号")));
            }
            else
            {
                return(JsonResult <dynamic>(new
                {
                    CouponId = coupon.Id,
                    CouponName = coupon.CouponName,
                    Price = coupon.Price,
                    SendCount = coupon.Num,
                    UserLimitCount = coupon.PerMax,
                    OrderUseLimit = Math.Round(coupon.OrderAmount, 2),
                    StartTime = coupon.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    ClosingTime = coupon.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    CanUseProducts = "",
                    ObtainWay = coupon.ReceiveType,
                    NeedPoint = coupon.NeedIntegral,
                    UseWithGroup = false,
                    UseWithPanicBuying = false,
                    UseWithFireGroup = false,
                    Remark = coupon.Remark,
                    UseArea = coupon.UseArea
                }));
            }
        }
Exemplo n.º 5
0
        public JsonResult InviteRegist(string serviceProvider, string openId, string username, string password, string nickName, string headimgurl, long introducer, string sex, string city = null, string province = null, string unionid = null, string mobile = null)
        {
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            username   = System.Web.HttpUtility.UrlDecode(username);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            var platform = PlatformType.GetHashCode();//注册终端来源

            Entities.MemberInfo member;
            if (string.IsNullOrWhiteSpace(username))
            {
                username = mobile;
            }
            if (!string.IsNullOrWhiteSpace(serviceProvider) && !string.IsNullOrWhiteSpace(openId))
            {
                member = _iMemberService.Register(username, password, serviceProvider, openId, platform, sex, headimgurl, introducer, nickName
                                                  , city, province, unionid, spreadId: CurrentSpreadId);
            }
            else
            {
                member = _iMemberService.Register(username, password, platform, mobile, "", introducer, spreadId: CurrentSpreadId);
            }

            //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
            _iBonusService.DepositToRegister(member.Id);
            //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
            int num = CouponApplication.RegisterSendCoupon(member.Id, member.UserName);

            ClearDistributionSpreadCookie();
            base.SetUserLoginCookie(member.Id);
            Application.MemberApplication.UpdateLastLoginDate(member.Id);
            _iMemberService.AddIntegel(member); //给用户加积分//执行登录后初始化相关操作
            return(Json <dynamic>(success: true, data: new { memberId = member.Id, num = num }));
        }
Exemplo n.º 6
0
        /// <summary>
        ///一键登录
        /// </summary>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetQuickLogin(string openId = "", string nickName = "", string headImage = "", long?spreadId = null)
        {
            var    wxuserinfo = ApiHelper.GetAppletUserInfo(Request);
            string unionid    = string.Empty;

            if (wxuserinfo != null)
            {
                unionid = wxuserinfo.unionId;
            }
            string unionopenid = "";

            if (!string.IsNullOrEmpty(openId))
            {
                headImage = System.Web.HttpUtility.UrlDecode(headImage);
                nickName  = System.Web.HttpUtility.UrlDecode(nickName);
                string username = DateTime.Now.ToString("yyMMddHHmmssffffff");
                var    member   = ServiceProvider.Instance <IMemberService> .Create.QuickRegister(username, string.Empty, nickName, SmallProgServiceProvider, openId, (int)PlatformType.WeiXinSmallProg, unionid, unionopenid : unionopenid, headImage : headImage, spreadId : spreadId);

                if (member != null)
                {
                    //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                    BonusApplication.DepositToRegister(member.Id);
                    //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                    if (member.IsNewAccount)
                    {
                        CouponApplication.RegisterSendCoupon(member.Id, member.UserName);
                    }
                }
                return(GetMember(member, openId));
            }
            return(Json(ErrorResult <dynamic>(string.Empty)));
        }
Exemplo n.º 7
0
        public ActionResult GetReceivers(long Id, int page, int rows)
        {
            CouponRecordQuery query = new CouponRecordQuery();

            query.CouponId = Id;
            query.ShopId   = CurrentSellerManager.ShopId;
            query.PageNo   = page;
            query.PageSize = rows;
            var record  = _iCouponService.GetCouponRecordList(query);
            var coupons = CouponApplication.GetCouponInfo(record.Models.Select(p => p.CouponId));
            var list    = record.Models.Select(item =>
            {
                var coupon = coupons.FirstOrDefault(p => p.Id == item.CouponId);
                return(new
                {
                    Id = item.Id,
                    Price = Math.Round(coupon.Price, 2),
                    CreateTime = coupon.CreateTime.ToString("yyyy-MM-dd"),
                    CouponSN = item.CounponSN,
                    UsedTime = item.UsedTime.HasValue ? item.UsedTime.Value.ToString("yyyy-MM-dd") : "",
                    ReceviceTime = item.CounponTime.ToString("yyyy-MM-dd"),
                    Recever = item.UserName,
                    OrderId = item.OrderId,
                    Status = item.CounponStatus == Entities.CouponRecordInfo.CounponStatuses.Unuse ? (coupon.EndTime < DateTime.Now.Date ? "已过期" : item.CounponStatus.ToDescription()) : item.CounponStatus.ToDescription(),
                });
            });
            var model = new { rows = list, total = record.Total };

            return(Json(model));
        }
Exemplo n.º 8
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;

            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;
            return(View("submit"));
        }
Exemplo n.º 9
0
        public JsonResult InviteRegist(string serviceProvider, string openId, string username, string password, string nickName, string headimgurl, long introducer, string sex, string city = null, string province = null, string unionid = null, string mobile = null)
        {
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            username   = System.Web.HttpUtility.UrlDecode(username);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            UserMemberInfo member;

            if (string.IsNullOrWhiteSpace(username))
            {
                username = mobile;
            }
            if (!string.IsNullOrWhiteSpace(serviceProvider) && !string.IsNullOrWhiteSpace(openId))
            {
                member = _iMemberService.Register(username, password, serviceProvider, openId, sex, headimgurl, introducer, nickName, city, province, unionid);
            }
            else
            {
                member = _iMemberService.Register(username, password, mobile, "", introducer);
            }

            //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
            _iBonusService.DepositToRegister(member.Id);
            //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
            int num = CouponApplication.RegisterSendCoupon(member.Id, member.UserName);

            base.SetUserLoginCookie(member.Id);
            Application.MemberApplication.UpdateLastLoginDate(member.Id);
            return(Json(new { success = true, memberId = member.Id, num = num }));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 注册赠送优惠券
        /// </summary>
        /// <returns></returns>
        private int RegisterSendCoupon(long Id, string UserName)
        {
            Log.Info("注册赠送优惠券方法进入");
            var iCouponSendByRegisterService = ServiceProvider.Instance <ICouponSendByRegisterService> .Create;
            var iCouponService = ServiceProvider.Instance <ICouponService> .Create;

            return(CouponApplication.RegisterSendCoupon(Id, UserName));
        }
Exemplo n.º 11
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 = "")
        {
            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>
        /// <returns></returns>
        public ActionResult Gift()
        {
            if (IsMobileTerminal)
            {
                Response.Redirect("/m-Wap/RegisterActivity/Gift");
            }
            var model = CouponApplication.GetCouponSendByRegister();

            return(View(model));
        }
Exemplo n.º 13
0
        public JsonResult RegisterUser(string username, string password, string mobile, string email, string checkCode, long introducer = 0)
        {
            var siteset = SiteSettings;

            if (siteset.RegisterEmailRequired)
            {
                if (string.IsNullOrWhiteSpace(email))
                {
                    return(Json(new { success = false, msg = "错误的电子邮箱地址" }));
                }
            }
            if (siteset.MobileVerifOpen)
            {
                if (string.IsNullOrWhiteSpace(mobile))
                {
                    return(Json(new { success = false, msg = "错误的手机号码" }));
                }
            }

            if (StringHelper.GetStringLength(username) > CommonModel.CommonConst.MEMBERNAME_LENGTH)
            {
                var unicodeChar = CommonModel.CommonConst.MEMBERNAME_LENGTH / 2;

                return(Json(new { success = false, msg = "用户名最大长度为" + CommonModel.CommonConst.MEMBERNAME_LENGTH + "位," + unicodeChar + "个中文字符" }));
            }

            var cacheCheckCode = Session[CHECK_CODE_KEY] as string;

            if (cacheCheckCode == null || string.IsNullOrEmpty(checkCode) || checkCode.ToLower() != cacheCheckCode.ToLower())
            {
                return(Json(new { success = false, msg = "验证码错误" }));
            }

            var member = _iMemberService.Register(username, password, (int)PlatformType.PC, mobile, email, introducer);

            if (member != null)
            {
                //自动登录
                _iMemberService.Login(username, password);

                base.SetUserLoginCookie(member.Id);

                Session.Remove(CHECK_CODE_KEY);
                if (!string.IsNullOrEmpty(mobile))
                {
                    Core.Cache.Remove(CacheKeyCollection.MemberPluginCheck(mobile, "Himall.Plugin.Message.SMS"));
                }
            }
            //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
            _iBonusService.DepositToRegister(member.Id);
            //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
            int num = CouponApplication.RegisterSendCoupon(member.Id, member.UserName);

            return(Json(new { success = true, memberId = member.Id, num = num }));
        }
        /// <summary>
        /// 发送优惠券
        /// </summary>
        /// <param name="labelids">标签ID</param>
        /// <param name="couponIds">优惠券ID</param>
        /// <param name="labelinfos">标签名称</param>
        /// <returns></returns>
        public JsonResult SendCouponMsg(string labelids, string couponIds, string labelinfos)
        {
            string msg     = CouponApplication.SendCouponMsg(labelids, labelinfos, couponIds, Request.Url.Authority);
            bool   success = false;

            if (msg.Equals(""))
            {
                success = true;
                msg     = "发送成功!";
            }
            return(Json(new { success = success, msg = msg }));
        }
Exemplo n.º 15
0
        public JsonResult Coupon()
        {
            int  memberIntegral = 0; List <Coupon> baseCoupons = new List <Coupon>();
            long shopId = CurrentSellerManager != null ? CurrentSellerManager.ShopId : 0;

            if (CurrentUser != null)
            {
                memberIntegral = MemberIntegralApplication.GetMemberIntegral(CurrentUser.Id).AvailableIntegrals;

                //优惠卷
                var coupons = CouponApplication.GetAllUserCoupon(CurrentUser.Id).ToList();
                coupons = coupons == null ? new List <UserCouponInfo>() : coupons;
                if (coupons != null)
                {
                    baseCoupons.AddRange(coupons.Select(p => new Coupon()
                    {
                        BasePrice    = p.Price,
                        BaseShopId   = p.ShopId,
                        BaseShopName = p.ShopName,
                        BaseType     = p.BaseType,
                        OrderAmount  = p.OrderAmount
                    }));
                }

                //红包
                var shopBonus = ShopBonusApplication.GetCanUseDetailByUserId(CurrentUser.Id);
                shopBonus = shopBonus == null ? new List <ShopBonusReceiveInfo>() : shopBonus;
                if (shopBonus != null)
                {
                    baseCoupons.AddRange(shopBonus.Select(p => {
                        var grant = _iShopBonusService.GetGrant(p.BonusGrantId);
                        var bonus = _iShopBonusService.GetShopBonus(grant.ShopBonusId);
                        var shop  = ShopApplication.GetShop(bonus.ShopId);

                        return(new Coupon()
                        {
                            BasePrice = p.Price,
                            BaseShopId = shop.Id,
                            BaseShopName = shop.ShopName,
                            BaseType = p.BaseType,
                            UseState = bonus.UseState,
                            UsrStatePrice = bonus.UsrStatePrice
                        });
                    }));
                }
            }
            return(Json(new
            {
                memberIntegral = memberIntegral,
                baseCoupons = baseCoupons,
                shopId = shopId
            }, true));
        }
Exemplo n.º 16
0
        public JsonResult CouponList(string name, int page, int rows)
        {
            var result = CouponApplication.GetCouponByName(name, DateTime.Now, 2, page, rows);//主动发放
            var datas  = result.Models.ToList();
            DataGridModel <Mall.DTO.CouponModel> couponModel = new DataGridModel <Mall.DTO.CouponModel>
            {
                rows  = datas,
                total = result.Total
            };

            return(Json(couponModel, true));
        }
Exemplo n.º 17
0
        public JsonResult SendAllCouponBymember(MemberQuery query, string couponIds)
        {
            var cIds = couponIds.Split(',').Select(s => long.Parse(s));

            if (cIds.Count() == 0)
            {
                throw new MallException("请选择优惠券!");
            }
            CouponApplication.SendCoupon(null, cIds, query);
            return(Json(new Result {
                success = true, msg = "发送成功!"
            }));
        }
Exemplo n.º 18
0
        /// <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));
        }
Exemplo n.º 19
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"));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 注册有礼
        /// </summary>
        /// <returns></returns>
        public ActionResult Gift()
        {
            if (!IsMobileTerminal)
            {
                Response.Redirect("/RegisterActivity/Gift");
            }
            var model = CouponApplication.GetCouponSendByRegister();

            if (model != null && model.Status.Equals(Himall.CommonModel.CouponSendByRegisterStatus.Open) && model.total > 0)
            {
            }
            else
            {
                Response.Redirect("end");
            }
            return(View(model));
        }
Exemplo n.º 21
0
        public object GetSubmitModel(string cartItemIds, string productSku, WXSmallProgFromPageType fromPage, long buyAmount = 0, long shippingAddressId = 0, string couponIds = "", bool isStore = false, sbyte productType = 0, long shopBranchId = 0)
        {
            CheckUserLogin();
            var coupons = CouponApplication.ConvertUsedCoupon(couponIds);

            if (fromPage == WXSmallProgFromPageType.SignBuy)
            {
                if (!string.IsNullOrWhiteSpace(productSku))
                {
                    return(GetSubmitModelById(productSku, (int)buyAmount, shippingAddressId, coupons, isStore, productType, shopBranchId));
                }
            }
            if (fromPage == WXSmallProgFromPageType.Cart)
            {
                return(GetSubmitByCartModel(cartItemIds, shippingAddressId, coupons, isStore));
            }
            return(Json(ErrorResult <dynamic>(string.Empty)));
        }
Exemplo n.º 22
0
        public JsonResult GetCouponByName(string text, int page, int pageSize, string endtime = "", int ReceiveType = -1)
        {
            DateTime dtime = DateTime.Parse("1900-01-01");

            if (!endtime.Equals(""))
            {
                dtime = Convert.ToDateTime(endtime);
            }
            var result = CouponApplication.GetCouponByName(text, dtime, 2, page, pageSize);//主动发放
            var datas  = result.Models.ToList();
            DataGridModel <CouponModel> CouponModel = new DataGridModel <CouponModel>
            {
                rows  = datas,
                total = result.Total
            };

            return(Json(CouponModel));
        }
Exemplo n.º 23
0
        /// <summary>
        /// 获取系统可领取优惠券列表
        /// </summary>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetLoadSiteCoupon(string openId = "", int pageSize = 10, int pageIndex = 1, int obtainWay = 1)
        {
            CheckUserLogin();
            CouponRecordQuery query = new CouponRecordQuery();

            query.UserId   = CurrentUser.Id;
            query.PageNo   = pageIndex;
            query.PageSize = pageSize;
            if (obtainWay == 1) //(1=未使用 2=已使用 3=已过期)
            {
                query.Status = 0;
            }
            else if (obtainWay == 2)
            {
                query.Status = 1;
            }
            else
            {
                query.Status = obtainWay;
            }
            var record  = CouponApplication.GetCouponRecordList(query);
            var coupons = CouponApplication.GetCouponInfo(record.Models.Select(p => p.Id));
            var list    = record.Models.Select(
                item => {
                var coupon = coupons.FirstOrDefault(p => p.Id == item.CouponId);
                return(new
                {
                    CouponId = coupon.Id,
                    CouponName = coupon.CouponName,
                    Price = Math.Round(coupon.Price, 2),
                    SendCount = coupon.Num,
                    UserLimitCount = coupon.PerMax,
                    OrderUseLimit = Math.Round(coupon.OrderAmount, 2),
                    StartTime = coupon.StartTime.ToString("yyyy.MM.dd"),
                    ClosingTime = coupon.EndTime.ToString("yyyy.MM.dd"),
                    ObtainWay = coupon.ReceiveType,
                    NeedPoint = coupon.NeedIntegral,
                    UseArea = coupon.UseArea,
                    Remark = coupon.Remark
                });
            });

            return(JsonResult <dynamic>(new { total = record.Total, Data = list }));
        }
Exemplo n.º 24
0
        public JsonResult SendCoupon(string ids, string couponIds)
        {
            var cIds = couponIds.Split(',').Select(s => long.Parse(s));
            var uids = ids.Split(',').Select(s => long.Parse(s)).ToList();

            if (cIds.Count() == 0)
            {
                throw new MallException("请选择优惠券!");
            }
            if (uids.Count() == 0)
            {
                throw new MallException("请选择发送会员!");
            }

            Dictionary <string, int> dictResult = new Dictionary <string, int>();

            CouponApplication.SendCouponByUserIds(uids, cIds.ToList());
            return(Json(new { Success = true }, true));
        }
Exemplo n.º 25
0
        public ActionResult Index()
        {
            string       link = string.Format("{0}/m-Wap/RegisterActivity/Gift", CurrentUrlHelper.CurrentUrlNoPort());
            var          map  = Core.Helper.QRCodeHelper.Create(link);
            MemoryStream ms   = new MemoryStream();

            map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            //  将图片内存流转成base64,图片以DataURI形式显示
            string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray());

            ms.Dispose();
            ViewBag.QR   = strUrl;
            ViewBag.link = link;


            var model = CouponApplication.GetCouponSendByRegister();

            return(View(model));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 组合购提交页面
        /// </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, long shippingAddressId = 0, string couponIds = "")
        {
            var coupons = CouponApplication.ConvertUsedCoupon(couponIds);

            //Logo
            ViewBag.Logo = SiteSettings.Logo;//获取Logo
            //设置会员信息
            ViewBag.Member = CurrentUser;
            var result = OrderApplication.GetMobileCollocationBuy(UserId, skuIds, counts, regionId, collpids, shippingAddressId, coupons);

            ViewBag.collpids         = collpids;
            ViewBag.skuIds           = skuIds;
            ViewBag.counts           = counts;
            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;
            ViewBag.Islimit          = false;

            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 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;
            return(View("Submit"));
        }
Exemplo n.º 27
0
        public JsonResult Skip(string oauthId, string openId, string nickName, string unionid = null, string unionopenid = null)
        {
            string username   = DateTime.Now.ToString("yyMMddHHmmssffffff");
            var    memberInfo = _iMemberService.QuickRegister(username, string.Empty, nickName, oauthId, openId, (int)PlatformType.PC, unionid, unionopenid: unionopenid);

            if (memberInfo != null)
            {
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                BonusApplication.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                if (memberInfo.IsNewAccount)
                {
                    CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
                }
            }
            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);

            return(Json(new { success = true }));
        }
Exemplo n.º 28
0
        public JsonResult Skip(string serviceProvider, string openId, string nickName, string realName, string headimgurl, Entities.MemberOpenIdInfo.AppIdTypeEnum appidtype = Entities.MemberOpenIdInfo.AppIdTypeEnum.Normal, string unionid = null, string sex = null, string city = null, string province = null)
        {
            int    num      = 0;
            string username = DateTime.Now.ToString("yyMMddHHmmssffffff");   //TODO:DZY[150916]未使用,在方法内会重新生成

            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            realName   = System.Web.HttpUtility.UrlDecode(realName);
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            Entities.MemberInfo memberInfo = _iMemberService.GetMemberByUnionIdOpenId(unionid, openId);
            if (memberInfo == null)
            {
                memberInfo = _iMemberService.QuickRegister(username, realName, nickName, serviceProvider, openId, PlatformType.GetHashCode(),
                                                           unionid, sex, headimgurl, appidtype, null, city, province, spreadId: CurrentSpreadId);
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                _iBonusService.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                if (memberInfo.IsNewAccount)
                {
                    num = CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
                }
                ClearDistributionSpreadCookie();
                _iMemberService.AddIntegel(memberInfo); //给用户加积分//执行登录后初始化相关操作
            }

            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            WebHelper.SetCookie(CookieKeysCollection.HIMALL_ACTIVELOGOUT, "0", DateTime.MaxValue);

            #region 判断是否强制绑定手机号
            MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            var isBind = MessageApplication.IsOpenBindSms(memberInfo.Id);
            if (!isBind)
            {
                return(Json <dynamic>(success: false, data: new { num = num }, code: 99));
            }
            #endregion

            return(Json <dynamic>(success: true, data: new { num = num }));
        }
Exemplo n.º 29
0
        /// <summary>
        /// 取积分优惠券
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetIntegralCoupon(int pageNo = 1, int pageSize = 10)
        {
            QueryPageModel <CouponInfo> coupons = CouponApplication.GetIntegralCoupons(pageNo, pageSize);

            Mapper.CreateMap <CouponInfo, CouponGetIntegralCouponModel>();
            QueryPageModel <CouponGetIntegralCouponModel> result = new QueryPageModel <CouponGetIntegralCouponModel>();

            result.Total = coupons.Total;
            if (result.Total > 0)
            {
                var datalist = coupons.Models.ToList();

                var objlist = new List <CouponGetIntegralCouponModel>();
                foreach (var item in datalist)
                {
                    var tmp = Mapper.Map <CouponGetIntegralCouponModel>(item);
                    tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(item.IntegralCover);
                    var vshopobj = VshopApplication.GetVShopByShopId(tmp.ShopId);
                    if (vshopobj != null)
                    {
                        tmp.VShopId = vshopobj.Id;
                        //优惠价封面为空时,取微店Logo,微店Logo为空时,取商城微信Logo
                        if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                        {
                            if (!string.IsNullOrWhiteSpace(vshopobj.WXLogo))
                            {
                                tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(vshopobj.WXLogo);
                            }
                        }
                    }
                    if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                    {
                        var siteset = SiteSettingApplication.SiteSettings;
                        tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(siteset.WXLogo);
                    }
                    objlist.Add(tmp);
                }
                result.Models = objlist.ToList();
            }
            return(JsonResult <dynamic>(new { total = result.Total, Data = result.Models }));
        }
 /// <summary>
 /// 修改注册赠送优惠券设置
 /// </summary>
 /// <param name="CouponRegisterId">设置主键ID</param>
 /// <param name="status">状态</param>
 /// <param name="couponIds">优惠券ID,用','隔开</param>
 /// <returns></returns>
 public JsonResult Update(long CouponRegisterId, int status, string couponIds)
 {
     couponIds = couponIds.TrimEnd(',');
     if (couponIds != "" || status.Equals(0))//当活动开启时优惠券不能为空
     {
         var model = new Himall.DTO.CouponSendByRegisterModel()
         {
             Id     = CouponRegisterId,
             Link   = "#",
             Status = (Himall.CommonModel.CouponSendByRegisterStatus)status
         };
         if (!couponIds.Equals(""))
         {
             string[] arrCouponId = couponIds.Split(',');
             foreach (string item in arrCouponId)
             {
                 model.CouponIds.Add(new Himall.DTO.CouponModel()
                 {
                     Id = long.Parse(item)
                 });
             }
         }
         CouponApplication.SetCouponSendByRegister(model);
         return(Json(new Result()
         {
             success = true, msg = "设置成功"
         }));
     }
     else
     {
         return(Json(new Result()
         {
             success = false, msg = "请选择优惠券"
         }));
     }
 }