public async Task <IActionResult> GetAfterSaleServicesPageList([FromQuery] GetAfterSaleServiceListRequestDto request) { var afterSaleServiceBiz = new AfterSaleServiceBiz(); request.MerchantGuid = UserID; return(Success(await afterSaleServiceBiz.GetServicePageListAsync(request))); }
public async Task <IActionResult> GetAfterSaleServiceDetail(string serviceGuid) { if (string.IsNullOrEmpty(serviceGuid)) { return(Failed(ErrorCode.Empty, "参数不正确")); } var afterSaleServiceBiz = new AfterSaleServiceBiz(); return(Success(await afterSaleServiceBiz.GetServiceDetail(UserID, serviceGuid))); }
public async Task <IActionResult> GetAfterSaleServiceOrderDetail(string orderNo) { if (string.IsNullOrEmpty(orderNo)) { return(Failed(ErrorCode.Empty, "订单编号不正确")); } var afterSaleServiceBiz = new AfterSaleServiceBiz(); var detail = await afterSaleServiceBiz.GetAfterSaleServiceOrderDetail(orderNo); return(Success(detail)); }
public async Task <IActionResult> ProcessAfterSaleService([FromBody] ProcessAfterSaleServiceRequestDto request) { if (!request.Check()) { return(Failed(ErrorCode.Empty, "拒绝原因未填写,请检查")); } var context = new ProcessAfterSaleServiceContext(request); var afterSaleServiceBiz = new AfterSaleServiceBiz(); var service = await afterSaleServiceBiz.GetAsync(request.ServiceGuid); if (service is null) { return(Failed(ErrorCode.Empty, "服务单不存在,请检查")); } if (!request.IsPass && service.Status.Equals( AfterSaleServiceStatusEnum.Reject.ToString())) { return(Failed(ErrorCode.Empty, "服务单已拒绝一次,请勿重复提交")); } if (service.Status.Equals(AfterSaleServiceStatusEnum.Completed.ToString())) { return(Failed(ErrorCode.Empty, "服务单已完成,请勿重复提交")); } if (request.IsPass) { if (service.Type != AfterSaleServiceTypeEnum.Exchange.ToString()) { if (request.RefundFee <= 0) { return(Failed(ErrorCode.Empty, "退款金额必须大于0,请检查")); } if (service.RefundFee < Convert.ToInt32(request.RefundFee * 100)) { return(Failed(ErrorCode.Empty, "退款金额必须小于或等于总退款金额")); } } } context.AfterSaleService = service; var orderBiz = new OrderBiz(); var order = await orderBiz.GetAsync(service.OrderGuid); if (order is null) { return(Failed(ErrorCode.Empty, "订单不存在,请联系客服处理")); } if (order.OrderCategory == OrderCategoryEnum.Physical.ToString()) { return(Failed(ErrorCode.Empty, "暂不支持实物类退款等操作")); } if (!order.OrderStatus.Equals(OrderStatusEnum.Completed.ToString())) { return(Failed(ErrorCode.Empty, "订单尚未支付成功,不支持退款")); } DateTime?payTime = order.PaymentDate; if (!payTime.HasValue) { return(Failed(ErrorCode.Empty, "订单支付时间为空,请联系客服处理")); } if (payTime.Value.AddDays(REFUND_LIMIT) < DateTime.Now) { return(Failed(ErrorCode.Empty, $"订单超过{REFUND_LIMIT}天可申请售后限制")); } if (order.PayType == PayTypeEnum.OffLinePay.ToString()) { return(Failed(ErrorCode.Empty, "订单为线下支付,请用户前往线下门店退款")); } context.Order = order; context.AfterSaleDetails = await afterSaleServiceBiz.GetAfterSaleDetailModels(request.ServiceGuid); if (context.AfterSaleDetails is null || context.AfterSaleDetails.Count <= 0) { return(Failed(ErrorCode.Empty, "服务订单数据出现异常,请联系客服处理")); } context.SameOrderServiceCompletedCount = await afterSaleServiceBiz.GetAfterSaleOrderServicesCount(service.OrderGuid); await ProcessAfterSaleServiceContext(context); //Enum.TryParse(service.Type, out AfterSaleServiceTypeEnum serviceType); //var saleService = AfterSaleFactory.GetSaleService(serviceType); //await saleService.ProcessAfterSaleServiceContextAsync(context); var result = await afterSaleServiceBiz.ProcessAfterSaleService(context); if (result) { if (request.IsPass) { return((context.AfterSaleRefund.Status == AfterSaleRefundStatusEnum.Success.ToString()) ? Success() : Failed(ErrorCode.DataBaseError, "处理服务单失败")); } return(Success()); } return(Failed(ErrorCode.DataBaseError, "处理服务单失败")); }