Example #1
0
 private void FindControls()
 {
     this.rptProductImages      = (WapTemplatedRepeater)this.FindControl("rptProductImages");
     this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
     this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
     this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
     this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("soldCount");
     this.litprice              = (System.Web.UI.WebControls.Literal) this.FindControl("price");
     this.litcontent            = (System.Web.UI.WebControls.Literal) this.FindControl("content");
     this.litminCount           = (System.Web.UI.WebControls.Literal) this.FindControl("minCount");
     this.litGroupBuyId         = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("litGroupbuyId");
     this.litLeftSeconds        = (System.Web.UI.WebControls.Literal) this.FindControl("leftSeconds");
     this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
     this.linkDescription       = (System.Web.UI.WebControls.HyperLink) this.FindControl("linkDescription");
     this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
     this.salePrice             = (System.Web.UI.WebControls.Literal) this.FindControl("salePrice");
     this.leftCount             = (System.Web.UI.WebControls.Literal) this.FindControl("leftCount");
     this.minSuccessCount       = (System.Web.UI.WebControls.Literal) this.FindControl("minSuccessCount");
     this.txtProductId          = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("txtProductId");
     this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
     this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
     this.litMaxCount           = (System.Web.UI.WebControls.Literal) this.FindControl("litMaxCount");
     this.startTime             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("startTime");
     this.endTime                = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("endTime");
     this.groupBuySoldCount      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("groupBuySoldCount");
     this.groupBuyMinCount       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("groupBuyMinCount");
     this.litGroupbuyDescription = (System.Web.UI.WebControls.Literal) this.FindControl("litGroupbuyDescription");
     this.groupBuyMaxCount       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("groupBuyMaxCount");
 }
 private void FindControls()
 {
     this.rptProductImages = (VshopTemplatedRepeater) this.FindControl("rptProductImages");
     this.litProdcutName = (Literal) this.FindControl("litProdcutName");
     this.litShortDescription = (Literal) this.FindControl("litShortDescription");
     this.litDescription = (Literal) this.FindControl("litDescription");
     this.litSoldCount = (Literal) this.FindControl("soldCount");
     this.litprice = (Literal) this.FindControl("price");
     this.litcontent = (Literal) this.FindControl("content");
     this.litminCount = (Literal) this.FindControl("minCount");
     this.litGroupBuyId = (HtmlInputControl) this.FindControl("litGroupbuyId");
     this.litLeftSeconds = (Literal) this.FindControl("leftSeconds");
     this.skuSelector = (Common_SKUSelector) this.FindControl("skuSelector");
     this.linkDescription = (HyperLink) this.FindControl("linkDescription");
     this.expandAttr = (Common_ExpandAttributes) this.FindControl("ExpandAttributes");
     this.salePrice = (Literal) this.FindControl("salePrice");
     this.leftCount = (Literal) this.FindControl("leftCount");
     this.minSuccessCount = (Literal) this.FindControl("minSuccessCount");
     this.txtProductId = (HtmlInputControl) this.FindControl("txtProductId");
     this.litConsultationsCount = (Literal) this.FindControl("litConsultationsCount");
     this.litReviewsCount = (Literal) this.FindControl("litReviewsCount");
     this.litMaxCount = (Literal) this.FindControl("litMaxCount");
     this.startTime = (HtmlInputHidden) this.FindControl("startTime");
     this.endTime = (HtmlInputHidden) this.FindControl("endTime");
     this.groupBuySoldCount = (HtmlInputHidden) this.FindControl("groupBuySoldCount");
     this.groupBuyMinCount = (HtmlInputHidden) this.FindControl("groupBuyMinCount");
     this.litGroupbuyDescription = (Literal) this.FindControl("litGroupbuyDescription");
     this.nowTime = (HtmlInputHidden) this.FindControl("nowTime");
 }
Example #3
0
 public static void SetWhenIsNotNull(this System.Web.UI.Control control, string value)
 {
     if (control != null)
     {
         if (control is System.Web.UI.ITextControl)
         {
             System.Web.UI.ITextControl textControl = (System.Web.UI.ITextControl)control;
             textControl.Text = value;
         }
         else if (control is System.Web.UI.HtmlControls.HtmlInputControl)
         {
             System.Web.UI.HtmlControls.HtmlInputControl htmlInputControl = (System.Web.UI.HtmlControls.HtmlInputControl)control;
             htmlInputControl.Value = value;
         }
         else
         {
             if (!(control is System.Web.UI.WebControls.HyperLink))
             {
                 throw new System.ApplicationException("未实现" + control.GetType().ToString() + "的SetWhenIsNotNull方法");
             }
             System.Web.UI.WebControls.HyperLink hyperLink = (System.Web.UI.WebControls.HyperLink)control;
             hyperLink.NavigateUrl = value;
         }
     }
 }
Example #4
0
        protected override void AttachChildControls()
        {
            this.litShipTo            = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone         = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress           = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.rptCartProducts      = (WapTemplatedRepeater)this.FindControl("rptCartProducts");
            this.dropCoupon           = (WAP_CouponSelect)this.FindControl("dropCoupon");
            this.litOrderTotal        = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPromotionPrice    = (System.Web.UI.WebControls.Literal) this.FindControl("litPromotionPrice");
            this.groupbuyHiddenBox    = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.selectShipTo         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litProductTotalPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litProductTotalPrice");
            this.rptPromotions        = (WapTemplatedRepeater)this.FindControl("rptPromotions");
            this.litTotalTax          = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalTax");
            this.litToalFreight       = (System.Web.UI.WebControls.Literal) this.FindControl("litToalFreight");
            this.litTotalQuantity     = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalQuantity");
            this.isCustomsClearance   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("isCustomsClearance");
            //this.txtmemberIdentityCard = (System.Web.UI.HtmlControls.HtmlInputText)this.FindControl("txtmemberIdentityCard");
            //this.txtRealName = (System.Web.UI.HtmlControls.HtmlInputText)this.FindControl("txtRealName");
            this.htmlIsCanMergeOrder = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("htmlIsCanMergeOrder");
            this.txtVoucherCode      = (HtmlInputText)this.FindControl("txtVoucherCode");
            this.txtVoucherPwd       = (HtmlInputText)this.FindControl("txtVoucherPwd");
            this.dropVoucher         = (WAP_VoucherSelect)this.FindControl("dropVoucher"); // 现金券列表
            this.litIdentityCard     = (System.Web.UI.WebControls.Literal) this.FindControl("litIdentityCard");
            this.litPoint            = (System.Web.UI.WebControls.Literal) this.FindControl("litPoint");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text       = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text    = shippingAddressInfo.CellPhone;
                this.litAddress.Text      = RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, "  ") + shippingAddressInfo.Address;
                this.litIdentityCard.Text = shippingAddressInfo.IdentityCard;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Wapshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
                return;
            }
            ShoppingCartInfo shoppingCartInfo;

            if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
            {
                this.productSku = this.Page.Request.QueryString["productSku"];
                int storeId = 0;
                int.TryParse(this.Page.Request.QueryString["storeId"], out storeId);
                if (int.TryParse(this.Page.Request.QueryString["groupbuyId"], out this.groupBuyId))
                {
                    this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                    shoppingCartInfo = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount, storeId);
                }
                else
                {
                    shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount, storeId);
                }
            }
            else
            {
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && this.Page.Request.QueryString["from"] == "countDown")
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    int storeId = 0;
                    int.TryParse(this.Page.Request.QueryString["storeId"], out storeId);
                    if (int.TryParse(this.Page.Request.QueryString["countDownId"], out this.countDownId))
                    {
                        this.groupbuyHiddenBox.SetWhenIsNotNull(this.countDownId.ToString());
                        shoppingCartInfo = ShoppingCartProcessor.GetCountDownShoppingCart(this.productSku, this.buyAmount, storeId);
                    }
                    else
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount, storeId);
                    }
                }
                else
                {
                    //shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart();
                    HttpCookie cookieSkuIds = this.Page.Request.Cookies["UserSession-SkuIds"];
                    if (cookieSkuIds != null && !string.IsNullOrEmpty(cookieSkuIds.Value))
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetPartShoppingCartInfo(Globals.UrlDecode(cookieSkuIds.Value));//获取用户选择的商品
                    }
                    else
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart();
                    }
                    if (shoppingCartInfo != null && shoppingCartInfo.GetQuantity() == 0)
                    {
                        //this.buytype = "0";
                    }
                }
            }
            if (shoppingCartInfo != null)
            {
                this.rptCartProducts.DataSource = shoppingCartInfo.LineItems;
                this.rptCartProducts.DataBind();



                #region  获取优惠券筛选条件
                string bindId     = "";
                string categoryId = "";

                List <int> bindIdList     = new List <int>();
                List <int> categoryIdList = new List <int>();

                if (shoppingCartInfo.LineItems != null && shoppingCartInfo.LineItems.Count > 0)
                {
                    shoppingCartInfo.LineItems.ToList().ForEach(t =>
                    {
                        //单品券
                        if (t.ProductId > 0)
                        {
                            bindIdList.Add(t.ProductId);
                        }
                        //商品分类
                        if (t.CategoryId > 0)
                        {
                            categoryIdList.Add(t.CategoryId);
                        }
                        //品牌
                        if (t.BrandId > 0)
                        {
                            bindIdList.Add(t.BrandId);
                        }
                        //供货商
                        if (t.SupplierId > 0)
                        {
                            bindIdList.Add(t.SupplierId);
                        }
                    });
                }

                if (bindIdList != null && bindIdList.Count > 0)
                {
                    bindId = string.Join(",", bindIdList.Distinct().ToArray());
                }
                if (categoryIdList != null && categoryIdList.Count > 0)
                {
                    categoryId = string.Join(",", categoryIdList.Distinct().ToArray());
                }


                #endregion


                decimal totalAmount = shoppingCartInfo.GetNewTotal();
                this.dropVoucher.CartTotal = totalAmount;
                this.dropCoupon.CartTotal  = totalAmount;
                this.dropCoupon.BindId     = bindId;
                this.dropCoupon.CategoryId = categoryId;
                this.litPoint.Text         = shoppingCartInfo.GetPoint().ToString();

                System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> >();
                if (shoppingCartInfo.IsReduced)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.Reduced), shoppingCartInfo.ReducedPromotionName + string.Format(" 优惠:{0}", shoppingCartInfo.ReducedPromotionAmount.ToString("F2"))));
                }
                if (shoppingCartInfo.IsFreightFree)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentFreight), string.Format("{0}", shoppingCartInfo.FreightFreePromotionName)));
                }
                if (shoppingCartInfo.IsSendTimesPoint)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentTimesPoint), string.Format("{0}:送{1}倍", shoppingCartInfo.SentTimesPointPromotionName, shoppingCartInfo.TimesPoint.ToString("F2"))));
                }
                if (this.groupBuyId == 0)
                {
                    this.rptPromotions.DataSource = list;
                    this.rptPromotions.DataBind();
                }
                Member currentUser = HiContext.Current.User as Member;
                //this.txtmemberIdentityCard.Value = shippingAddressInfo.IdentityCard;
                //this.txtRealName.Value = shippingAddressInfo.ShipTo;
                #region 是否存在清关商品标识
                bool          isOneTemplateId = true;
                int           templateId      = 0;
                StringBuilder stringBuilder   = new StringBuilder();
                for (int i = 0; i < shoppingCartInfo.LineItems.Count; i++)
                {
                    if (i == (shoppingCartInfo.LineItems.Count - 1))
                    {
                        stringBuilder.Append(shoppingCartInfo.LineItems[i].ProductId);
                    }
                    else
                    {
                        stringBuilder.AppendFormat("{0},", shoppingCartInfo.LineItems[i].ProductId);
                    }
                    if (i == 0)
                    {
                        templateId = shoppingCartInfo.LineItems[i].TemplateId;
                    }
                    else
                    {
                        if (templateId != shoppingCartInfo.LineItems[i].TemplateId)
                        {
                            isOneTemplateId = false;
                        }
                    }
                }
                bool b = ShoppingProcessor.CheckIsCustomsClearance(stringBuilder.ToString());
                if (b)
                {
                    this.isCustomsClearance.Value = "1";//表示存在需要清关的商品
                }
                else
                {
                    this.isCustomsClearance.Value = "0";
                }
                #endregion

                decimal tax           = 0m;//输出税费+运费
                decimal freight       = 0m;
                bool    flag          = groupBuyId > 0;
                int     totalQuantity = 0;
                //Dictionary<int, decimal> dictShippingMode = new Dictionary<int, decimal>();
                foreach (ShoppingCartItemInfo item in shoppingCartInfo.LineItems)
                {
                    totalQuantity += item.Quantity;
                    tax           += item.AdjustedPrice * item.TaxRate * item.Quantity;
                    #region 弃用代码
                    //if ((!shoppingCartInfo.IsFreightFree ||!item.IsfreeShipping|| flag))
                    //{
                    //    if (item.TemplateId > 0)
                    //    {
                    //        if (dictShippingMode.ContainsKey(item.TemplateId))
                    //        {
                    //            dictShippingMode[item.TemplateId] += item.Weight * item.Quantity;
                    //        }
                    //        else
                    //        {
                    //            dictShippingMode.Add(item.TemplateId, item.Weight * item.Quantity);
                    //        }
                    //    }
                    //}
                }
                //foreach (var item in dictShippingMode)//模拟分单,计算运费
                //{
                //    ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(item.Key);
                //    freight += ShoppingProcessor.CalcFreight(shippingAddressInfo.RegionId, item.Value, shippingMode);
                //}
                #endregion
                freight = ShoppingCartProcessor.GetFreight(shoppingCartInfo, shippingAddressInfo.RegionId, false); //ShoppingProcessor.CalcShoppingCartFreight(shoppingCartInfo, shippingAddressInfo.RegionId);
                #region 判断是否符合单条件
                this.htmlIsCanMergeOrder.Value = "0";
                if (templateId != 0 && isOneTemplateId && tax <= 50)
                {
                    bool IsCanMergeOrder = ShoppingProcessor.CheckIsCanMergeOrder(templateId, tax, currentUser.UserId);
                    this.htmlIsCanMergeOrder.Value = IsCanMergeOrder ? "1" : "0";
                }
                #endregion

                //this.litTotalTax.Text =(tax<50?"0.00":tax.ToString("F2"));
                decimal totaltax = shoppingCartInfo.GetNewTotalTax();
                this.litTotalTax.Text          = (totaltax < 50 ? "0.00" : totaltax.ToString("F2"));
                this.litToalFreight.Text       = freight == 0 ? "0.00" : freight.ToString("F2");
                this.litProductTotalPrice.Text = shoppingCartInfo.GetTotal().ToString("F2");

                //tax=tax<50?0:tax;
                totaltax = totaltax < 50 ? 0 : totaltax;

                this.litOrderTotal.Text = (shoppingCartInfo.GetNewTotal() + totaltax + freight).ToString("F2");//总额=商品调整后价格+运费+税费 -活动优惠

                //活动优惠
                this.litPromotionPrice.Text = shoppingCartInfo.GetActivityPrice().ToString("F2");
                this.litTotalQuantity.Text  = totalQuantity.ToString();
            }

            else
            {
                this.Page.Response.Redirect("ShoppingCart.aspx");
            }
            PageTitle.AddSiteNameTitle("订单确认");

            WAPHeadName.AddHeadName("确认订单");
        }
Example #5
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litIsUseBalance = (System.Web.UI.WebControls.Literal) this.FindControl("litIsUseBalance");
            this.litCellPhone    = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress      = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.litShowMes      = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal          = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPointNumber         = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber");
            this.litUseMembersPointShow = (System.Web.UI.WebControls.Literal) this.FindControl("litUseMembersPointShow");
            this.litDisplayPointNumber  = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber");
            this.litDisplayPoint        = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPoint");
            this.BalanceCanPayMoney     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("BalanceCanPayMoney");
            this.groupbuyHiddenBox      = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress             = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.MembersPointMoney      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("MembersPointMoney");
            this.regionId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");

            if (Globals.GetCurrentDistributorId() == CurrentMemberInfo.UserId)
            {
                base.GotoResourceNotFound("站点管理员无法在自己店内购买!");
                return;
            }
            if (Globals.GetCurrentDistributorId() == 0)//CurrentMemberInfo.ReferralUserId ==0  &&
            {
                base.GotoResourceNotFound("请先扫码关注站点后再下单!");
                return;
            }


            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"]))
            {
                this.SendStartDate = DateTime.Parse(this.Page.Request.QueryString["startDate"]);
            }
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["quantityPerDay"]))
            {
                this.QuantityPerDay = Convert.ToInt32(this.Page.Request.QueryString["quantityPerDay"]);
            }
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sendDays"]))
            {
                this.SendDays = Convert.ToInt32(this.Page.Request.QueryString["sendDays"]);
            }


            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>";
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>();
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    if (this.isbargain)
                    {
                        int bargainDetialId = Globals.RequestQueryNum("bargainDetialId");
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0);
                    }
                    else
                    {
                        int num  = this.buyAmount;
                        int num2 = Globals.RequestQueryNum("limitedTimeDiscountId");
                        if (num2 > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId))
                                {
                                    if (discountInfo.LimitNumber != 0)
                                    {
                                        int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false);
                                        if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum)
                                        {
                                            num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                        }
                                    }
                                }
                                else
                                {
                                    num2 = 0;
                                }
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        if (num2 > 0)
                        {
                            ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2);
                        }
                        if (num == 0 && num2 > 0)
                        {
                            num  = this.buyAmount;
                            num2 = 0;
                        }
                        list = ShoppingCartProcessor.GetListShoppingCart(SendStartDate, QuantityPerDay, SendDays, this.productSku, num, 0, num2);
                    }
                }
                else
                {
                    list = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (list == null)
                {
                    System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>");
                }
                else
                {
                    if (list.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    this.rptCartProducts.DataSource = list;
                    this.rptCartProducts.DataBind();
                    decimal d    = 0m;
                    decimal num3 = 0m;
                    decimal d2   = 0m;
                    int     num4 = 0;
                    foreach (ShoppingCartInfo current in list)
                    {
                        num4 += current.GetPointNumber;
                        d    += current.Total;
                        num3 += current.Exemption;
                        d2   += current.ShipCost;
                    }
                    decimal d3   = num3;
                    decimal num5 = d - d3;
                    if (num5 <= 0m)
                    {
                        num5 = 0m;
                    }
                    num5 = decimal.Round(num5, 2);
                    this.litOrderTotal.Text = num5.ToString("F2");
                    if (num4 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num4.ToString();
                    int          num6           = this.CurrentMemberInfo.Points - num4;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    decimal      num7;
                    if (num5 * masterSettings.PointToCashRate > this.CurrentMemberInfo.Points)
                    {
                        if (num6 > masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate)
                        {
                            num7 = masterSettings.PonitToCash_MaxAmount;
                            num6 = (int)masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate;
                        }
                        else
                        {
                            num7 = num6 / masterSettings.PointToCashRate;
                        }
                    }
                    else
                    {
                        num7 = masterSettings.PonitToCash_MaxAmount;
                        if (num7 > num5)
                        {
                            num7 = num5;
                        }
                        num7 = decimal.Round(num7, 2);
                        num6 = (int)(num7 * masterSettings.PointToCashRate);
                    }
                    if (num6 <= 0)
                    {
                        num6 = 0;
                        num7 = 0m;
                    }
                    this.MembersPointMoney.Value = num7.ToString("F2");
                    if (num6 > 0)
                    {
                        this.litUseMembersPointShow.Text = string.Concat(new object[]
                        {
                            "<input type='hidden' id='hdCanUsePoint' value='",
                            num6,
                            "'/><input type='hidden' id='hdCanUsePointMoney' value='",
                            num7.ToString("F2"),
                            "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">",
                            num6,
                            "</span>积分抵 <span class=\"colorr\">¥<span  id=\"usepointmoney\">",
                            num7.ToString("F2"),
                            "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input  type=\"checkbox\" /></div>"
                        });
                    }
                    else
                    {
                        this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">0</span>积分 <span  id=\"usepointmoney\" style=\"display:none\">" + num7.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>";
                    }
                    decimal d4;
                    if (num5 > this.CurrentMemberInfo.AvailableAmount)
                    {
                        d4 = this.CurrentMemberInfo.AvailableAmount;
                        this.BalanceCanPayMoney.Value = this.CurrentMemberInfo.AvailableAmount.ToString("F2");
                    }
                    else
                    {
                        d4 = num5;
                        this.BalanceCanPayMoney.Value = num5.ToString("F2");
                    }
                    if (this.CurrentMemberInfo.AvailableAmount > 0m && masterSettings.EnableBalancePayment)
                    {
                        this.litIsUseBalance.Text = string.Concat(new string[]
                        {
                            "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">",
                            d4.ToString("F2"),
                            "</span></span>(可用 ¥<span id=\"spAvailableAmount\">",
                            this.CurrentMemberInfo.AvailableAmount.ToString("F2"),
                            "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" ",
                            (d4 > 0m) ? "" : " disabled",
                            " /></div></div>"
                        });
                    }
                    else
                    {
                        this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>";
                    }
                    if (!masterSettings.PonitToCash_Enable)
                    {
                        this.litDisplayPoint.Text = " style=\"display:none;\"";
                    }
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
Example #6
0
        protected override void AttachChildControls()
        {
            this.litShipTo            = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone         = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress           = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.rptCartProducts      = (AliOHTemplatedRepeater)this.FindControl("rptCartProducts");
            this.dropCoupon           = (Common_CouponSelect)this.FindControl("dropCoupon");
            this.litOrderTotal        = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.groupbuyHiddenBox    = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress           = (AliOHTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litProductTotalPrice = (System.Web.UI.WebControls.Literal) this.FindControl("litProductTotalPrice");
            this.rptPromotions        = (AliOHTemplatedRepeater)this.FindControl("rptPromotions");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource =
                from item in shippingAddresses
                orderby item.IsDefault
                select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/AliOH/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
                return;
            }
            ShoppingCartInfo shoppingCartInfo;

            if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
            {
                this.productSku = this.Page.Request.QueryString["productSku"];
                if (int.TryParse(this.Page.Request.QueryString["groupbuyId"], out this.groupBuyId))
                {
                    this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                    shoppingCartInfo = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount, 0);
                }
                else
                {
                    shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount, 0);
                }
            }
            else
            {
                shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart();
            }
            if (shoppingCartInfo != null)
            {
                this.rptCartProducts.DataSource = shoppingCartInfo.LineItems;
                this.rptCartProducts.DataBind();
                this.dropCoupon.CartTotal = shoppingCartInfo.GetTotal();
                this.litOrderTotal.Text   = (this.litProductTotalPrice.Text = shoppingCartInfo.GetTotal().ToString("F2"));
                System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> >();
                if (shoppingCartInfo.IsReduced)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.Reduced), shoppingCartInfo.ReducedPromotionName + string.Format(" 优惠:{0}", shoppingCartInfo.ReducedPromotionAmount.ToString("F2"))));
                }
                if (shoppingCartInfo.IsFreightFree)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentFreight), string.Format("{0}", shoppingCartInfo.FreightFreePromotionName)));
                }
                if (shoppingCartInfo.IsSendTimesPoint)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentTimesPoint), string.Format("{0}:送{1}倍", shoppingCartInfo.SentTimesPointPromotionName, shoppingCartInfo.TimesPoint.ToString("F2"))));
                }
                if (this.groupBuyId == 0)
                {
                    this.rptPromotions.DataSource = list;
                    this.rptPromotions.DataBind();
                }
            }
            PageTitle.AddSiteNameTitle("订单确认");
        }
Example #7
0
        protected override void AttachChildControls()
        {
            Member member = HiContext.Current.User as Member;

            if (member == null)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                this.WriteError("跳转到通用登陆接口", "");
                if (!string.IsNullOrEmpty(masterSettings.WeixinLoginUrl))
                {
                    this.Page.Response.Redirect(masterSettings.WeixinLoginUrl);
                    return;
                }
                this.Page.Response.Redirect("Login.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()));
                return;
            }
            bool rest = MemberProcessor.CheckUserIsVerify(member.UserId);

            if (!rest)
            {
                this.Page.Response.Redirect("IdentityVerifi.aspx?type=submit&buyAmount=" + this.Page.Request.QueryString["buyAmount"] + "&productSku=" + this.Page.Request.QueryString["productSku"] + "&from=" + this.Page.Request.QueryString["from"]);
                return;
            }


            PageTitle.AddSiteNameTitle("订单确认");
            this.litShipTo                      = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone                   = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress                     = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.rptCartProducts                = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.dropCoupon                     = (Common_CouponSelect)this.FindControl("dropCoupon");
            this.litOrderTotal                  = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPromotionPrice              = (System.Web.UI.WebControls.Literal) this.FindControl("litPromotionPrice");
            this.groupbuyHiddenBox              = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress                     = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo                   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId                       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litProductTotalPrice           = (System.Web.UI.WebControls.Literal) this.FindControl("litProductTotalPrice");
            this.rptPromotions                  = (VshopTemplatedRepeater)this.FindControl("rptPromotions");
            this.litTotalTax                    = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalTax");
            this.litToalFreight                 = (System.Web.UI.WebControls.Literal) this.FindControl("litToalFreight");
            this.litTotalQuantity               = (System.Web.UI.WebControls.Literal) this.FindControl("litTotalQuantity");
            this.isCustomsClearance             = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("isCustomsClearance");
            this.txtmemberIdentityCard          = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtmemberIdentityCard");
            this.txtRealName                    = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtRealName");
            this.htmlIsCanMergeOrder            = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("htmlIsCanMergeOrder");
            this.txtVoucherCode                 = (HtmlInputText)this.FindControl("txtVoucherCode");
            this.txtVoucherPwd                  = (HtmlInputText)this.FindControl("txtVoucherPwd");
            this.dropVoucher                    = (Common_VoucherSelect)this.FindControl("dropVoucher"); // 现金券列表
            this.litAddressNotExits             = (System.Web.UI.WebControls.Literal) this.FindControl("litAddressNotExits");
            this.rptCartProducts.ItemDataBound += rptCartProducts_ItemDataBound;

            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource =
                from item in shippingAddresses
                orderby item.IsDefault
                select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo + "(收)";
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, "") + "  " + shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
                this.txtRealName.Value = shippingAddressInfo.ShipTo;

                DataTable dt = SitesManagementHelper.GetMySubMemberByUserId(HiContext.Current.User.UserId);
                if (dt != null && dt.Rows.Count > 0)
                {
                    this.txtmemberIdentityCard.Value = dt.Rows[0]["IdentityCard"].ToString();
                    this.txtRealName.Value           = dt.Rows[0]["RealName"].ToString();
                }

                this.litAddressNotExits.Text = "<div class=\"addr-con\" id=\"addr-con\"><a href=\"/vshop/ShippingAddresses.aspx?returnUrl=" + HttpContext.Current.Request.Url.AbsoluteUri + "\" id=\"addressurl\"><p><label id=\"lbAddress\">" + RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, "") + "  " + shippingAddressInfo.Address + "</label></p>" +
                                               "<div class=\"rec-info fix\"> <label id=\"lbShipTo\">" + shippingAddressInfo.ShipTo + "(收)" + "</label><span class=\"ml10\"><label id=\"lbCellPhone\">" + shippingAddressInfo.CellPhone + "</label></span></div></a></div>";
            }
            else
            {
                this.litAddressNotExits.Text = "<div class=\"no-addr\" id=\"no-addr\"> <span class=\"n-tip\">亲,您当前没有收货地址哦!</span> <a class=\"add-addr-btn\" href=\"/vshop/AddShippingAddress.aspx\">添加新地址</a> </div>";
            }
            //if (shippingAddresses == null || shippingAddresses.Count == 0)
            //{
            //    this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
            //    return;
            //}

            if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
            {
                this.productSku = this.Page.Request.QueryString["productSku"];
                int storeId = 0;
                int.TryParse(this.Page.Request.QueryString["storeId"], out storeId);
                if (int.TryParse(this.Page.Request.QueryString["groupbuyId"], out this.groupBuyId))
                {
                    this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                    shoppingCartInfo = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount, storeId);
                }
                else
                {
                    shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount, storeId);
                }
            }
            else
            {
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && this.Page.Request.QueryString["from"] == "countDown")
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    int storeId = 0;
                    int.TryParse(this.Page.Request.QueryString["storeId"], out storeId);
                    if (int.TryParse(this.Page.Request.QueryString["countDownId"], out this.countDownId))
                    {
                        this.groupbuyHiddenBox.SetWhenIsNotNull(this.countDownId.ToString());
                        shoppingCartInfo = ShoppingCartProcessor.GetCountDownShoppingCart(this.productSku, this.buyAmount, storeId);
                    }
                    else
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount, storeId);
                    }
                }
                else
                {
                    //shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart();
                    HttpCookie cookieSkuIds = this.Page.Request.Cookies["UserSession-SkuIds"];
                    if (cookieSkuIds != null && !string.IsNullOrEmpty(cookieSkuIds.Value))
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetPartShoppingCartInfo(Globals.UrlDecode(cookieSkuIds.Value));//获取未用户选择的商品
                    }
                    else
                    {
                        shoppingCartInfo = ShoppingCartProcessor.GetShoppingCart();
                    }
                    if (shoppingCartInfo != null && shoppingCartInfo.GetQuantity() == 0)
                    {
                        //this.buytype = "0";
                    }
                }
            }
            if (shoppingCartInfo != null)
            {
                this.rptCartProducts.DataSource = shoppingCartInfo.LineItems;
                this.rptCartProducts.DataBind();
                decimal totalAmount = shoppingCartInfo.GetNewTotal(); //shoppingCartInfo.GetTotal();
                this.dropCoupon.CartTotal  = totalAmount;
                this.dropVoucher.CartTotal = totalAmount;

                System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> >();
                if (shoppingCartInfo.IsReduced)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.Reduced), shoppingCartInfo.ReducedPromotionName + string.Format(" 优惠:{0}", shoppingCartInfo.ReducedPromotionAmount.ToString("F2"))));
                }
                if (shoppingCartInfo.IsFreightFree)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentFreight), string.Format("{0}", shoppingCartInfo.FreightFreePromotionName)));
                }
                if (shoppingCartInfo.IsSendTimesPoint)
                {
                    list.Add(new System.Collections.Generic.KeyValuePair <string, string>(PromotionHelper.GetShortName(PromoteType.FullAmountSentTimesPoint), string.Format("{0}:送{1}倍", shoppingCartInfo.SentTimesPointPromotionName, shoppingCartInfo.TimesPoint.ToString("F2"))));
                }
                if (this.groupBuyId == 0)
                {
                    this.rptPromotions.DataSource = list;
                    this.rptPromotions.DataBind();
                }
                Member currentUser = HiContext.Current.User as Member;
                #region 是否存在清关商品标识
                bool          isOneTemplateId = true;
                int           templateId      = 0;
                StringBuilder stringBuilder   = new StringBuilder();
                for (int i = 0; i < shoppingCartInfo.LineItems.Count; i++)
                {
                    if (i == (shoppingCartInfo.LineItems.Count - 1))
                    {
                        stringBuilder.Append(shoppingCartInfo.LineItems[i].ProductId);
                    }
                    else
                    {
                        stringBuilder.AppendFormat("{0},", shoppingCartInfo.LineItems[i].ProductId);
                    }
                    if (i == 0)
                    {
                        templateId = shoppingCartInfo.LineItems[i].TemplateId;
                    }
                    else
                    {
                        if (templateId != shoppingCartInfo.LineItems[i].TemplateId)
                        {
                            isOneTemplateId = false;
                        }
                    }
                }
                bool b = ShoppingProcessor.CheckIsCustomsClearance(stringBuilder.ToString());
                if (b)
                {
                    this.isCustomsClearance.Value = "1";//表示存在需要清关的商品
                }
                else
                {
                    this.isCustomsClearance.Value = "0";
                }
                #endregion

                decimal tax           = 0m;//输出税费+运费
                decimal freight       = 0m;
                bool    flag          = groupBuyId > 0;
                int     totalQuantity = 0;
                //Dictionary<int, decimal> dictShippingMode = new Dictionary<int, decimal>();
                foreach (ShoppingCartItemInfo item in shoppingCartInfo.LineItems)
                {
                    totalQuantity += item.Quantity;
                    tax           += item.AdjustedPrice * item.TaxRate * item.Quantity;
                    #region 弃用代码
                    //if ((!shoppingCartInfo.IsFreightFree ||!item.IsfreeShipping|| flag))
                    //{
                    //    if (item.TemplateId > 0)
                    //    {
                    //        if (dictShippingMode.ContainsKey(item.TemplateId))
                    //        {
                    //            dictShippingMode[item.TemplateId] += item.Weight * item.Quantity;
                    //        }
                    //        else
                    //        {
                    //            dictShippingMode.Add(item.TemplateId, item.Weight * item.Quantity);
                    //        }
                    //    }
                    //}
                }
                //foreach (var item in dictShippingMode)//模拟分单,计算运费
                //{
                //    ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(item.Key);
                //    freight += ShoppingProcessor.CalcFreight(shippingAddressInfo.RegionId, item.Value, shippingMode);
                //}
                #endregion
                if (shippingAddressInfo != null)
                {
                    freight = ShoppingCartProcessor.GetFreight(shoppingCartInfo, shippingAddressInfo.RegionId, false); //ShoppingProcessor.CalcShoppingCartFreight(shoppingCartInfo, shippingAddressInfo.RegionId);
                }
                #region 判断是否符合单条件
                this.htmlIsCanMergeOrder.Value = "0";
                if (templateId != 0 && isOneTemplateId && tax <= 50)
                {
                    bool IsCanMergeOrder = ShoppingProcessor.CheckIsCanMergeOrder(templateId, tax, currentUser == null ? 0 : currentUser.UserId);
                    this.htmlIsCanMergeOrder.Value = IsCanMergeOrder ? "1" : "0";
                }
                #endregion

                //this.litTotalTax.Text =(tax<50?"0.00":tax.ToString("F2"));
                decimal totaltax = shoppingCartInfo.GetNewTotalTax();
                this.litTotalTax.Text = totaltax.ToString("F2");


                string strToalFreight = freight == 0 ? "0.00" : freight.ToString("F2");

                if (shoppingCartInfo.LineItems.Count != shoppingCartInfo.LineItems.Count((ShoppingCartItemInfo a) => a.IsfreeShipping) && !shoppingCartInfo.IsFreightFree)
                {
                    this.litToalFreight.Text = "<span id='showfreight'>" + strToalFreight + "</span>";
                    totaltax = totaltax < 50 ? 0 : totaltax;

                    this.litOrderTotal.Text = (shoppingCartInfo.GetNewTotal() + totaltax + freight).ToString("F2");//总额=商品调整后价格+运费+税费 -活动优惠
                }

                else
                {
                    this.litToalFreight.Text = "<span id='showfreight' style='text-decoration: line-through;'>" + strToalFreight + "</span>";

                    totaltax = totaltax < 50 ? 0 : totaltax;

                    this.litOrderTotal.Text = (shoppingCartInfo.GetNewTotal() + totaltax).ToString("F2");//总额=商品调整后价格+运费+税费 -活动优惠
                }

                this.litProductTotalPrice.Text = shoppingCartInfo.GetTotal().ToString("F2");

                //tax=tax<50?0:tax;
                //totaltax = totaltax < 50 ? 0 : totaltax;

                //this.litOrderTotal.Text = (shoppingCartInfo.GetNewTotal() + totaltax + freight).ToString("F2");//总额=商品调整后价格+运费+税费 -活动优惠

                //活动优惠
                this.litPromotionPrice.Text = shoppingCartInfo.GetActivityPrice().ToString("F2");
                this.litTotalQuantity.Text  = totalQuantity.ToString();
            }
        }
Example #8
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone    = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress      = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.litShowMes      = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal         = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPointNumber        = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber");
            this.litDisplayPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber");
            this.aLinkToShipping       = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("aLinkToShipping");
            this.groupbuyHiddenBox     = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress            = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'";
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());
                System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>();
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    if (this.isbargain)
                    {
                        int bargainDetialId = Globals.RequestQueryNum("bargainDetialId");
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0);
                    }
                    else
                    {
                        int num  = this.buyAmount;
                        int num2 = Globals.RequestQueryNum("limitedTimeDiscountId");
                        if (num2 > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId))
                                {
                                    if (discountInfo.LimitNumber != 0)
                                    {
                                        int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false);
                                        if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum)
                                        {
                                            num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                        }
                                    }
                                }
                                else
                                {
                                    num2 = 0;
                                }
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        if (num2 > 0)
                        {
                            ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2);
                        }
                        if (num == 0 && num2 > 0)
                        {
                            num  = this.buyAmount;
                            num2 = 0;
                        }
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, num, 0, num2);
                    }
                }
                else
                {
                    list = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (list == null)
                {
                    System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>");
                }
                else
                {
                    if (list.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    this.rptCartProducts.DataSource = list;
                    this.rptCartProducts.DataBind();
                    decimal d    = 0m;
                    decimal num3 = 0m;
                    decimal d2   = 0m;
                    int     num4 = 0;
                    foreach (ShoppingCartInfo current in list)
                    {
                        num4 += current.GetPointNumber;
                        d    += current.Total;
                        num3 += current.Exemption;
                        d2   += current.ShipCost;
                    }
                    decimal d3 = num3;
                    this.litOrderTotal.Text = (d - d3).ToString("F2");
                    if (num4 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num4.ToString();
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
Example #9
0
 protected override void AttachChildControls()
 {
     this.litShipTo = (Literal) this.FindControl("litShipTo");
     this.litCellPhone = (Literal) this.FindControl("litCellPhone");
     this.litAddress = (Literal) this.FindControl("litAddress");
     this.rptCartProducts = (VshopTemplatedRepeater) this.FindControl("rptCartProducts");
     this.dropShippingType = (Common_ShippingTypeSelect) this.FindControl("dropShippingType");
     this.dropCoupon = (Common_CouponSelect) this.FindControl("dropCoupon");
     this.litOrderTotal = (Literal) this.FindControl("litOrderTotal");
     this.hiddenCartTotal = (HtmlInputHidden) this.FindControl("hiddenCartTotal");
     this.aLinkToShipping = (HtmlAnchor) this.FindControl("aLinkToShipping");
     this.groupbuyHiddenBox = (HtmlInputControl) this.FindControl("groupbuyHiddenBox");
     this.rptAddress = (VshopTemplatedRepeater) this.FindControl("rptAddress");
     this.selectShipTo = (HtmlInputHidden) this.FindControl("selectShipTo");
     this.regionId = (HtmlInputHidden) this.FindControl("regionId");
     Literal literal = (Literal) this.FindControl("litProductTotalPrice");
     this.litAddAddress = (Literal) this.FindControl("litAddAddress");
     IList<ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
     this.rptAddress.DataSource = from item in shippingAddresses
         orderby item.IsDefault
         select item;
     this.rptAddress.DataBind();
     ShippingAddressInfo info = shippingAddresses.FirstOrDefault<ShippingAddressInfo>(item => item.IsDefault);
     if (info == null)
     {
         info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null;
     }
     if (info != null)
     {
         this.litShipTo.Text = info.ShipTo;
         this.litCellPhone.Text = info.CellPhone;
         this.litAddress.Text = info.Address;
         this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString());
         this.regionId.SetWhenIsNotNull(info.RegionId.ToString());
     }
     this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'";
     if ((shippingAddresses == null) || (shippingAddresses.Count == 0))
     {
         this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()));
     }
     else
     {
         this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString());
         ShoppingCartInfo shoppingCart = null;
         if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy")))
         {
             this.productSku = this.Page.Request.QueryString["productSku"];
             if (int.TryParse(this.Page.Request.QueryString["groupbuyId"], out this.groupBuyId))
             {
                 this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                 shoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.groupBuyId, this.productSku, this.buyAmount);
             }
             else
             {
                 shoppingCart = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount);
             }
         }
         else
         {
             shoppingCart = ShoppingCartProcessor.GetShoppingCart();
         }
         if (shoppingCart != null)
         {
             this.rptCartProducts.DataSource = shoppingCart.LineItems;
             this.rptCartProducts.DataBind();
             this.dropShippingType.ShoppingCartItemInfo = shoppingCart.LineItems;
             this.dropShippingType.RegionId = 0;
             this.dropShippingType.Weight = shoppingCart.Weight;
             this.dropCoupon.CartTotal = shoppingCart.GetTotal();
             this.hiddenCartTotal.Value = this.litOrderTotal.Text = literal.Text = shoppingCart.GetTotal().ToString("F2");
         }
         PageTitle.AddSiteNameTitle("订单确认");
     }
 }