示例#1
0
 /// <summary>
 /// 添加申诉
 /// </summary>
 /// <param name="orderEntity"></param>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public bool AddRefund(RefundOrderEntity orderEntity, RefundProductEntity productEntity)
 {
     try
     {
         using (TransactionScope tran = new TransactionScope())
         {
             if (dal.AddRefund(orderEntity))
             {
                 if (dal.AddRefundProduct(productEntity, orderEntity.OrderCode))
                 {
                     if (dal.UpdateRefundQuantity(orderEntity.OrderCode, productEntity.Spu, productEntity.Sku))
                     {
                         tran.Complete();
                         return(true);
                     }
                 }
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
     return(false);
 }
示例#2
0
        /// <summary>
        /// 新增退款单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddRefund(RefundOrderEntity model)
        {
            string sql        = @"Insert Into RefundOrderInfo(RefundCode,RefundType,OrderCode,UserId,RefundReason,RefundDescription,RefundStatus,TotalAmount,RMBTotalAmount,CreateTime,CreateBy,ImagePath,ExchangeRate,SupplierId,RegionCode,ProductStatus,Commission) Values
                            (@RefundCode,@RefundType,@OrderCode,@UserId,@RefundReason,@RefundDescription,@RefundStatus,@TotalAmount,@RMBTotalAmount,@CreateTime,@CreateBy,@ImagePath,@ExchangeRate,@SupplierId,@RegionCode,@ProductStatus,@Commission);";
            var    parameters = DbSFO2OMain.CreateParameterCollection();

            parameters.Append("@RefundCode", model.RefundCode);
            parameters.Append("@RefundType", model.RefundType);
            parameters.Append("@OrderCode", model.OrderCode);
            parameters.Append("@UserId", model.UserId);
            parameters.Append("@RefundReason", model.RefundReason);
            parameters.Append("@RefundDescription", model.RefundDescription);
            parameters.Append("@RefundStatus", model.RefundStatus);
            parameters.Append("@TotalAmount", model.TotalAmount);
            parameters.Append("@RMBTotalAmount", model.RMBTotalAmount);
            parameters.Append("@CreateTime", model.CreateTime);
            parameters.Append("@CreateBy", model.CreateBy);
            parameters.Append("@ImagePath", model.ImagePath);
            parameters.Append("@ExchangeRate", model.ExchangeRate);
            parameters.Append("@SupplierId", model.SupplierId);
            parameters.Append("@RegionCode", model.RegionCode);
            parameters.Append("@ProductStatus", model.ProductStatus);
            parameters.Append("@Commission", model.Commision);
            return(DbSFO2OMain.ExecuteNonQuery(CommandType.Text, sql, parameters) > 0);
        }
示例#3
0
 /// <summary>
 /// 修改申诉
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool EditRefund(RefundOrderEntity model)
 {
     try
     {
         return(dal.EditRefund(model));
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
     return(false);
 }
示例#4
0
        /// <summary>
        /// 修改申诉
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool EditRefund(RefundOrderEntity model)
        {
            string sql        = @"Update  RefundOrderInfo 
                           Set RefundReason=@RefundReason,RefundType=@RefundType,RefundDescription=@RefundDescription,RefundStatus=@RefundStatus,ImagePath=@ImagePath,ProductStatus=@ProductStatus 
                            Where RefundCode=@RefundCode;";
            var    parameters = DbSFO2OMain.CreateParameterCollection();

            parameters.Append("@RefundCode", model.RefundCode);
            parameters.Append("@RefundType", model.RefundType);
            parameters.Append("@RefundReason", model.RefundReason);
            parameters.Append("@RefundDescription", model.RefundDescription);
            parameters.Append("@RefundStatus", model.RefundStatus);
            parameters.Append("@ImagePath", model.ImagePath);
            parameters.Append("@ProductStatus", model.ProductStatus);
            return(DbSFO2OMain.ExecuteNonQuery(CommandType.Text, sql, parameters) > 0);
        }
示例#5
0
        public ActionResult EditComplain(string refundCode)
        {
            RefundOrderEntity entity = refundBll.GetRefundOrderInfo(refundCode);

            if (string.IsNullOrEmpty(entity.RefundCode))
            {
                return(Redirect("/home/error"));
            }
            List <RefundProductEntity> product = refundBll.GetRefundProducts(refundCode, base.language);

            if (product.Any())
            {
                ViewBag.Sku = product.First().Sku;
            }
            ViewBag.isUsedGiftCard = 0;
            if (product.First().Coupon > 0)
            {
                ViewBag.isUsedGiftCard = 1;
            }
            return(View(entity));
        }
示例#6
0
 public void SubmitForm(RefundOrderEntity payOrderEntity, MeterChargingEntity meterChargingEntity)
 {
     payOrderEntity.Create();
     _service.SubmitForm(payOrderEntity, meterChargingEntity);
 }
示例#7
0
        public JsonResult SubmitComplain(string model, string sku)
        {
            try
            {
                #region 参数验证
                if (string.IsNullOrEmpty(model))
                {
                    return(Json(new { Type = 0, Content = "缺少必要参数" }, JsonRequestBehavior.DenyGet));
                }
                RefundOrderEntity entity = JsonHelper.ToObject <RefundOrderEntity>(model);
                if (entity == null)
                {
                    return(Json(new { Type = 0, Content = "缺少必要参数" }, JsonRequestBehavior.DenyGet));
                }
                var orderInfo = myOrderBll.GetMyOrderInfo(LoginUser.UserID, base.DeliveryRegion, base.language, entity.OrderCode);
                if (orderInfo == null)
                {
                    return(Json(new { Type = 0, Content = "该订单不存在" }));
                }
                if (orderInfo.SkuInfos == null)
                {
                    return(Json(new { Type = 0, Content = "该订单商品不存在" }));
                }
                if (orderInfo.OrderStatus != 3)
                {
                    return(Json(new { Type = 0, Content = "该订单申诉时间已过,不能进行申诉" }));
                }

                var skuInfo = orderInfo.SkuInfos.FirstOrDefault(s => s.Sku == sku);
                if (skuInfo == null)
                {
                    return(Json(new { Type = 0, Content = "该商品不存在" }));
                }
                if (entity.RefundType < 0)
                {
                    return(Json(new { type = 0, content = "请选择退款类型" }));
                }
                if (entity.RefundReason <= 0)
                {
                    return(Json(new { Type = 0, Content = "请选择退款原因" }));
                }
                if (string.IsNullOrEmpty(entity.RefundDescription))
                {
                    return(Json(new { Type = 0, Content = "请输入详细理由" }));
                }
                else if (entity.RefundDescription.Length > 1000)
                {
                    return(Json(new { Type = 0, Content = "详细理由最多1000字" }));
                }
                if (string.IsNullOrEmpty(entity.ImagePath))
                {
                    return(Json(new { Type = 0, Content = "请至少上传2张问题图片" }));
                }
                else
                {
                    var images = entity.ImagePath.Split(',').ToArray();
                    if (images != null && images.Length > 10)
                    {
                        return(Json(new { Type = 0, Content = "问题图片最多上传10张" }));
                    }
                }
                #endregion
                if (string.IsNullOrEmpty(entity.RefundCode) || entity.RefundCode == "0")//申诉
                {
                    if (!refundBll.IsCanRefund(orderInfo.OrderCode, skuInfo.Sku))
                    {
                        return(Json(new { Type = 1, Content = "该商品已全部申诉,不能再进行申诉", LinkUrl = "/Refund/Refund" }));
                    }
                    entity.UserId         = LoginUser.UserID;
                    entity.CreateBy       = LoginUser.UserName;
                    entity.CreateTime     = DateTime.Now;
                    entity.TotalAmount    = 0;
                    entity.RMBTotalAmount = 0;
                    entity.RefundStatus   = (int)RefundStatus.WaitAudit;
                    entity.RefundCode     = BuildRefundCode(orderInfo.OrderCode);
                    entity.OrderCode      = orderInfo.OrderCode;
                    entity.ExchangeRate   = orderInfo.ExchangeRate;
                    entity.SupplierId     = skuInfo.SupplierId;
                    entity.RegionCode     = base.DeliveryRegion;
                    entity.Commision      = skuInfo.Commission;

                    RefundProductEntity productEntity = new RefundProductEntity();
                    productEntity.RefundCode   = entity.RefundCode;
                    productEntity.Quantity     = 1;
                    productEntity.UnitPrice    = skuInfo.UnitPrice;
                    productEntity.RMBUnitPrice = skuInfo.PayUnitPrice;
                    productEntity.Sku          = skuInfo.Sku;
                    productEntity.Spu          = skuInfo.Spu;
                    productEntity.TaxRate      = skuInfo.TaxRate;
                    productEntity.IsBearDuty   = skuInfo.IsBearDuty;
                    //查询OrderProducts表里的HuoLi
                    ProductBll       productBll  = new ProductBll();
                    ProductInfoModel productInfo = productBll.getProductInfo(orderInfo.OrderCode, skuInfo.Sku);

                    //查询refundProducts的记录
                    List <RefundProductEntity> list = refundBll.getOrderProductCount(orderInfo.OrderCode, skuInfo.Sku);
                    if (productInfo.HuoLi > 0 || productInfo.Coupon > 0)
                    {
                        //退回的酒豆
                        if (productInfo.Qty - list.Count() > 1)
                        {
                            productEntity.HuoLi  = (int)(productInfo.HuoLi / productInfo.Qty);
                            productEntity.Coupon = Math.Round(productInfo.Coupon / productInfo.Qty, 2, MidpointRounding.AwayFromZero);
                        }
                        else if (productInfo.Qty - list.Count() <= 1)
                        {
                            productEntity.HuoLi  = (int)(productInfo.HuoLi - (int)(productInfo.HuoLi / productInfo.Qty) * (productInfo.Qty - 1));
                            productEntity.Coupon = Math.Round(productInfo.Coupon - Math.Round(Math.Round((productInfo.Coupon / productInfo.Qty), 2, MidpointRounding.AwayFromZero) * (productInfo.Qty - 1), 2, MidpointRounding.AwayFromZero), 2, MidpointRounding.AwayFromZero);
                        }
                        else
                        {
                            productEntity.HuoLi  = 0;
                            productEntity.Coupon = 0;
                        }
                    }
                    if (refundBll.AddRefund(entity, productEntity))
                    {
                        ProductInfoModel productInfoModel = orderManager.GetOrderImage(orderInfo.OrderCode);

                        InformationEntity InformationEntity = new InformationEntity();
                        InformationEntity.InfoType     = 1;
                        InformationEntity.WebInnerType = 3;
                        InformationEntity.SendDest     = CommonBll.GetUserRegion(base.LoginUser.UserID);
                        InformationEntity.SendUserId   = base.LoginUser.UserID;
                        InformationEntity.TradeCode    = entity.RefundCode;
                        InformationEntity.Title        = InformationUtils.RefundSubmitSuccTitle;
                        InformationEntity.InfoContent  = InformationUtils.RefundSubmitSuccContent;

                        if (productInfoModel != null)
                        {
                            InformationEntity.ImagePath = productInfoModel.ImagePath;
                        }
                        else
                        {
                            InformationEntity.ImagePath = null;
                        }

                        InformationEntity.Summary    = null;
                        InformationEntity.LinkUrl    = "refund/refundInfo?code=" + entity.RefundCode;
                        InformationEntity.StartTime  = null;
                        InformationEntity.EndTime    = null;
                        InformationEntity.LongTerm   = 0;
                        InformationEntity.CreateTime = DateTime.Now;

                        InformationBll.AddInformation(InformationEntity);

                        return(Json(new { Type = 1, Content = "申诉已提交,请耐心等待", LinkUrl = "/Refund/Refund" }));
                    }
                    else
                    {
                        return(Json(new { Type = 0, Content = "申诉失败" }));
                    }
                }
                else
                {
                    //修改申诉
                    RefundOrderEntity oldEntity = refundBll.GetRefundOrderInfo(entity.RefundCode);
                    if (string.IsNullOrEmpty(oldEntity.RefundCode))
                    {
                        return(Json(new { Type = 0, Content = "退款单号不正确" }));
                    }
                    else
                    {
                        if (oldEntity.RefundStatus != (int)RefundStatus.WaitAudit)
                        {
                            return(Json(new { Type = 0, Content = "该退款单已审核通过,不能提交修改" }));
                        }
                    }
                    entity.RefundStatus = (int)RefundStatus.WaitAudit;
                    if (refundBll.EditRefund(entity))
                    {
                        return(Json(new { Type = 1, Content = "修改申诉成功", LinkUrl = "/Refund/Refund" }));
                    }
                    else
                    {
                        return(Json(new { Type = 0, Content = "修改申诉失败" }));
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                return(Json(new { Type = 0, Content = "系统错误,请稍后再试" }));
            }
        }