Ejemplo n.º 1
0
        private void btnGetGoods_Click(object sender, EventArgs e)
        {
            int     num  = this.Page.Request["ReturnId"].ToInt(0);
            string  text = "";
            decimal num2 = this.txtRefundMoney.Text.ToDecimal(0);

            text = Globals.StripAllTags(this.txtAdminRemark.Text);
            ReturnInfo returnInfo = TradeHelper.GetReturnInfo(num);
            OrderInfo  orderInfo  = TradeHelper.GetOrderInfo(returnInfo.OrderId);

            if (orderInfo == null)
            {
                this.ShowMsg("订单不存在!", false);
            }
            else if (returnInfo == null)
            {
                this.ShowMsg("退货信息错误!", false);
            }
            else if (returnInfo.HandleStatus != ReturnStatus.Deliverying)
            {
                this.ShowMsg("当前状态不允许进行收货!", false);
            }
            else if (this.UserStoreId != returnInfo.StoreId && returnInfo.StoreId >= 0)
            {
                this.ShowMsg("收货处理只能由发货的店铺或者平台进行处理!", false);
            }
            else
            {
                GroupBuyInfo groupbuy = null;
                if (orderInfo.GroupBuyId > 0)
                {
                    groupbuy = ProductBrowser.GetGroupBuy(orderInfo.GroupBuyId);
                }
                decimal canRefundAmount = orderInfo.GetCanRefundAmount(returnInfo.SkuId, groupbuy, 0);
                if (num2 < decimal.Zero)
                {
                    this.ShowMsg("退款金额必须大于等于0", false);
                }
                else if (num2 > canRefundAmount)
                {
                    this.ShowMsg("退款金额不能大于退货订单或者商品的金额!", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = returnInfo.AdminRemark;
                    }
                    if (TradeHelper.FinishGetGoodsForReturn(num, text, returnInfo.OrderId, returnInfo.SkuId, num2))
                    {
                        MemberInfo user = Users.GetUser(orderInfo.UserId);
                        returnInfo.HandleStatus = ReturnStatus.GetGoods;
                        Messenger.AfterSaleDeal(user, orderInfo, returnInfo, null);
                        this.ShowMsg("收货成功,由平台进行退款处理!", true, HttpContext.Current.Request.Url.ToString());
                    }
                    else
                    {
                        this.ShowMsg("收货失败!", false);
                    }
                }
            }
        }