Files
nuyue bdefa34d41
Build and Push Docker Image / build-and-push (push) Successful in 1m0s
Build and Push Docker Image / deploy (push) Successful in 7s
feat: remove shipping settings, use shipping templates for cart calculation
2026-07-12 20:01:03 +08:00

38 lines
1.7 KiB
Go

package schemas
// CreateShippingTemplateRequest 创建运费模板请求
type CreateShippingTemplateRequest struct {
Name string `json:"name" binding:"required"`
CalcType string `json:"calc_type" binding:"required,oneof=weight piece"`
FirstUnit float64 `json:"first_unit" binding:"required,gt=0"`
FirstFee float64 `json:"first_fee" binding:"gte=0"`
AdditionalUnit float64 `json:"additional_unit" binding:"required,gt=0"`
AdditionalFee float64 `json:"additional_fee" binding:"gte=0"`
FreeAmount float64 `json:"free_amount"`
Provinces []string `json:"provinces"` // 省份列表
IsDefault bool `json:"is_default"`
SortOrder int `json:"sort_order"`
}
// UpdateShippingTemplateRequest 更新运费模板请求
type UpdateShippingTemplateRequest struct {
Name *string `json:"name"`
CalcType *string `json:"calc_type" binding:"omitempty,oneof=weight piece"`
FirstUnit *float64 `json:"first_unit" binding:"omitempty,gt=0"`
FirstFee *float64 `json:"first_fee" binding:"omitempty,gte=0"`
AdditionalUnit *float64 `json:"additional_unit" binding:"omitempty,gt=0"`
AdditionalFee *float64 `json:"additional_fee" binding:"omitempty,gte=0"`
FreeAmount *float64 `json:"free_amount"`
Provinces []string `json:"provinces"`
IsDefault *bool `json:"is_default"`
SortOrder *int `json:"sort_order"`
}
// CalculateShippingRequest 计算运费请求
type CalculateShippingRequest struct {
TemplateID *uint `json:"template_id"`
Weight float64 `json:"weight"`
Quantity int `json:"quantity"`
Subtotal float64 `json:"subtotal"`
Province string `json:"province"`
}