Browse Source

Complete coupon entities design.

pull/103/head
gdlcf88 6 years ago
parent
commit
9b9e5e8d08
  1. 24
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponType.cs
  2. 1
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp.EShop.Plugins.Coupons.Domain.csproj
  3. 48
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplate.cs
  4. 9
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateProduct.cs
  5. 21
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateScope.cs
  6. 14
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/Coupon.cs
  7. 6
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsDomainModule.cs

24
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponType.cs

@ -0,0 +1,24 @@
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public enum CouponType
{
/// <summary>
/// Discount once if the condition is met.
/// e.g. arrange ConditionAmount = 300 and DiscountAmount = 20.
/// If the price of a product is 300, the actual order price will be discounted by 20.
/// </summary>
Normal = 1,
/// <summary>
/// Discount every time the condition is met.
/// e.g. arrange ConditionAmount = 300 and DiscountAmount = 20.
/// If the price of a product is 300, the actual order price will be discounted by 60.
/// </summary>
PerMeet = 2,
/// <summary>
/// A type of coupon with custom usage rules.
/// </summary>
Custom = 4
}
}

1
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp.EShop.Plugins.Coupons.Domain.csproj

@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.1.2" />
<ProjectReference Include="..\..\..\..\modules\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Domain.Shared\EasyAbp.EShop.Stores.Domain.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Plugins.Coupons.Domain.Shared\EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj" />
</ItemGroup>

48
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplate.cs

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
@ -7,5 +9,51 @@ namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
public class CouponTemplate : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
/// <summary>
/// If it is set to null, only cross-store admin users can manage this template.
/// It is not about the coupon usage scope, but the StoreId property of Scopes should be same as it if it not null.
/// </summary>
public virtual Guid? StoreId { get; protected set; }
public virtual CouponType CouponType { get; protected set; }
[CanBeNull]
public virtual string UniqueName { get; protected set; }
[NotNull]
public virtual string DisplayName { get; protected set; }
[CanBeNull]
public virtual string Description { get; protected set; }
/// <summary>
/// If both the UsableDuration and the UsableEndTime have values, the earlier time is preferred.
/// </summary>
public virtual TimeSpan? UsableDuration { get; protected set; }
public virtual DateTime? UsableBeginTime { get; protected set; }
/// <summary>
/// If both the UsableDuration and the UsableEndTime have values, the earlier time is preferred.
/// </summary>
public virtual DateTime? UsableEndTime { get; protected set; }
public virtual decimal ConditionAmount { get; protected set; }
public virtual decimal DiscountAmount { get; protected set; }
/// <summary>
/// If it is set to true, the coupon can be used when the total price of all the order lines in the order
/// with products in scope is greater than or equal to ConditionAmount.
/// </summary>
public virtual bool IsCrossProductAllowed { get; protected set; }
/// <summary>
/// The coupon can be used for any product of any store if this property is set to true.
/// </summary>
public virtual bool IsUnscoped { get; protected set; }
public virtual List<CouponTemplateScope> Scopes { get; protected set; }
}
}

9
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateProduct.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public class CouponTemplateProduct : FullAuditedEntity<Guid>
{
}
}

21
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/CouponTemplates/CouponTemplateScope.cs

@ -0,0 +1,21 @@
using System;
using EasyAbp.EShop.Stores.Stores;
using Volo.Abp.Domain.Entities.Auditing;
namespace EasyAbp.EShop.Plugins.Coupons.CouponTemplates
{
public class CouponTemplateScope : FullAuditedEntity<Guid>, IMultiStore
{
public virtual Guid StoreId { get; protected set; }
/// <summary>
/// If this property is set to null, the coupon can be used for all products in the store.
/// </summary>
public virtual Guid? ProductId { get; protected set; }
/// <summary>
/// If this property is set to null, the coupon can be used for all SKUs in the product.
/// </summary>
public virtual Guid? ProductSkuId { get; protected set; }
}
}

14
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/Coupon.cs

@ -7,5 +7,19 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons
public class Coupon : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid CouponTemplateId { get; protected set; }
public virtual Guid UserId { get; protected set; }
public virtual Guid? OrderId { get; protected set; }
public virtual DateTime? UsableBeginTime { get; protected set; }
public virtual DateTime? UsableEndTime { get; protected set; }
public virtual DateTime? UsedTime { get; protected set; }
public virtual decimal? DiscountedAmount { get; protected set; }
}
}

6
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/EShopPluginsCouponsDomainModule.cs

@ -1,11 +1,13 @@
using Volo.Abp.Domain;
using EasyAbp.EShop.Stores;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
namespace EasyAbp.EShop.Plugins.Coupons
{
[DependsOn(
typeof(AbpDddDomainModule),
typeof(EShopPluginsCouponsDomainSharedModule)
typeof(EShopPluginsCouponsDomainSharedModule),
typeof(EShopStoresDomainSharedModule)
)]
public class EShopPluginsCouponsDomainModule : AbpModule
{

Loading…
Cancel
Save