Commit 47811785 authored by 黄奎's avatar 黄奎

页面修改

parent b3fdd3b8
......@@ -4942,10 +4942,10 @@ namespace Mall.Module.Product
}
#endregion
#region 课程卡初始化
List<RB_Education_MemberCoupon_Extend> eList = new List<RB_Education_MemberCoupon_Extend>();
List<RB_Education_Coupon_Extend> deList = new List<RB_Education_Coupon_Extend>();
List<RB_Education_CouponProduct_Extend> edcpList = new List<RB_Education_CouponProduct_Extend>();
#region 套餐卡初始化
List<RB_Reserve_MemberCoupon_Extend> eList = new List<RB_Reserve_MemberCoupon_Extend>();
List<RB_Reserve_Coupon_Extend> deList = new List<RB_Reserve_Coupon_Extend>();
List<RB_Reserve_CouponProduct_Extend> edcpList = new List<RB_Reserve_CouponProduct_Extend>();
if (demodel.Use_Education_Id > 0)
{
if (demodel.User_Coupon_Id > 0)
......@@ -4958,7 +4958,10 @@ namespace Mall.Module.Product
message = "套餐卡与积分抵扣不能同时使用";
return false;
}
eList = education_MemberCouponRepository.GetList(new RB_Education_MemberCoupon_Extend() { Ids = (demodel.Use_Education_Id ?? 0).ToString(), UserId = umodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
eList = reserve_MemberCouponRepository.GetList(new RB_Reserve_MemberCoupon_Extend() {
Ids = (demodel.Use_Education_Id ?? 0).ToString(), UserId = umodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId,
}
);
if (eList.Any())
{
var educationModel = eList.FirstOrDefault();
......@@ -4968,17 +4971,48 @@ namespace Mall.Module.Product
return false;
}
string cIds = string.Join(",", eList.Select(x => x.CouponId).Distinct());
deList = education_CouponRepository.GetDiscountCouponList(new RB_Education_Coupon_Extend() { CouponIds = cIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, true);
edcpList = education_CouponProductRepository.GetListByDiscountCouponIds(new Model.Entity.Education.RB_Education_Coupon() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
deList = reserve_CouponRepository.GetDiscountCouponList(new RB_Reserve_Coupon_Extend()
{
CouponIds = cIds,
TenantId = demodel.TenantId,
MallBaseId = demodel.MallBaseId,
StoreId = demodel.StoresId,
}, true);
edcpList = reserve_CouponProductRepository.GetListByDiscountCouponIds(new RB_Reserve_Coupon_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, cIds, true);
if (deList.Any())
{
foreach (var item in deList)
{
if (!string.IsNullOrWhiteSpace(item.StoreIds))
{
if (item.StoreIds != "0")
{
bool isGrantCoupon = false;
foreach (var itemStoreId in item.StoreIds.Split(","))
{
if (Convert.ToInt32(itemStoreId) > 0)
{
if (Convert.ToInt32(itemStoreId) == demodel.StoresId)
{
isGrantCoupon = true;
}
}
}
if (!isGrantCoupon)
{
message = "领取套餐卡不属于当前门店";
return false;
}
}
}
}
foreach (var item in eList)
{
if (item.CouponId > 0)
{
if (!deList.Where(x => x.ID == item.CouponId).Any())
{
message = "课程卡不存在,请核实后再试";
message = "套餐卡不存在,请核实后再试";
return false;
}
}
......@@ -5303,7 +5337,7 @@ namespace Mall.Module.Product
}
#endregion
#region 课程
#region 套餐
if (demodel.Use_Education_Id > 0)
{
var ccmodel = eList.Where(x => x.Id == demodel.Use_Education_Id).FirstOrDefault();
......@@ -5495,7 +5529,7 @@ namespace Mall.Module.Product
message = "套餐卡抵扣金额不正确";
return false;
}
if (CouponsMoney != demodel.CouponMoney)
if (CouponsMoney != (demodel?.CouponMoney??0))
{
message = "优惠金额计算有误";
return false;
......
......@@ -24,6 +24,7 @@ using Mall.Repository.Finance;
using Mall.Repository.GuideCar;
using Mall.Repository.MarketingCenter;
using Mall.Repository.Product;
using Mall.Repository.Reserve;
using Mall.Repository.User;
using Mall.ThirdCore.Message;
using Microsoft.Extensions.Configuration;
......@@ -57,6 +58,24 @@ namespace Mall.Module.Product
/// </summary>
private RB_Education_MemberUseCouponRepository education_MemberUseCouponRepository = new RB_Education_MemberUseCouponRepository();
/// <summary>
/// 套餐卡
/// </summary>
private RB_Reserve_MemberCouponRepository reserve_MemberCouponRepository = new RB_Reserve_MemberCouponRepository();
/// <summary>
/// 套餐卡实体
/// </summary>
private RB_Reserve_CouponRepository reserve_CouponRepository = new RB_Reserve_CouponRepository();
/// <summary>
/// 套餐卡适配
/// </summary>
private RB_Reserve_CouponProductRepository reserve_CouponProductRepository = new RB_Reserve_CouponProductRepository();
/// <summary>
/// 套餐卡使用
/// </summary>
private RB_Reserve_MemberUseCouponRepository reserve_MemberUseCouponRepository = new RB_Reserve_MemberUseCouponRepository();
/// <summary>
......
......@@ -91,6 +91,14 @@ namespace Mall.Repository.Reserve
{
builder.Append($" AND {nameof(RB_Reserve_Coupon_Extend.ID)} in({query.CouponIds})");
}
if (query.StoreId > 0)
{
builder.Append($" AND ( FIND_IN_SET('{query.StoreId}', {nameof(RB_Reserve_Coupon_Extend.StoreIds)}) or FIND_IN_SET('0', {nameof(RB_Reserve_Coupon_Extend.StoreIds)} )) ");
}
else
{
builder.Append($" AND FIND_IN_SET('0', {nameof(RB_Reserve_Coupon_Extend.StoreIds)})");
}
}
return Get<RB_Reserve_Coupon_Extend>(builder.ToString()).ToList();
}
......
......@@ -710,7 +710,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
demodel.DeliveryMethod = Common.Enum.Goods.OrderDeliveryMethodEnum.VerificationShop;
if ((demodel.Income ?? 0) <= 0)
if ((demodel.Income ?? 0) < 0)
{
return ApiResult.ParamIsNull("订单金额不正确");
}
......
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