protected override void AttachChildControls() { this.hidErrorMsg = (HtmlInputHidden)this.FindControl("hidErrorMsg"); this.txtOrderId = (HtmlInputHidden)this.FindControl("txtOrderId"); this.litOrderIds = (Literal)this.FindControl("litOrderIds"); this.txtSkuId = (HtmlInputHidden)this.FindControl("txtSkuId"); this.txtRemark = (TextBox)this.FindControl("txtRemark"); this.txtRefundAmount = (TextBox)this.FindControl("txtRefundMoney"); this.dropRefundType = (WapRefundTypeDropDownList)this.FindControl("dropRefundType"); this.DropReturnsReason = (WapAfterSalesReasonDropDownList)this.FindControl("ReturnsReasonDropDownList"); this.btnReturns = ButtonManager.Create(this.FindControl("btnReturns")); this.litProductName = (Literal)this.FindControl("litProductName"); this.txtQuantity = (TextBox)this.FindControl("txtQuantity"); this.divQuantity = (HtmlTableRow)this.FindControl("divQuantity"); this.divQuantityTag = (HtmlTableRow)this.FindControl("divQuantityTag"); this.litMaxAmount = (Literal)this.FindControl("litMaxAmount"); this.litMaxQuantity = (Literal)this.FindControl("litMaxQuantity"); this.hidOneMaxRefundAmount = (HtmlInputHidden)this.FindControl("hidOneMaxRefundAmount"); this.groupbuyPanel = (HtmlGenericControl)this.FindControl("groupbuyPanel"); this.hidMaxRefundAmount = (HtmlInputHidden)this.FindControl("hidMaxRefundAmount"); this.txtOrderId.Value = this.OrderId; this.txtSkuId.Value = this.SkuId; this.litOrderIds.Text = this.OrderId; PageTitle.AddSiteNameTitle("退货申请"); this.order = TradeHelper.GetOrderInfo(this.OrderId); if (this.order == null) { this.ShowError("错误的订单信息!"); } else if (!TradeHelper.CanReturn(this.order, this.SkuId)) { this.ShowError("订单状态不正确或者已有未处理完成的退款/退货申请!"); } else if (string.IsNullOrEmpty(this.SkuId) || !this.order.LineItems.ContainsKey(this.SkuId)) { this.ShowError("错误的商品信息!"); } else { decimal canRefundAmount = this.order.GetCanRefundAmount(this.SkuId, null, 0); decimal canRefundAmount2 = this.order.GetCanRefundAmount(this.SkuId, null, 1); if (canRefundAmount < decimal.Zero) { this.ShowError("订单中已申请的退款金额超过了订单总额!"); } else { if (this.order.LineItems.ContainsKey(this.SkuId)) { this.ReturnsItem = this.order.LineItems[this.SkuId]; } else { if (this.divQuantity != null) { this.divQuantity.Style.Add("display", "none"); } if (this.divQuantityTag != null) { this.divQuantityTag.Style.Add("display", "none"); } } if (!string.IsNullOrEmpty(this.SkuId)) { LineItemInfo lineItemInfo = this.order.LineItems[this.SkuId]; this.litProductName.Text = lineItemInfo.ItemDescription; } else { this.txtQuantity.ReadOnly = true; this.litProductName.Text = "所有商品"; } if (!this.Page.IsPostBack) { this.litMaxQuantity.Text = TradeHelper.GetMaxQuantity(this.order, this.SkuId).ToString(); this.litMaxAmount.Text = canRefundAmount.F2ToString("f2"); this.hidOneMaxRefundAmount.Value = canRefundAmount2.F2ToString("f2"); this.hidMaxRefundAmount.Value = this.litMaxAmount.Text; this.txtQuantity.Text = this.litMaxQuantity.Text; this.txtRefundAmount.Text = this.litMaxAmount.Text; this.txtRefundAmount.Attributes.Add("placeholder", "最多可退款" + this.litMaxAmount.Text); this.txtQuantity.Attributes.Add("placeholder", "最后可售后数量" + this.txtQuantity.Text + "件"); this.dropRefundType.preSaleId = this.order.PreSaleId; string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1); this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0 && this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) ? enumDescription : this.order.Gateway); this.dropRefundType.BalanceAmount = this.order.BalanceAmount; } } } }
protected override void AttachChildControls() { this.hidErrorMsg = (HtmlInputHidden)this.FindControl("hidErrorMsg"); this.txtOrderId = (HtmlInputHidden)this.FindControl("txtOrderId"); this.litOrderIds = (Literal)this.FindControl("litOrderIds"); this.txtSkuId = (HtmlInputHidden)this.FindControl("txtSkuId"); this.txtRemark = (TextBox)this.FindControl("txtRemark"); this.litRefundMoney = (Literal)this.FindControl("litRefundMoney"); this.dropRefundType = (WapRefundTypeDropDownList)this.FindControl("dropRefundType"); this.DropRefundReason = (WapAfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList"); this.btnRefund = ButtonManager.Create(this.FindControl("btnRefund")); this.groupbuyPanel = (HtmlGenericControl)this.FindControl("groupbuyPanel"); this.hidOneRefundAmount = (HtmlInputHidden)this.FindControl("hidOneRefundAmount"); this.hidIsServiceOrder = (HtmlInputHidden)this.FindControl("hidIsServiceOrder"); this.hidValidCodes = (HtmlInputHidden)this.FindControl("hidValidCodes"); this.rptOrderPassword = (WapTemplatedRepeater)this.FindControl("rptOrderPassword"); decimal num = default(decimal); decimal d = default(decimal); this.txtOrderId.Value = this.OrderId; this.litOrderIds.Text = this.OrderId; this.txtSkuId.Value = this.SkuId; this.order = TradeHelper.GetOrderInfo(this.OrderId); if (this.order == null) { this.ShowError("错误的订单信息!"); } else { this.IsServiceOrder = (this.order.OrderType == OrderType.ServiceOrder); this.hidIsServiceOrder.Value = (this.IsServiceOrder ? "1" : "0"); this.hidOneRefundAmount.Value = "0"; if (this.order.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId); if (fightGroup.Status != FightGroupStatus.FightGroupSuccess) { this.ShowError("火拼团订单成团之前不能进行退款操作!"); return; } } GroupBuyInfo groupBuyInfo = null; if (this.order.GroupBuyId > 0) { groupBuyInfo = ProductBrowser.GetGroupBuy(this.order.GroupBuyId); if (groupBuyInfo != null) { if (this.groupbuyPanel != null && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.groupbuyPanel.Visible = true; } if (groupBuyInfo.NeedPrice >= this.order.GetTotal(false) && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.ShowError("团购违约金大于等于订单总金额,不能进行退款申请!"); return; } } num = this.order.GetCanRefundAmount(this.SkuId, groupBuyInfo, 0); } else { num = this.order.GetCanRefundAmount(this.SkuId, null, 0); } if (!this.IsServiceOrder) { if (TradeHelper.IsOnlyOneSku(this.order)) { this.SkuId = ""; } if (!string.IsNullOrEmpty(this.SkuId) && !this.order.LineItems.ContainsKey(this.SkuId)) { this.ShowError("错误的商品信息!"); return; } if (!TradeHelper.CanRefund(this.order, this.SkuId)) { this.ShowError("订单状态不正确或者已有未处理完成的退款/退货申请!"); return; } if (this.order.LineItems.ContainsKey(this.SkuId)) { this.RefundItem = this.order.LineItems[this.SkuId]; } } else { if (this.order.OrderStatus == OrderStatus.WaitBuyerPay || this.order.OrderStatus == OrderStatus.Closed || this.order.OrderStatus == OrderStatus.ApplyForRefund || this.order.OrderStatus == OrderStatus.Refunded) { this.ShowError("订单状态不正确,不能申请退款!"); } bool flag = TradeHelper.GatewayIsCanBackReturn(this.order.Gateway); bool flag2 = this.order.Gateway.ToLower() == "hishop.plugins.payment.cashreceipts" && this.order.StoreId > 0 && this.order.ShippingModeId == -2; MemberInfo user = Users.GetUser(this.order.UserId); LineItemInfo lineItemInfo = this.order.LineItems.Values.FirstOrDefault(); if (!lineItemInfo.IsRefund) { this.ShowError("商品不支持退款!"); } if (!lineItemInfo.IsValid && lineItemInfo.ValidEndDate.HasValue && lineItemInfo.ValidEndDate.Value < DateTime.Now && !lineItemInfo.IsOverRefund) { this.ShowError("已过有效期,不能申请退款!"); } IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.order.OrderId); if (orderVerificationItems == null || orderVerificationItems.Count == 0) { this.ShowError("核销码为空!"); } IList <OrderVerificationItemInfo> list = null; list = ((!lineItemInfo.ValidEndDate.HasValue || !(lineItemInfo.ValidEndDate.Value < DateTime.Now) || !lineItemInfo.IsOverRefund) ? (from vi in orderVerificationItems where vi.VerificationStatus == 0 select vi).ToList() : (from vi in orderVerificationItems where vi.VerificationStatus == 0 || vi.VerificationStatus == 3 select vi).ToList()); if (list == null || list.Count == 0) { this.ShowError("没有可以退款的核销码!"); } DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("Index")); dataTable.Columns.Add(new DataColumn("Password")); for (int j = 0; j < list.Count; j++) { DataRow dataRow = dataTable.NewRow(); dataRow["Index"] = j + 1; dataRow["Password"] = list[j].VerificationPassword; dataTable.Rows.Add(dataRow); } this.rptOrderPassword.DataSource = dataTable; this.rptOrderPassword.DataBind(); d = (this.order.GetTotal(false) / (decimal)lineItemInfo.Quantity).F2ToString("f2").ToDecimal(0); this.hidValidCodes.Value = string.Join(",", (from i in list select i.VerificationPassword).ToList()); this.hidOneRefundAmount.Value = d.ToString(); num = d * (decimal)list.Count; } if (num < decimal.Zero) { this.ShowError("订单中已申请的退款金额超过了订单总额!"); } else { this.litRefundMoney.Text = num.F2ToString("f2"); PageTitle.AddSiteNameTitle("我的订单"); if (!this.Page.IsPostBack) { this.dropRefundType.IsServiceOrder = (this.order.OrderType == OrderType.ServiceOrder); this.DropRefundReason.IsRefund = true; this.dropRefundType.preSaleId = this.order.PreSaleId; string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1); this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0 && this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) ? enumDescription : this.order.Gateway); this.dropRefundType.BalanceAmount = this.order.BalanceAmount; } } } }
protected override void AttachChildControls() { this.hidErrorMsg = (HtmlInputHidden)this.FindControl("hidErrorMsg"); this.txtOrderId = (HtmlInputHidden)this.FindControl("txtOrderId"); this.litOrderIds = (Literal)this.FindControl("litOrderIds"); this.txtSkuId = (HtmlInputHidden)this.FindControl("txtSkuId"); this.txtRemark = (TextBox)this.FindControl("txtRemark"); this.litRefundMoney = (Literal)this.FindControl("litRefundMoney"); this.dropRefundType = (WapRefundTypeDropDownList)this.FindControl("dropRefundType"); this.DropRefundReason = (WapAfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList"); this.btnRefund = ButtonManager.Create(this.FindControl("btnRefund")); this.groupbuyPanel = (HtmlGenericControl)this.FindControl("groupbuyPanel"); this.txtOrderId.Value = this.OrderId; this.litOrderIds.Text = this.OrderId; this.txtSkuId.Value = this.SkuId; this.order = TradeHelper.GetOrderInfo(this.OrderId); if (this.order == null) { this.ShowError("错误的订单信息!"); } else { if (this.order.FightGroupId > 0) { FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId); if (fightGroup.Status != FightGroupStatus.FightGroupSuccess) { this.ShowError("火拼团订单成团之前不能进行退款操作!"); return; } } if (TradeHelper.IsOnlyOneSku(this.order)) { this.SkuId = ""; } if (!string.IsNullOrEmpty(this.SkuId) && !this.order.LineItems.ContainsKey(this.SkuId)) { this.ShowError("错误的商品信息!"); } else if (!TradeHelper.CanRefund(this.order, this.SkuId)) { this.ShowError("订单状态不正确或者已有未处理完成的退款/退货申请!"); } else { if (this.order.LineItems.ContainsKey(this.SkuId)) { this.RefundItem = this.order.LineItems[this.SkuId]; } GroupBuyInfo groupBuyInfo = null; if (this.order.GroupBuyId > 0) { groupBuyInfo = ProductBrowser.GetGroupBuy(this.order.GroupBuyId); if (groupBuyInfo != null) { if (this.groupbuyPanel != null && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.groupbuyPanel.Visible = true; } if (groupBuyInfo.NeedPrice > this.order.GetTotal(false) && groupBuyInfo.Status != GroupBuyStatus.Failed) { this.ShowError("团购违约金大于订单总金额,不能进行退款申请!"); return; } } } decimal canRefundAmount = this.order.GetCanRefundAmount(this.SkuId, groupBuyInfo, 0); if (canRefundAmount < decimal.Zero) { this.ShowError("订单中已申请的退款金额超过了订单总额!"); } else { this.litRefundMoney.Text = canRefundAmount.F2ToString("f2"); PageTitle.AddSiteNameTitle("申请退款"); if (!this.Page.IsPostBack) { this.DropRefundReason.IsRefund = true; this.dropRefundType.preSaleId = this.order.PreSaleId; string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1); this.dropRefundType.BalanceAmount = this.order.BalanceAmount; this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0 && this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) ? enumDescription : this.order.Gateway); } } } } }