feat: Add tiered packaging fee support for stores
Introduces tiered packaging fee configuration for stores by adding OrderPackagingFeeMode and PackagingFeeTiers fields to StoreFee. Updates DTOs, validators, handlers, and mapping logic to support both fixed and tiered packaging fee modes. Adds StoreFeeTierHelper for tier normalization and serialization, and includes a database migration to persist the new fields.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using TakeoutSaaS.Infrastructure.App.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[DbContext(typeof(TakeoutAppDbContext))]
|
||||
[Migration("20260201090000_AddStoreFeeTieredPackaging")]
|
||||
public partial class AddStoreFeeTieredPackaging : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OrderPackagingFeeMode",
|
||||
table: "store_fees",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
comment: "订单打包费规则(按订单收费时生效)。");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PackagingFeeTiersJson",
|
||||
table: "store_fees",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
comment: "阶梯打包费配置(JSON)。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrderPackagingFeeMode",
|
||||
table: "store_fees");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PackagingFeeTiersJson",
|
||||
table: "store_fees");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5434,6 +5434,14 @@ namespace TakeoutSaaS.Infrastructure.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasComment("打包费模式。");
|
||||
|
||||
b.Property<int>("OrderPackagingFeeMode")
|
||||
.HasColumnType("integer")
|
||||
.HasComment("订单打包费规则(按订单收费时生效)。");
|
||||
|
||||
b.Property<string>("PackagingFeeTiersJson")
|
||||
.HasColumnType("text")
|
||||
.HasComment("阶梯打包费配置(JSON)。");
|
||||
|
||||
b.Property<long>("StoreId")
|
||||
.HasColumnType("bigint")
|
||||
.HasComment("门店标识。");
|
||||
|
||||
Reference in New Issue
Block a user