Пример #1
0
 protected override void AttachChildControls()
 {
     this.hdorderId          = (HtmlInputHidden)this.FindControl("hdorderId");
     this.txtRemark          = (TextBox)this.FindControl("txtRemark");
     this.litRefundAmount    = (Literal)this.FindControl("litRefundAmount");
     this.dropRefundType     = (RefundTypeRadioList)this.FindControl("dropRefundType");
     this.DropRefundReason   = (AfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList");
     this.btnRefund          = ButtonManager.Create(this.FindControl("btnRefund"));
     this.groupbuyPanel      = (HtmlGenericControl)this.FindControl("groupbuyPanel");
     this.OrderId            = HttpContext.Current.Request.QueryString["OrderId"].ToNullString();
     this.txtBankName        = (HtmlInputText)this.FindControl("txtBankName");
     this.txtBankAccountName = (HtmlInputText)this.FindControl("txtBankAccountName");
     this.txtBankAccountNo   = (HtmlInputText)this.FindControl("txtBankAccountNo");
     this.products           = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales");
     this.hidRefundType      = (HiddenField)this.FindControl("hidRefundType");
     this.order = TradeHelper.GetOrderInfo(this.OrderId);
     if (this.order == null || this.order.UserId != HiContext.Current.UserId)
     {
         this.ShowMessage("错误的订单信息!", false, "", 1);
     }
     else
     {
         if (this.order.FightGroupId > 0)
         {
             FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId);
             if (fightGroup.Status != FightGroupStatus.FightGroupSuccess && fightGroup.Status != FightGroupStatus.FightGroupFail)
             {
                 this.ShowMessage("火拼团订单成团之前不能进行退款操作!", false, "", 1);
                 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.ShowMessage("团购违约金大于等于订单总金额,不能进行退款申请!", false, "", 1);
                     return;
                 }
             }
         }
         decimal num = this.order.GetCanRefundAmount("", groupBuyInfo, 0);
         if (num < decimal.Zero)
         {
             num = default(decimal);
         }
         this.litRefundAmount.Text = num.F2ToString("f2");
         this.products.DataSource  = this.order.LineItems.Values;
         this.products.DataBind();
         this.btnRefund.Click += this.btnRefund_Click;
         PageTitle.AddSiteNameTitle("申请退款");
         if (!this.Page.IsPostBack)
         {
             this.DropRefundReason.IsRefund = true;
             this.DropRefundReason.DataBind();
             string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1);
             if (this.order.PreSaleId <= 0 || this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString() == enumDescription)
             {
                 this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0) ? enumDescription : this.order.Gateway);
             }
             this.dropRefundType.BalanceAmount = this.order.BalanceAmount;
             this.dropRefundType.DataBind();
         }
     }
 }
Пример #2
0
 protected override void AttachChildControls()
 {
     this.hdorderId             = (HtmlInputHidden)this.FindControl("hdorderId");
     this.txtRemark             = (TextBox)this.FindControl("txtRemark");
     this.txtRefundAmount       = (TextBox)this.FindControl("txtRefundMoney");
     this.dropRefundType        = (RefundTypeRadioList)this.FindControl("dropRefundType");
     this.DropReturnsReason     = (AfterSalesReasonDropDownList)this.FindControl("RefundReasonDropDownList");
     this.btnSubmit             = ButtonManager.Create(this.FindControl("btnSubmit"));
     this.txtQuantity           = (HtmlInputText)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.groupbuyPanel         = (HtmlGenericControl)this.FindControl("groupbuyPanel");
     this.hidRefundType         = (HiddenField)this.FindControl("hidRefundType");
     this.hidAfterSaleType      = (HiddenField)this.FindControl("hidAfterSaleType");
     this.hidePicture           = (HiddenField)this.FindControl("fmSrc");
     this.txtBankName           = (HtmlInputText)this.FindControl("txtBankName");
     this.txtBankAccountName    = (HtmlInputText)this.FindControl("txtBankAccountName");
     this.txtBankAccountNo      = (HtmlInputText)this.FindControl("txtBankAccountNo");
     this.hidMaxQuantity        = (HtmlInputHidden)this.FindControl("hidMaxQuantity");
     this.products              = (Common_OrderItems_AfterSales)this.FindControl("Common_OrderItems_AfterSales");
     this.hidOneMaxRefundAmount = (HtmlInputHidden)this.FindControl("hidOneMaxRefundAmount");
     this.hidMaxRefundAmount    = (HtmlInputHidden)this.FindControl("hidMaxRefundAmount");
     PageTitle.AddSiteNameTitle("我的订单");
     this.OrderId = HttpContext.Current.Request.QueryString["OrderId"].ToNullString();
     this.SkuId   = HttpContext.Current.Request.QueryString["SkuId"].ToNullString();
     this.order   = TradeHelper.GetOrderInfo(this.OrderId);
     if (this.order == null || this.order.UserId != HiContext.Current.UserId)
     {
         this.ShowMessage("错误的订单信息!", false, "", 1);
     }
     else if (string.IsNullOrEmpty(this.SkuId) || !this.order.LineItems.ContainsKey(this.SkuId))
     {
         this.ShowMessage("错误的商品信息!", false, "", 1);
     }
     else
     {
         if (this.products != null)
         {
             if (string.IsNullOrEmpty(this.SkuId))
             {
                 this.products.DataSource = this.order.LineItems.Values;
             }
             else
             {
                 Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                 foreach (LineItemInfo value in this.order.LineItems.Values)
                 {
                     if (value.SkuId == this.SkuId)
                     {
                         dictionary.Add(value.SkuId, value);
                     }
                 }
                 this.products.DataSource = dictionary.Values;
             }
             this.products.DataBind();
         }
         decimal canRefundAmount = this.order.GetCanRefundAmount(this.SkuId, this.groupBuy, 0);
         if (canRefundAmount < decimal.Zero)
         {
             this.ShowMessage("订单中已申请的退款金额超过了订单总额!", false, "", 1);
         }
         else
         {
             decimal canRefundAmount2 = this.order.GetCanRefundAmount(this.SkuId, this.groupBuy, 1);
             if (this.order.LineItems.ContainsKey(this.SkuId))
             {
                 this.ReturnsItem = this.order.LineItems[this.SkuId];
             }
             this.btnSubmit.Click += this.btnReturns_Click;
             if (!this.Page.IsPostBack)
             {
                 this.DropReturnsReason.DataBind();
                 this.hidOneMaxRefundAmount.Value = canRefundAmount2.F2ToString("f2");
                 this.litMaxAmount.Text           = canRefundAmount.F2ToString("f2");
                 this.litMaxQuantity.Text         = TradeHelper.GetMaxQuantity(this.order, this.SkuId).ToString();
                 this.hidMaxQuantity.Value        = this.litMaxQuantity.Text;
                 this.txtQuantity.Value           = this.litMaxQuantity.Text;
                 this.txtRefundAmount.Text        = this.litMaxAmount.Text;
                 this.hidMaxRefundAmount.Value    = this.litMaxAmount.Text;
                 string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1);
                 if (this.order.PreSaleId <= 0 || this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString() == enumDescription)
                 {
                     this.dropRefundType.OrderGateWay = ((this.order.PreSaleId > 0) ? enumDescription : this.order.Gateway);
                 }
                 this.dropRefundType.BalanceAmount = this.order.BalanceAmount;
                 this.dropRefundType.DataBind();
             }
         }
     }
 }