decimal GetCartTotalPrice() { ShoppingCartInfo groupBuyShoppingCart; int num; string str; if ((int.TryParse(this.Page.Request.QueryString["buyAmount"], out num) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "groupBuy"))) { str = this.Page.Request.QueryString["productSku"]; groupBuyShoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(str, num); } else if ((int.TryParse(this.Page.Request.QueryString["buyAmount"], out num) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "countDown"))) { str = this.Page.Request.QueryString["productSku"]; groupBuyShoppingCart = ShoppingCartProcessor.GetCountDownShoppingCart(str, num); } else if ((int.TryParse(this.Page.Request.QueryString["buyAmount"], out num) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && (!string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy"))) { str = this.Page.Request.QueryString["productSku"]; groupBuyShoppingCart = ShoppingCartProcessor.GetShoppingCart(str, num); } else { groupBuyShoppingCart = ShoppingCartProcessor.GetShoppingCart(); } decimal total = 0M; if (groupBuyShoppingCart != null) { total = groupBuyShoppingCart.GetTotal(); } return(total); }
protected override void OnInit(EventArgs e) { 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"] == "groupBuy"))) { this.productSku = this.Page.Request.QueryString["productSku"]; this.isGroupBuy = true; this.shoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount); this.buytype = "GroupBuy"; } 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"]; this.isCountDown = true; this.shoppingCart = ShoppingCartProcessor.GetCountDownShoppingCart(this.productSku, this.buyAmount); this.buytype = "CountDown"; } 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"] == "signBuy"))) { this.productSku = this.Page.Request.QueryString["productSku"]; this.isSignBuy = true; this.shoppingCart = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount); } else if ((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["Bundlingid"])) && (!string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "Bundling"))) { this.productSku = this.Page.Request.QueryString["Bundlingid"]; if (int.TryParse(this.productSku, out this.bundlingid)) { this.shoppingCart = ShoppingCartProcessor.GetShoppingCart(this.bundlingid, this.buyAmount); this.isBundling = true; this.buytype = "Bundling"; } } else { this.shoppingCart = ShoppingCartProcessor.GetShoppingCart(); if ((this.shoppingCart != null) && (this.shoppingCart.GetQuantity() == 0)) { this.buytype = "0"; } } if (this.shoppingCart == null) { this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品已经被管理员删除")); } else { if (this.SkinName == null) { this.SkinName = "Skin-SubmmitOrder.html"; } base.OnInit(e); } }
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.rptCartGifts = (VshopTemplatedRepeater)this.FindControl("rptCartGifts"); //礼品 this.dropShippingType = (Common_ShippingTypeSelect)this.FindControl("dropShippingType"); this.dropCoupon = (Common_CouponSelect)this.FindControl("dropCoupon"); this.dropRedPager = (Common_UserRedPagerSelect)this.FindControl("dropRedPager"); this.dropStreets = (Common_StreetSelect)this.FindControl("dropStreets"); //街道下拉框 this.dropAgents = (Common_AgentSelect)this.FindControl("dropAgents"); //天使下拉框 this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litTotalPoint = (Literal)this.FindControl("litTotalPoint"); //所需积分 this.isSelectAgentEnable = (HtmlInputHidden)this.FindControl("isSelectAgentEnable"); this.hiddenCartTotal = (HtmlInputHidden)this.FindControl("hiddenCartTotal"); this.aLinkToShipping = (HtmlAnchor)this.FindControl("aLinkToShipping"); this.groupbuyHiddenBox = (HtmlInputControl)this.FindControl("groupbuyHiddenBox"); this.countdownHiddenBox = (HtmlInputControl)this.FindControl("countdownHiddenBox"); this.cutdownHiddenBox = (HtmlInputControl)this.FindControl("cutdownHiddenBox"); this.couponRecharge = (HtmlInputHidden)this.FindControl("couponRecharge"); this.usercount = (HtmlInputHidden)this.FindControl("usercount"); 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.litExemption = (Literal)this.FindControl("litExemption"); this.litAddAddress = (Literal)this.FindControl("litAddAddress"); this.isStreetEnable = (HtmlInputHidden)this.FindControl("isStreetEnable"); this.isStreetMatch = (HtmlInputHidden)this.FindControl("isStreetMatch"); this.claimcode = (HtmlInputHidden)this.FindControl("claimcode"); this.litExemption.Text = "0.00"; IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); 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=" + HttpContext.Current.Request.Url.ToString() + "'"; if (CustomConfigHelper.Instance.IsProLa) { this.litAddAddress.Text = " href='/Vshop/AddShippingAddressPro.aspx?returnUrl=" + HttpContext.Current.Request.Url.ToString() + "'"; } if ((shippingAddresses == null) || (shippingAddresses.Count == 0)) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + HttpContext.Current.Request.Url.ToString()); } else { this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + HttpContext.Current.Request.Url.ToString(); ShoppingCartInfo shoppingCart = null; string msg = ""; string str = this.Page.Request.QueryString["from"]; 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.Page.Request.QueryString["from"] == "countDown") || (this.Page.Request.QueryString["from"] == "cutDown"))) { this.productSku = this.Page.Request.QueryString["productSku"]; //团购//待完善 if ((str == "groupBuy") && 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 if ((str == "countDown") && int.TryParse(this.Page.Request.QueryString["countdownId"], out this.countDownId)) { this.countdownHiddenBox.SetWhenIsNotNull(this.countDownId.ToString()); CountDownInfo info4 = ProductBrowser.GetCountDownInfo(this.countDownId, this.buyAmount, out msg); if (info4 == null) { base.GotoResourceNotFound(msg); return; } if (string.IsNullOrEmpty(this.productSku) || (this.productSku.Split(new char[] { '_' })[0] != info4.ProductId.ToString())) { base.GotoResourceNotFound("错误的商品信息"); return; } shoppingCart = ShoppingCartProcessor.GetCountDownShoppingCart(this.productSku, this.buyAmount); } //砍价 else if ((str == "cutDown") && int.TryParse(this.Page.Request.QueryString["cutDownId"], out this.cutDownId)) { this.cutdownHiddenBox.SetWhenIsNotNull(this.cutDownId.ToString()); CutDownInfo info5 = PromoteHelper.GetCutDown(this.cutDownId); if (info5 == null) { base.GotoResourceNotFound(); return; } if (string.IsNullOrEmpty(this.productSku) || (this.productSku.Split(new char[] { '_' })[0] != info5.ProductId.ToString())) { base.GotoResourceNotFound("错误的商品信息"); return; } shoppingCart = ShoppingCartProcessor.GetCutDownShoppingCart(this.productSku, this.buyAmount, info5.CutDownId); } else { shoppingCart = ShoppingCartProcessor.GetShoppingCart(this.productSku, this.buyAmount); } } else { shoppingCart = ShoppingCartProcessor.GetShoppingCart(); } //获取/新建了购物车对象后,进行商品价格根据分销商特殊优惠设置进行减价处理. MemberInfo currentMember = MemberProcessor.GetCurrentMember(); int distributorid = Globals.GetCurrentDistributorId(); //根据分销商的特殊优惠设置进行计算返佣 switch (SettingsManager.GetMasterSettings(false).DistributorCutOff) { case "default": //直接退出,没有任何操作一切照常 break; case "bycostprice": //根据进货价进行返佣 if (currentMember.UserId != distributorid) //如果不是分销商购买自己的产品,则退出特殊处理 { break; } for (int i = 0; i < shoppingCart.LineItems.Count; i++) { shoppingCart.LineItems[i].AdjustedPrice = ProductHelper.GetSkuCostPrice(shoppingCart.LineItems[i].SkuId); } break; default: //根据指定折扣进行返佣(此种情况下,不存在直接分佣) if (currentMember.UserId != distributorid) //如果不是分销商购买自己的产品,则退出特殊处理 { break; } decimal rate = Convert.ToDecimal(SettingsManager.GetMasterSettings(false).DistributorCutOff) / 100; //获取折扣比例 for (int i = 0; i < shoppingCart.LineItems.Count; i++) { shoppingCart.LineItems[i].AdjustedPrice = shoppingCart.LineItems[i].AdjustedPrice * rate; } break; } if (shoppingCart != null) { //根据购物车内商品名是否为[会员充值]和是否开启了会员充值送优惠券的功能来给隐藏域赋值,前端js再进行相应的隐藏显示,默认选中等处理 if (shoppingCart.LineItems.Where(n => n.Name == "会员充值") != null && shoppingCart.LineItems.Where(n => n.Name == "会员充值").Count() == 1 && CustomConfigHelper.Instance.CouponRecharge) { this.couponRecharge.Value = "1"; } else { this.couponRecharge.Value = "0"; } //提交订单前先检查是否达到规则要求上限 if (!TradeHelper.CheckShoppingStock(shoppingCart, out msg)) { this.ShowMessage("订单中有商品(" + msg + ")库存不足", false); if (!this.Page.ClientScript.IsClientScriptBlockRegistered("AlertStockScript")) { StringBuilder builder = new StringBuilder(); builder.AppendLine("var stockError = true;"); builder.AppendLine(string.Format("var stockErrorInfo=\"订单中有商品({0})库存不足,请返回购物车修改库存.\";", msg)); this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "AlertStockScript", "var stockError=true;function AlertStock(){alert('订单中有商品(" + msg + ")库存不足,请返回购物车修改库存.');}", true); } } //当前用户已使用的优惠券信息 DataTable userCoupon = CouponHelper.GetUserCoupons(currentMember.UserId, 2); //代表已使用的 if (userCoupon.Rows.Count > 0) { this.usercount.Value = "1"; } else { ////把当前用户所有优惠券信息取出来 DataTable userCouponList = CouponHelper.GetUserCoupons(currentMember.UserId, 1); //1代表未使用的,有效期内的 ////对当前购物车shoppingCart.LineItems进行循环查找,如果优惠券的categoryId与商品的品类不匹配,把优惠券的claimcode取出来放到隐藏域内,传递到前台,前台再进行相关的隐藏操作 foreach (ShoppingCartItemInfo shopp in shoppingCart.LineItems) { foreach (DataRow coupon in userCouponList.Rows) { if (!Convert.IsDBNull(coupon["CategoryId"])) { int cp = Convert.ToInt32(coupon["CategoryId"]); if (shopp.CategoryId != cp && cp != 0) { claimcode.Value += coupon["ClaimCode"].ToString() + ";"; } } } } } claimcode.Value = claimcode.Value.TrimEnd(';'); this.rptCartProducts.DataSource = shoppingCart.LineItems; this.rptCartProducts.DataBind(); //绑定礼品 this.rptCartGifts.DataSource = shoppingCart.LineGifts; this.rptCartGifts.DataBind(); //绑定配送方式 this.dropShippingType.ShoppingCartItemInfo = shoppingCart.LineItems; this.dropShippingType.RegionId = 0; this.dropShippingType.Weight = shoppingCart.Weight; this.dropCoupon.CartTotal = shoppingCart.GetTotal(); //addby hj 2015-04-23(迪蔓) this.isSelectAgentEnable.Value = CustomConfigHelper.Instance.SelectServerAgent.ToString(); //addby hj 2015-12-25(爽爽挝咖) //给出是否开启街道选择和门店配送功能的标识 this.isStreetEnable.Value = Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping.ToString(); //绑定街道下拉框 if (this.isStreetEnable.Value == "True") { DataTable dtStreetsInfo = Hidistro.ControlPanel.Sales.SalesHelper.GetStreetInfo(regionId.Value.ToString()); if (dtStreetsInfo.Rows.Count > 0) { this.dropStreets.StreetsInfo = dtStreetsInfo; this.isStreetMatch.Value = "True"; } else//此种情况下消费者的所在区域内并没有相应的配送店铺,给出提示,页面无法提交 { this.isStreetMatch.Value = "False"; } } string noCouponIds = string.Empty; string tempCategoryId = string.Empty; DataTable dtDB = CouponHelper.GetCouponAllCate(); //new DataTable();//设置的使用权限的有效期内的优惠卷 两表关联信息 foreach (DataRow dr in dtDB.Rows) { tempCategoryId = "," + dr["CategoryIds"].ToString() + ","; decimal dAmount = (decimal)dr["Amount"]; //计算排除掉不能参与的分类金额 //shoppingCart.LineItems decimal dAmount2 = dropCoupon.CartTotal; foreach (ShoppingCartItemInfo scii in shoppingCart.LineItems) { if (tempCategoryId.IndexOf("," + scii.CategoryId + ",") > -1) { dAmount2 -= scii.SubTotal; } } //待排除的 if (dAmount > dAmount2) { noCouponIds += dr["CouponId"] + ","; } } if (noCouponIds != "") { noCouponIds = noCouponIds.TrimEnd(','); } this.dropCoupon.CouponIds = noCouponIds; this.dropRedPager.CartTotal = shoppingCart.GetTotal(); this.hiddenCartTotal.Value = literal.Text = shoppingCart.GetTotal().ToString("F2"); decimal num = this.DiscountMoney(shoppingCart.LineItems); this.litOrderTotal.Text = (shoppingCart.GetTotal() - num).ToString("F2"); this.litTotalPoint.Text = getTotalPoints(shoppingCart).ToString(); this.litExemption.Text = num.ToString("0.00"); } else { this.Page.Response.Redirect("/Vshop/ShoppingCart.aspx"); } PageTitle.AddSiteNameTitle("订单确认"); } }
protected override void AttachChildControls() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string empty = string.Empty; this.spandemo = (HtmlGenericControl)this.FindControl("spandemo"); this.spandemo.Visible = masterSettings.IsDemoSite; this.litShipTo = (Literal)this.FindControl("litShipTo"); this.litCellPhone = (Literal)this.FindControl("litCellPhone"); this.litAddress = (Literal)this.FindControl("litAddress"); this.rptCartProducts = (Common_SubmmitCartProducts)this.FindControl("Common_SubmmitCartProducts"); this.rptCartProducts.ItemDataBound += this.rptCartProducts_ItemDataBound; this.rptCartGifts = (WapTemplatedRepeater)this.FindControl("rptCartGifts"); this.rptCartPointGifts = (WapTemplatedRepeater)this.FindControl("rptCartPointGifts"); this.divGifts = (HtmlGenericControl)this.FindControl("divGifts"); this.dropCoupon = (Common_CouponSelect)this.FindControl("dropCoupon"); this.lblOrderTotal = (Label)this.FindControl("lblOrderTotal"); this.groupbuyHiddenBox = (HtmlInputControl)this.FindControl("groupbuyHiddenBox"); this.countdownHiddenBox = (HtmlInputControl)this.FindControl("countdownHiddenBox"); this.fightGroupHiddenBox = (HtmlInputControl)this.FindControl("fightGroupHiddenBox"); this.fightGroupActivityHiddenBox = (HtmlInputControl)this.FindControl("fightGroupActivityHiddenBox"); this.lblTotalPrice = (HtmlGenericControl)this.FindControl("lblTotalPrice"); this.lblTotalPrice1 = (HtmlGenericControl)this.FindControl("lblTotalPrice1"); this.lblTax = (HtmlGenericControl)this.FindControl("lblTax"); this.rptPromotions = (WapTemplatedRepeater)this.FindControl("rptPromotions"); this.rptShippingType = (WapTemplatedRepeater)this.FindControl("rptShippingType"); this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect"); this.hidIsMultiStore = (HtmlInputHidden)this.FindControl("hidIsMultiStore"); this.hdCurrentckIds = (HtmlInputControl)this.FindControl("hdCurrentckIds"); this.hidShoppingDeduction = (HtmlInputHidden)this.FindControl("hidShoppingDeduction"); this.hidCanPointUseWithCoupon = (HtmlInputHidden)this.FindControl("hidCanPointUseWithCoupon"); this.lblMaxPoints = (Label)this.FindControl("lblMaxPoints"); this.hidTotalPrice = (HtmlInputHidden)this.FindControl("hidTotalPrice"); this.txtUsePoints = (HtmlInputText)this.FindControl("txtUsePoint"); this.hidShoppingDeductionRatio = (HtmlInputHidden)this.FindControl("hidShoppingDeductionRatio"); this.hidMyPoints = (HtmlInputHidden)this.FindControl("hidMyPoints"); this.hidOrderRate = (HtmlInputHidden)this.FindControl("hidOrderRate"); this.inputPaymentModeId = (HtmlInputHidden)this.FindControl("inputPaymentModeId"); this.hidStoreId = (HtmlInputHidden)this.FindControl("hidStoreId"); this.hidChooseStoreId = (HtmlInputHidden)this.FindControl("hidChooseStoreId"); this.hidStoreName = (HtmlInputHidden)this.FindControl("hidStoreName"); this.lblMaxPointsToPrice = (Label)this.FindControl("lblMaxPointsToPrice"); this.lblDeductibleMoney = (HtmlGenericControl)this.FindControl("lblDeductibleMoney"); this.litTaxRate = (Label)this.FindControl("litTaxRate"); this.hlkFeeFreight = (HyperLink)this.FindControl("hlkFeeFreight"); this.hlkReducedPromotion = (HyperLink)this.FindControl("hlkReducedPromotion"); this.rptOrderCoupon = (WapTemplatedRepeater)this.FindControl("rptOrderCoupon"); this.htmlCouponCode = (HtmlInputHidden)this.FindControl("htmlCouponCode"); this.couponName = (HtmlGenericControl)this.FindControl("couponName"); this.litCouponAmout = (HtmlGenericControl)this.FindControl("litCouponAmout"); this.hidCanUsePoint = (HtmlInputHidden)this.FindControl("hidCanUsePoint"); this.divTax = (HtmlGenericControl)this.FindControl("divTax"); this.spanTaxRate = (HtmlGenericControl)this.FindControl("spanTaxRate"); this.lblGiftFeright = (Label)this.FindControl("lblGiftFeright"); this.hidHasSupplierProduct = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct"); this.hidPointRate = (HtmlInputHidden)this.FindControl("hidPointRate"); this.divlinegifts = (HtmlGenericControl)this.FindControl("divlinegifts"); this.hidOnlinePayCount = (HtmlInputHidden)this.FindControl("hidOnlinePayCount"); this.hidHasStoresInCity = (HtmlInputHidden)this.FindControl("hidHasStoresInCity"); this.hidPaymentId_Offline = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline"); this.storeName = (HtmlGenericControl)this.FindControl("storeName"); this.storeTel = (HtmlGenericControl)this.FindControl("storeTel"); this.storeAddress = (HtmlGenericControl)this.FindControl("storeAddress"); this.storeTime = (HtmlGenericControl)this.FindControl("storeTime"); this.storeDistance = (HtmlGenericControl)this.FindControl("storeDistance"); this.hidIsSubmitInTime = (HtmlInputHidden)this.FindControl("hidIsSubmitInTime"); this.hidInputItemsJson = (HtmlInputHidden)this.FindControl("hidInputItemsJson"); this.hidInvoiceType = (HtmlInputHidden)this.FindControl("hidInvoiceType"); this.hidInvoiceTitle = (HtmlInputHidden)this.FindControl("hidInvoiceTitle"); this.hidInvoiceTaxpayerNumber = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber"); this.hidOpenBalancePay = (HtmlInputHidden)this.FindControl("hidOpenBalancePay"); this.hidBalanceAmount = (HtmlInputHidden)this.FindControl("hidBalanceAmount"); this.lblBalance = (Label)this.FindControl("lblBalance"); this.hidEnableTax = (HtmlInputHidden)this.FindControl("hidEnableTax"); this.hidEnableETax = (HtmlInputHidden)this.FindControl("hidEnableETax"); this.hidEnableVATTax = (HtmlInputHidden)this.FindControl("hidEnableVATTax"); this.hidVATTaxRate = (HtmlInputHidden)this.FindControl("hidVATTaxRate"); this.hidTaxRate = (HtmlInputHidden)this.FindControl("hidTaxRate"); this.hidVATInvoiceDays = (HtmlInputHidden)this.FindControl("hidVATInvoiceDays"); this.litAfterSaleDays = (Literal)this.FindControl("litAfterSaleDays"); this.litInvoiceSendDays = (Literal)this.FindControl("litInvoiceSendDays"); this.hidInvoiceId = (HtmlInputHidden)this.FindControl("hidInvoiceId"); this.hidIsPersonal = (HtmlInputHidden)this.FindControl("hidIsPersonal"); this.hidInvoiceType = (HtmlInputHidden)this.FindControl("hidInvoiceType"); this.hidInvoiceJson = (HtmlInputHidden)this.FindControl("hidInvoiceJson"); this.hidInvoiceTitle = (HtmlInputHidden)this.FindControl("hidInvoiceTitle"); this.hidInvoiceTaxpayerNumber = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber"); this.hidOpenBalancePay.Value = masterSettings.OpenBalancePay.ToNullString().ToLower(); HtmlInputHidden htmlInputHidden = this.hidEnableETax; bool flag = masterSettings.EnableTax; htmlInputHidden.Value = flag.ToString().ToLower(); HtmlInputHidden htmlInputHidden2 = this.hidEnableTax; flag = masterSettings.EnableE_Invoice; htmlInputHidden2.Value = flag.ToString().ToLower(); HtmlInputHidden htmlInputHidden3 = this.hidEnableVATTax; flag = masterSettings.EnableVATInvoice; htmlInputHidden3.Value = flag.ToString().ToLower(); this.hidVATTaxRate.Value = masterSettings.VATTaxRate.ToNullString(); this.hidTaxRate.Value = masterSettings.TaxRate.ToNullString(); this.hidVATInvoiceDays.Value = masterSettings.VATInvoiceDays.ToNullString(); this.litAfterSaleDays.SetWhenIsNotNull(masterSettings.EndOrderDays.ToNullString()); this.litInvoiceSendDays.SetWhenIsNotNull((masterSettings.EndOrderDays + masterSettings.VATInvoiceDays).ToNullString()); this.hidOpenBalancePay.Value = masterSettings.OpenBalancePay.ToNullString().ToLower(); this.hidIsPreSale = (HtmlInputHidden)this.FindControl("hidIsPreSale"); this.lblAmount = (HtmlGenericControl)this.FindControl("lblAmount"); this.lblDepositMoney = (HtmlGenericControl)this.FindControl("lblDepositMoney"); this.lblRetainage = (HtmlGenericControl)this.FindControl("lblRetainage"); this.hidHasTradePassword = (HtmlInputHidden)this.FindControl("hidHasTradePassword"); this.hidIsGeneralMuti = (HtmlInputHidden)this.FindControl("hidIsGeneralMuti"); if (this.hidPointRate != null) { this.hidPointRate.Value = HiContext.Current.SiteSettings.PointsRate.F2ToString("f2"); } this.buyAmount = this.Page.Request.QueryString["buyAmount"].ToInt(0); this.productSku = this.Page.Request.QueryString["productSku"].ToNullString(); this.groupBuyId = this.Page.Request.QueryString["groupBuyId"].ToInt(0); this.countDownId = this.Page.Request.QueryString["countdownId"].ToInt(0); this.fightGroupActivityId = this.Page.Request.QueryString["fightGroupActivityId"].ToInt(0); this.fightGroupId = this.Page.Request.QueryString["fightGroupId"].ToInt(0); this.hidHasStoresInCity.Value = "false"; if (this.buyAmount > 0 && !string.IsNullOrEmpty(this.productSku) && !string.IsNullOrEmpty(this.from) && (this.from == "signbuy" || this.from == "groupbuy" || this.from == "countdown" || this.from == "fightgroup" || this.from == "presale")) { if (this.isGroupBuy) { this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString()); this.cart = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount); } else if (this.isCountDown) { this.countdownHiddenBox.SetWhenIsNotNull(this.countDownId.ToString()); } else if (this.isFightGroup) { this.fightGroupHiddenBox.SetWhenIsNotNull(this.fightGroupId.ToString()); this.fightGroupActivityHiddenBox.SetWhenIsNotNull(this.fightGroupActivityId.ToString()); } else if (this.isPreSale) { this.hidIsPreSale.Value = "1"; this.FindControl("ulpresale").Visible = true; } this.hdCurrentckIds.Value = this.productSku; } else { string value = string.Empty; if (string.IsNullOrEmpty(this.productSku)) { HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["ckids"]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { value = Globals.UrlDecode(httpCookie.Value); } } else { value = this.productSku; } this.hdCurrentckIds.Value = value; } if (this.cart != null && ((this.cart.LineItems != null && this.cart.LineItems.Count > 0) || (this.cart.LineGifts != null && this.cart.LineGifts.Count > 0))) { if (!TradeHelper.CheckShoppingStock(this.cart, out empty, this.storeId)) { this.ShowWapMessage("订单中有商品(" + empty + ")库存不足", "ShoppingCart.aspx"); } this.hidOnlinePayCount.Value = TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup).ToNullString(); this.bindShippingPaymentInfo(); this.divTax.Visible = false; Label label = this.litTaxRate; decimal num = masterSettings.TaxRate; label.Text = num.ToString(CultureInfo.InvariantCulture); this.spanTaxRate.Visible = (masterSettings.TaxRate > decimal.Zero); this.hidOrderRate.Value = ((masterSettings.TaxRate > decimal.Zero) ? (this.cart.GetTotal(this.storeId > 0) * masterSettings.TaxRate / 100m).F2ToString("f2") : "0.00"); MemberInfo user = Users.GetUser(HiContext.Current.UserId); this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1"); this.hidBalanceAmount.Value = (user.Balance - user.RequestBalance).F2ToString("f2"); this.lblBalance.Text = (user.Balance - user.RequestBalance).F2ToString("f2"); this.bindCouponInfo(); this.rptCartProducts.RegionId = this.userRegionId; var dataSource = (from i in (from i in this.cart.LineItems select new { i.SupplierId, i.SupplierName }).Distinct() orderby i.SupplierId select i).ToList(); this.rptCartProducts.DataSource = dataSource; this.rptCartProducts.ShoppingCart = this.cart; this.rptCartProducts.StoreId = this.storeId; this.rptCartProducts.DataBind(); if ((from i in this.cart.LineItems where i.SupplierId == 0 select i).Count() <= 0) { this.divTax.Visible = false; } if ((from i in this.cart.LineItems where i.SupplierId > 0 select i).Count() > 0) { this.hidHasSupplierProduct.Value = "1"; } if (this.isPreSale) { decimal num2 = default(decimal); ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PresaleId); if (this.cart != null) { num2 = ((productPreSaleInfo.Deposit == decimal.Zero) ? (this.cart.LineItems[0].MemberPrice * (decimal)productPreSaleInfo.DepositPercent / 100m) : productPreSaleInfo.Deposit) * (decimal)this.cart.LineItems[0].Quantity; } this.lblTotalPrice.InnerHtml = this.cart.GetAmount(false).F2ToString("f2"); HtmlGenericControl htmlGenericControl = this.lblTotalPrice1; Label label2 = this.lblOrderTotal; string text3 = htmlGenericControl.InnerText = (label2.Text = num2.F2ToString("f2")); this.lblDepositMoney.InnerText = num2.F2ToString("f2"); decimal num3 = this.cart.GetTotal(false) - num2; if (num3 < decimal.Zero) { num3 = default(decimal); } this.lblRetainage.InnerText = num3.F2ToString("f2"); this.lblAmount.InnerText = (num2 + num3).F2ToString("f2"); HtmlInputHidden htmlInputHidden4 = this.hidTotalPrice; num = this.cart.GetTotal(false); htmlInputHidden4.Value = num.ToString(); } else { HtmlInputHidden htmlInputHidden5 = this.hidTotalPrice; Label label3 = this.lblOrderTotal; string text3 = htmlInputHidden5.Value = (label3.Text = this.cart.GetTotal(this.storeId > 0).F2ToString("f2")); HtmlGenericControl htmlGenericControl2 = this.lblTotalPrice1; HtmlGenericControl htmlGenericControl3 = this.lblTotalPrice; text3 = (htmlGenericControl2.InnerText = (htmlGenericControl3.InnerHtml = this.cart.GetAmount(this.storeId > 0).F2ToString("f2"))); } if (this.cart != null) { this.BindSendGifts(); if (this.storeId <= 0) { this.BindPointGifts(); } } this.hidCanPointUseWithCoupon.Value = "false"; this.hidCanUsePoint.Value = "false"; bool flag2 = true; if (this.isGroupBuy || this.isCountDown || this.cart.LineItems.Count == 0 || this.isFightGroup) { flag2 = false; } if (flag2 && user != null && masterSettings.ShoppingDeduction > 0 && user.Points > 0) { int shoppingDeductionRatio = masterSettings.ShoppingDeductionRatio; decimal num4 = (decimal)shoppingDeductionRatio * this.cart.GetTotal(this.storeId > 0) * (decimal)masterSettings.ShoppingDeduction / 100m; int num5 = ((decimal)user.Points > num4) ? ((int)num4) : user.Points; decimal d2 = Math.Round((decimal)num5 / (decimal)masterSettings.ShoppingDeduction, 2); if (d2 > decimal.Zero && num5 > 0) { HtmlInputHidden htmlInputHidden6 = this.hidShoppingDeduction; int num6 = masterSettings.ShoppingDeduction; htmlInputHidden6.Value = num6.ToString(); this.lblMaxPoints.Text = num5.ToString(); this.lblMaxPointsToPrice.Text = (num5 / masterSettings.ShoppingDeduction).F2ToString("f2"); this.hidCanPointUseWithCoupon.Value = (masterSettings.CanPointUseWithCoupon ? "true" : "false"); this.hidShoppingDeductionRatio.Value = shoppingDeductionRatio.ToString(); HtmlInputHidden htmlInputHidden7 = this.hidMyPoints; num6 = user.Points; htmlInputHidden7.Value = num6.ToString(); this.hidCanUsePoint.Value = "true"; } } this.bindPromtionsInfo(); this.BindLastInvoiceInfo(); ShoppingCartItemInfo shoppingCartItemInfo = this.cart.LineItems.FirstOrDefault(); int productId = shoppingCartItemInfo.ProductId; ProductInfo productBaseDetails = ProductHelper.GetProductBaseDetails(productId); IList <ProductInputItemInfo> productInputItemList = ProductHelper.GetProductInputItemList(productId); this.hidIsGeneralMuti.Value = productBaseDetails.IsGenerateMore.ToNullString().ToLower(); string value2 = JsonConvert.SerializeObject(new { list = from d in productInputItemList select new { d.Id, d.InputFieldTitle, d.InputFieldType, d.IsRequired, d.InputFileValues } }); this.hidInputItemsJson.Value = value2; PageTitle.AddSiteNameTitle("订单确认"); } else if (!this.hasError) { this.ShowWapMessage("该订单没有任何商品,请重新选择", "default.aspx"); } }
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("订单确认"); } }
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("确认订单"); }
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("订单确认"); }
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(); } }