示例#1
0
        /// <summary>
        /// 添加普通订单消息信息
        /// </summary>
        /// <param name="OrderCode"></param>
        /// <param name="entity"></param>
        public void AddNoemalOrderInformationInfo(string OrderCode, OrderPaymentEntity entity)
        {
            //LogHelper.Error("--------获取订单图片After开始----1-----" + OrderCode);
            ProductInfoModel productInfoModel = orderManager.GetOrderImage(OrderCode);
            //LogHelper.Error("--------获取订单图片After结束----1-----" + productInfoModel);

            //LogHelper.Error("--------消息对象设置参数After开始----1-----" + entity.UserId);

            InformationEntity InformationEntity = new InformationEntity();

            InformationEntity.InfoType     = 1;
            InformationEntity.WebInnerType = 3;
            InformationEntity.SendDest     = CommonBll.GetUserRegion(entity.UserId);
            InformationEntity.SendUserId   = entity.UserId;
            InformationEntity.TradeCode    = OrderCode;
            InformationEntity.Title        = InformationUtils.UserPaySuccTitle;
            InformationEntity.InfoContent  = InformationUtils.UserPaySuccContent_Prefix
                                             + OrderCode + InformationUtils.UserPaySuccContent_suffix;

            if (productInfoModel != null)
            {
                //LogHelper.Error("--------消息对象设置参数After开始----2-----" + productInfoModel.ImagePath);
                InformationEntity.ImagePath = productInfoModel.ImagePath;
            }
            else
            {
                InformationEntity.ImagePath = null;
            }

            InformationEntity.Summary    = null;
            InformationEntity.LinkUrl    = "my/detail?orderCode=" + OrderCode;
            InformationEntity.StartTime  = null;
            InformationEntity.EndTime    = null;
            InformationEntity.LongTerm   = 0;
            InformationEntity.CreateTime = DateTime.Now;

            //LogHelper.Error("--------插入消息表开始----1-----");
            InformationBll.AddInformation(InformationEntity);
        }
示例#2
0
        /// <summary>
        /// 添加团订单消息信息
        /// </summary>
        /// <param name="teamDetailList"></param>
        public void AddTeamOrderInformationInfo(IList <TeamDetailEntity> teamDetailList)
        {
            //LogHelper.Info("--------TeamPayAfter 消息插入循环进入前----");
            foreach (TeamDetailEntity teamDetail in teamDetailList)
            {
                //LogHelper.Info("--------TeamPayAfter 消息插入循环----" + teamDetail.OrderCode);
                ProductInfoModel productInfoModel = orderManager.GetOrderImage(teamDetail.OrderCode);
                //LogHelper.Info("--------TeamPayAfter 获取商品图片结束----productInfoModel=" + productInfoModel);

                InformationEntity InformationEntityTeam = new InformationEntity();
                InformationEntityTeam.InfoType     = 1;
                InformationEntityTeam.WebInnerType = 3;
                InformationEntityTeam.SendDest     = CommonBll.GetUserRegion(teamDetail.UserId);
                InformationEntityTeam.SendUserId   = teamDetail.UserId;
                InformationEntityTeam.TradeCode    = teamDetail.TeamCode;
                InformationEntityTeam.Title        = InformationUtils.TeamJoinSuccTitle;
                InformationEntityTeam.InfoContent  = InformationUtils.TeamJoinSuccContent;

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

                InformationEntityTeam.Summary    = null;
                InformationEntityTeam.LinkUrl    = "team/teamDetail?TeamCode=" + teamDetail.TeamCode + "&Flag=1";
                InformationEntityTeam.StartTime  = null;
                InformationEntityTeam.EndTime    = null;
                InformationEntityTeam.LongTerm   = 0;
                InformationEntityTeam.CreateTime = DateTime.Now;

                //LogHelper.Info("--------TeamPayAfter 消息插入开始----");
                InformationBll.AddInformation(InformationEntityTeam);
            }
        }
示例#3
0
        public ActionResult ConfirmOrder(string orderCode)
        {
            try
            {
                if (string.IsNullOrEmpty(orderCode))
                {
                    return(this.HandleError("订单编号不能为空!"));
                }

                var model = Bll.ConfirmOrder(base.LoginUser.UserID, base.DeliveryRegion, base.language, orderCode);
                if (model)
                {
                    LogHelper.Info("--------ConfirmOrder----获取订单的商品图片开始---orderCode:" + orderCode);

                    /// 获取订单的商品图片
                    ProductInfoModel productInfoModel = orderManager.GetOrderImage(orderCode);
                    LogHelper.Info("--------ConfirmOrder----获取订单的商品图片结束---orderCode:" + orderCode);

                    LogHelper.Info("--------ConfirmOrder----设置对象参数开始");
                    InformationEntity InformationEntity = new InformationEntity();
                    InformationEntity.InfoType     = 1;
                    InformationEntity.WebInnerType = 3;
                    InformationEntity.SendDest     = CommonBll.GetUserRegion(base.LoginUser.UserID);
                    InformationEntity.SendUserId   = base.LoginUser.UserID;
                    InformationEntity.TradeCode    = orderCode;
                    InformationEntity.Title        = InformationUtils.OrderTradeSuccTitle;
                    InformationEntity.InfoContent  = InformationUtils.OrderTradeSuccContent_Prefix
                                                     + orderCode + InformationUtils.OrderTradeSuccContent_suffix;

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

                    InformationEntity.Summary    = null;
                    InformationEntity.LinkUrl    = "my/detail?orderCode=" + orderCode;
                    InformationEntity.StartTime  = null;
                    InformationEntity.EndTime    = null;
                    InformationEntity.LongTerm   = 0;
                    InformationEntity.CreateTime = DateTime.Now;
                    LogHelper.Info("--------ConfirmOrder----设置对象参数结束");

                    LogHelper.Info("--------ConfirmOrder----执行消息表插入方法开始");
                    InformationBll.AddInformation(InformationEntity);
                    LogHelper.Info("--------ConfirmOrder----执行消息表插入方法结束");

                    return(this.HandleSuccess("ok"));
                }
                else
                {
                    return(this.HandleError("系统异常请稍后再试!"));
                }
            }
            catch (Exception ex)
            {
                return(this.HandleError(ex));
            }
        }
示例#4
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 = "系统错误,请稍后再试" }));
            }
        }