Exemplo n.º 1
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (!TradeHelper.CanRefund(this.hdorderId.Value))
            {
                this.ShowMessage("已有待确认的申请!", false);
                return;
            }
            if (!this.CanRefundBalance())
            {
                this.ShowMessage("请先开通预付款账户", false);
                return;
            }
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.hdorderId.Value);
            //if (orderInfo.InClearance)
            //{
            //    this.ShowMessage("清关中,不支持退款", false);
            //    this.lkbtnApplyForReturn.Visible = true;
            //    this.lkbtnApplyForRefund.Visible = false;
            //    return;
            //}
            string reason = this.dropRefundReason.SelectedIndex == this.dropRefundReason.Items.Count - 1 ? this.txtRemark.Text : this.dropRefundReason.Text;

            string flagMsg = "";

            if (TradeHelper.ApplyForRefund(this.hdorderId.Value, reason, int.Parse(this.dropRefundType.SelectedValue), out flagMsg))
            {
                orderInfo = TradeHelper.GetOrderInfo(this.orderId);
                this.BindOrderBase(orderInfo);
                this.ShowMessage("成功的申请了退款", true);
                return;
            }
            this.ShowMessage("申请退款失败 " + flagMsg, false);
        }
Exemplo n.º 2
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!TradeHelper.CanRefund(this.hdorderId.Value))
     {
         this.ShowMessage("已有待确认的申请!", false);
     }
     else
     {
         if (!this.CanRefundBalance())
         {
             this.ShowMessage("请先开通预付款账户", false);
         }
         else
         {
             if (TradeHelper.ApplyForRefund(this.hdorderId.Value, this.txtRemark.Text, int.Parse(this.dropRefundType.SelectedValue)))
             {
                 this.BindOrders();
                 this.ShowMessage("成功的申请了退款", true);
             }
             else
             {
                 this.ShowMessage("申请退款失败", false);
             }
         }
     }
 }
Exemplo n.º 3
0
        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;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void btnRefund_Click(object sender, EventArgs e)
        {
            string text = this.Page.Request.QueryString["returnUrl"].ToNullString();

            if (string.IsNullOrEmpty(text))
            {
                text = this.Page.Request.UrlReferrer.ToNullString();
                if (text == this.Page.Request.Url.ToString())
                {
                    text = "/User/UserOrders";
                }
            }
            string text2 = "";
            string text3 = "";
            string text4 = "";

            text2            = Globals.StripAllTags(this.txtBankName.Value);
            text3            = Globals.StripAllTags(this.txtBankAccountName.Value);
            text4            = Globals.StripAllTags(this.txtBankAccountNo.Value);
            this.iRefundType = this.hidRefundType.Value.ToInt(0);
            if (!Enum.IsDefined(typeof(RefundTypes), this.iRefundType))
            {
                this.ShowMessage("错误的退款方式", false, "", 1);
            }
            string enumDescription = EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1);

            if ((this.order.Gateway.ToLower() == enumDescription || this.order.DepositGatewayOrderId.ToNullString().ToLower() == enumDescription) && this.iRefundType != 1)
            {
                this.ShowMessage("预付款支付的订单只能退回到预付款帐号", false, "", 1);
            }
            else
            {
                if (this.order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.order.FightGroupId);
                    if (fightGroup != null && fightGroup.Status == FightGroupStatus.FightGroupIn)
                    {
                        this.ShowMessage("拼团过程中时,已完成支付的订单不能发起退款;", false, "", 1);
                        return;
                    }
                }
                if (!TradeHelper.CanRefund(this.order, ""))
                {
                    this.ShowMessage("当前订单不能进行退款操作!", false, "", 1);
                }
                else
                {
                    string userRemark = Globals.StripAllTags(this.txtRemark.Text.Trim());
                    if (this.iRefundType == 2 && (string.IsNullOrEmpty(text2) || string.IsNullOrEmpty(text3) || string.IsNullOrEmpty(text4)))
                    {
                        this.ShowMessage("您选择了银行退款,请在退款说明中输入退款的银行卡信息!", true, "", 1);
                    }
                    else if (!this.CanRefundBalance())
                    {
                        this.ShowMessage("请先开通预付款账户", false, "", 1);
                    }
                    else
                    {
                        string selectedValue = this.DropRefundReason.SelectedValue;
                        if (string.IsNullOrEmpty(selectedValue))
                        {
                            this.ShowMessage("请选择退款原因", true, "", 1);
                        }
                        string refundGateWay = string.IsNullOrEmpty(this.order.Gateway) ? "" : this.order.Gateway.ToLower().Replace(".payment.", ".refund.");
                        int    num           = 0;
                        num = this.order.GetAllQuantity(true);
                        GroupBuyInfo groupbuy = null;
                        if (this.order.GroupBuyId > 0)
                        {
                            groupbuy = ProductBrowser.GetGroupBuy(this.order.GroupBuyId);
                        }
                        decimal canRefundAmount = this.order.GetCanRefundAmount("", groupbuy, 0);
                        string  orderId         = this.order.OrderId;
                        if (this.RefundItem != null)
                        {
                            orderId = this.RefundItem.ItemDescription + this.RefundItem.SKUContent;
                            num     = this.RefundItem.ShipmentQuantity;
                        }
                        string     generateId = Globals.GetGenerateId();
                        RefundInfo refundInfo = new RefundInfo();
                        refundInfo.OrderId         = this.order.OrderId;
                        refundInfo.UserRemark      = userRemark;
                        refundInfo.RefundGateWay   = refundGateWay;
                        refundInfo.RefundOrderId   = generateId;
                        refundInfo.BankName        = text2;
                        refundInfo.BankAccountNo   = text4;
                        refundInfo.BankAccountName = text3;
                        refundInfo.ApplyForTime    = DateTime.Now;
                        refundInfo.StoreId         = this.order.StoreId;
                        refundInfo.RefundReason    = selectedValue;
                        refundInfo.RefundType      = (RefundTypes)this.iRefundType;
                        refundInfo.RefundAmount    = canRefundAmount;
                        if (TradeHelper.ApplyForRefund(refundInfo))
                        {
                            if (this.order.StoreId > 0)
                            {
                                VShopHelper.AppPsuhRecordForStore(this.order.StoreId, this.OrderId, "", EnumPushStoreAction.StoreOrderRefundApply);
                            }
                            this.ShowMessage("成功的申请了退款", true, text, 2);
                        }
                        else
                        {
                            this.ShowMessage("申请退款失败", false, "", 1);
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 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);
                 }
             }
         }
     }
 }