feat: 商品添加克重字段,订单添加通道费,运费按重量计算

- 商品模型: 添加weight字段(克重)
- 订单模型: 添加channel_fee字段(支付通道费)
- 后台商品管理: 添加克重输入框
- 后台订单详情: 显示通道费
- 订单创建: 根据商品重量计算运费,添加通道费计算
- 购物车: 根据商品重量计算运费,显示通道费

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 20:01:45 +08:00
parent ded24ddccc
commit 33f5d242e9
6 changed files with 57 additions and 18 deletions
+1
View File
@@ -14,6 +14,7 @@ type Order struct {
ShippingFee float64 `gorm:"type:decimal(10,2);default:0" json:"shipping_fee"`
ServiceFee float64 `gorm:"type:decimal(10,2);default:0" json:"service_fee"`
Tax float64 `gorm:"type:decimal(10,2);default:0" json:"tax"`
ChannelFee float64 `gorm:"type:decimal(10,2);default:0" json:"channel_fee"` // 支付通道费
TotalAmount float64 `gorm:"type:decimal(10,2);not null" json:"total_amount"`
RefundAmount *float64 `gorm:"type:decimal(10,2)" json:"refund_amount"`
RefundStatus string `gorm:"size:20" json:"refund_status"`
+1
View File
@@ -11,6 +11,7 @@ type Product struct {
Name string `gorm:"size:255;not null" json:"name"`
Description string `json:"description"`
Price float64 `gorm:"type:decimal(10,2);not null" json:"price"`
Weight float64 `gorm:"type:decimal(10,2);default:0" json:"weight"` // 商品克重(克)
MinPurchase int `gorm:"default:1" json:"min_purchase"`
MaxPurchase *int `json:"max_purchase"`
MinWeight *float64 `json:"min_weight"`