Commit 53558656 authored by liudong1993's avatar liudong1993

售后时间

parent 904eb13d
......@@ -89,6 +89,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int? IsOrderCommission { get; set; }
/// <summary>
/// 是否可以申请售后 1是 2否
/// </summary>
public int? IsCanApplyForAfterSale { get; set; }
/// <summary>
/// 导出选项
/// </summary>
public List<int> ExcelEnumIds { get; set; }
......
......@@ -566,6 +566,23 @@ namespace Mall.Module.Product
// }
//}
//是否可以申请售后
var mallModel = mallBaseRepository.GetEntity(mallBaseId);
model.IsCanApplyForAfterSale = 2;
if (model.OrderStatus == OrderStatusEnum.WaitReceiving)
{
model.IsCanApplyForAfterSale = 1;
}
else if (model.OrderStatus == OrderStatusEnum.Received || model.OrderStatus == OrderStatusEnum.Completed)
{
if (mallModel != null && mallModel.AfterTime > 0 && model.ReceivingTime.HasValue)
{
if (model.ReceivingTime.Value.AddDays(mallModel.AfterTime) > DateTime.Now)
{
model.IsCanApplyForAfterSale = 1;
}
}
}
//获取订阅消息
var miniModel = miniProgramRepository.GetListRepository(new RB_MiniProgram_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId }).FirstOrDefault();
......@@ -618,7 +635,8 @@ namespace Mall.Module.Product
x.IsApplyForAfterSale
}),
model.IsApplyForCancel,
model.RejectRemark
model.RejectRemark,
model.IsCanApplyForAfterSale
});
}
......@@ -4739,6 +4757,19 @@ namespace Mall.Module.Product
return goods_OrderDetailRepository.GetEntity(OrderId).RefMapperTo<RB_Goods_OrderDetail_Extend>();
}
/// <summary>
/// 获取订单是否已返佣
/// </summary>
/// <param name="OrderDetailId"></param>
/// <returns></returns>
public bool GetOrderCommissionIsSend(int OrderDetailId) {
var list = goods_OrderCommissionRepository.GetOrderHaveCommissionList(OrderDetailId.ToString());
if (list.Any()) {
return true;
}
return false;
}
/// <summary>
/// 获取用户信息
/// </summary>
......
......@@ -271,6 +271,17 @@ left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and o
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
/// <summary>
/// 获取已标记提现的佣金列表
/// </summary>
/// <param name="OrderDetailIds"></param>
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetOrderHaveCommissionList(string OrderDetailIds)
{
string sql = $@"SELECT * FROM rb_goods_ordercommission oc WHERE oc.CommissionState=2 and oc.OrderDetailId in ({OrderDetailIds})";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
/// <summary>
/// 获取所有订单已完成 未结算佣金的订单
......
......@@ -629,21 +629,44 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("数量不正确");
}
var detailModel = orderModule.GetOrderDetailInfo(demodel.OrderDetialId ?? 0);
var omodel = orderModule.GetOrderInfo(detailModel?.OrderId ?? 0);
if (omodel == null) {
return ApiResult.ParamIsNull("订单不存在");
}
if (omodel.OrderStatus != Common.Enum.Goods.OrderStatusEnum.WaitReceiving && omodel.OrderStatus != Common.Enum.Goods.OrderStatusEnum.Received && omodel.OrderStatus != Common.Enum.Goods.OrderStatusEnum.Completed) {
return ApiResult.ParamIsNull("订单状态不正确");
}
//查询售后时间
//var mallbaseModel = orderModule.GetMallBaseInfo(userInfo.TenantId, userInfo.MallBaseId);
//if (mallbaseModel == null) {
// return ApiResult.ParamIsNull("请联系管理员,未查询到配置信息");
//}
//if (mallbaseModel.AfterTime > 0) {
// //获取订单发货时间
// var detailModel = orderModule.GetOrderDetailInfo(demodel.OrderDetialId ?? 0);
// var omodel = orderModule.GetOrderInfo(detailModel?.OrderId ?? 0);
// if (omodel != null && omodel.OrderStatus > Common.Enum.Goods.OrderStatusEnum.WaitReceiving && omodel.ReceivingTime.HasValue) {
// if (omodel.ReceivingTime.Value.AddDays(mallbaseModel.AfterTime) > DateTime.Now) {
// return ApiResult.ParamIsNull("已超过售后期限(" + mallbaseModel.AfterTime + "天),无法申请售后");
// }
// }
//}
var mallbaseModel = orderModule.GetMallBaseInfo(userInfo.TenantId, userInfo.MallBaseId);
if (mallbaseModel != null)
{
if (mallbaseModel.AfterTime > 0)
{
//获取订单发货时间
if (omodel != null && omodel.OrderStatus > Common.Enum.Goods.OrderStatusEnum.WaitReceiving && omodel.ReceivingTime.HasValue)
{
if (omodel.ReceivingTime.Value.AddDays(mallbaseModel.AfterTime) < DateTime.Now)
{
return ApiResult.ParamIsNull("已超过售后期限(" + mallbaseModel.AfterTime + "天),无法申请售后");
}
else
{
//验证 佣金是否已发放
if (orderModule.GetOrderCommissionIsSend(demodel.OrderDetialId ?? 0))
{
return ApiResult.ParamIsNull("该订单已返佣,无法申请售后");
}
}
}
}
else {
if (omodel.OrderStatus != Common.Enum.Goods.OrderStatusEnum.WaitReceiving) {
return ApiResult.ParamIsNull("订单状态不正确");
}
}
}
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment