feat(edit): 定价试算开发、SKU 样式功能修改
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const commissionImportRequestSchema = z
|
||||
.object({
|
||||
platform_id: z.uuid(),
|
||||
version: z.string().trim().min(1).max(100),
|
||||
source_reference: z.string().trim().min(3).max(500),
|
||||
captured_on: z.iso.date(),
|
||||
document: z.unknown().refine((v) => v !== undefined, '请上传 JSON'),
|
||||
})
|
||||
.strict();
|
||||
export const commissionImportPublishSchema =
|
||||
commissionImportRequestSchema.extend({
|
||||
preview_hash: z.string().regex(/^[a-f0-9]{64}$/),
|
||||
confirm_scope: z.literal(true),
|
||||
});
|
||||
export type CommissionImportRequest = z.infer<
|
||||
typeof commissionImportRequestSchema
|
||||
>;
|
||||
export type CommissionImportPublish = z.infer<
|
||||
typeof commissionImportPublishSchema
|
||||
>;
|
||||
export type CommissionBand = {
|
||||
min_price: string | null;
|
||||
max_price: string | null;
|
||||
min_inclusive: boolean;
|
||||
max_inclusive: boolean;
|
||||
commission_rate: string;
|
||||
};
|
||||
export type CommissionImportCategory = {
|
||||
source_category_id: string;
|
||||
parent_source_id: string;
|
||||
name: string;
|
||||
parent_name: string;
|
||||
bands: CommissionBand[];
|
||||
status: 'eligible' | 'excluded';
|
||||
issues: string[];
|
||||
change: 'added' | 'changed' | 'unchanged';
|
||||
mapped_types: number;
|
||||
};
|
||||
export type CommissionImportSummary = {
|
||||
categories: number;
|
||||
rules: number;
|
||||
eligible: number;
|
||||
excluded: number;
|
||||
mapped_types: number;
|
||||
removed: number;
|
||||
};
|
||||
export type CommissionImportPreview = {
|
||||
preview_hash: string;
|
||||
previous_import_id: string | null;
|
||||
categories: CommissionImportCategory[];
|
||||
summary: CommissionImportSummary;
|
||||
};
|
||||
export type CommissionImportVersion = {
|
||||
id: string;
|
||||
platform_id: string;
|
||||
version: string;
|
||||
source_reference: string;
|
||||
captured_on: string;
|
||||
activated_at: string;
|
||||
is_current: boolean;
|
||||
summary: CommissionImportSummary;
|
||||
};
|
||||
export type CommissionImportDetail = CommissionImportVersion & {
|
||||
categories: CommissionImportCategory[];
|
||||
};
|
||||
export type CommissionRulesResult = {
|
||||
category_name: string;
|
||||
currency_code: string;
|
||||
version: string;
|
||||
source: string;
|
||||
effective_from: string;
|
||||
bands: Array<CommissionBand & { id: string }>;
|
||||
};
|
||||
export type CommissionDetails = CommissionBand & {
|
||||
category_name: string;
|
||||
currency_code: string;
|
||||
version: string;
|
||||
source: string;
|
||||
};
|
||||
@@ -9,3 +9,4 @@ export * from './online-products';
|
||||
|
||||
export * from './pricing';
|
||||
export * from './pricing-admin';
|
||||
export * from './category-commissions';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { CommissionDetails } from './category-commissions';
|
||||
import { z } from 'zod';
|
||||
|
||||
const decimal = z.string().regex(/^\d{1,9}(\.\d{1,8})?$/);
|
||||
@@ -132,6 +133,7 @@ export type PricingPreviewRequest = z.infer<typeof pricingPreviewRequestSchema>;
|
||||
export type PricingSelection = z.infer<typeof pricingSelectionSchema>;
|
||||
export type PricingPolicyRequest = z.infer<typeof pricingPolicyRequestSchema>;
|
||||
export type PricingOption = {
|
||||
commission_details?: CommissionDetails;
|
||||
id: string;
|
||||
transport_method_id: string;
|
||||
transport_name: string;
|
||||
|
||||
@@ -202,6 +202,8 @@ export type ProductEditorSnapshot = {
|
||||
};
|
||||
default_physical_spec: PhysicalSpec;
|
||||
default_package_spec: PackageSpec;
|
||||
package_weight_mode: 'common' | 'variant';
|
||||
package_dimensions_mode: 'common' | 'variant';
|
||||
};
|
||||
profile: {
|
||||
id: string;
|
||||
@@ -507,6 +509,8 @@ export const saveProductEditorDraftRequestSchema = z
|
||||
supply_note: nullableText(4_000),
|
||||
default_physical_spec: physicalSpec,
|
||||
default_package_spec: packageSpec,
|
||||
package_weight_mode: z.enum(['common', 'variant']).optional(),
|
||||
package_dimensions_mode: z.enum(['common', 'variant']).optional(),
|
||||
})
|
||||
.strict(),
|
||||
profile: z
|
||||
|
||||
Reference in New Issue
Block a user