Пример #1
0
        private void btnGetAndSendGoods_Click(object sender, EventArgs e)
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("错误的换货信息", false);
            }
            else
            {
                string arg = "自己门店";
                if (this.UserStoreId == 0)
                {
                    arg = "平台";
                }
                if (replaceInfo.StoreId != this.UserStoreId)
                {
                    this.ShowMsg(string.Format("只能由发货的店铺或者平台处理", arg), false);
                }
                else
                {
                    string             text  = "";
                    string             text2 = "";
                    ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressDropDownList.SelectedValue);
                    if (expressCompanyInfo != null)
                    {
                        text  = expressCompanyInfo.Kuaidi100Code;
                        text2 = expressCompanyInfo.Name;
                        string text3 = this.txtShipOrderNumber.Text;
                        if (string.IsNullOrEmpty(text3) || text3.Length > 20)
                        {
                            this.ShowMsg("请输入运单编号,长度在1-20位之间", false);
                        }
                        else if (TradeHelper.ReplaceShopSendGoods(replaceId, text, text2, text3, replaceInfo.OrderId, replaceInfo.SkuId))
                        {
                            if (text.ToUpper() == "HTKY")
                            {
                                ExpressHelper.GetDataByKuaidi100(text, text3);
                            }
                            OrderInfo  orderInfo = OrderHelper.GetOrderInfo(replaceInfo.OrderId);
                            MemberInfo user      = Users.GetUser(orderInfo.UserId);
                            replaceInfo.HandleStatus = ReplaceStatus.MerchantsDelivery;
                            Messenger.AfterSaleDeal(user, orderInfo, null, replaceInfo);
                            this.ShowMsg("换货发货成功!", true, HttpContext.Current.Request.Url.ToString());
                        }
                        else
                        {
                            this.ShowMsg("换货发货失败,原因未知", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("请选择快递公司", false);
                    }
                }
            }
        }
Пример #2
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);
                    }
                }
            }
        }