feat: 商品详情页、XLS导入修复、分页选择器、导出功能
后端: - 新增 product_images 表,支持每商品最多5张图(服务端压缩至1200px/JPEG85%) - products 表新增 public_id(UUID)、description 字段 - 新增商品详情接口、二维码接口、公开商品接口(无鉴权) - 修复 XLS 导入:OLE2 magic bytes 检测 + 临时文件解析,兼容 extrame/xls - 修复商品/名称/系列/规格三张表导入数据为0(LastCol()=0 bug) - 所有导入接口返回 total/imported/skipped 统计 - config 新增 StorageConfig,支持 STORAGE_* 环境变量覆盖 - 种子数据修复:products 补 public_id、新增 product_images TRUNCATE、schema.sql 表名修正 前端: - 商品详情页:图片上传/删除、描述内联编辑、二维码弹窗、公开链接复制 - 公开商品页:无鉴权路由 /product/:public_id,Flutter Web SPA - 商品详情列表(批次追踪)商品名超链接跳转详情页 - 导航「商品管理」改名「商品详情」 - 所有列表表格新增每页条数选择(10/20/50/100) - 表格列头内嵌筛选(FilterableColumnHeader) - 导出 Excel 功能(入库/出库/库存/财务/批次/往来单位) - 网络恢复自动刷新 + 离线缓存展示 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ type Partner struct {
|
||||
BankAccount string `gorm:"size:100" json:"bank_account"`
|
||||
CreditLimit float64 `gorm:"type:decimal(12,2)" json:"credit_limit"`
|
||||
Balance float64 `gorm:"type:decimal(12,2);default:0" json:"balance"`
|
||||
Status string `gorm:"type:enum('enabled','disabled');not null;default:'enabled'" json:"status"`
|
||||
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
||||
Remark string `gorm:"size:500" json:"remark"`
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ type ProductCategory struct {
|
||||
|
||||
type Product struct {
|
||||
TenantBase
|
||||
PublicID string `gorm:"size:36;uniqueIndex" json:"public_id"`
|
||||
Code string `gorm:"size:50" json:"code"`
|
||||
Barcode string `gorm:"size:100" json:"barcode"`
|
||||
Name string `gorm:"size:200;not null" json:"name"`
|
||||
@@ -20,8 +21,10 @@ type Product struct {
|
||||
PurchasePrice float64 `gorm:"type:decimal(12,2)" json:"purchase_price"`
|
||||
SalePrice float64 `gorm:"type:decimal(12,2)" json:"sale_price"`
|
||||
MinStock int `gorm:"default:0" json:"min_stock"`
|
||||
Description string `gorm:"type:text" json:"description"`
|
||||
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
|
||||
Remark string `gorm:"size:500" json:"remark"`
|
||||
|
||||
Category *ProductCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
||||
Images []ProductImage `gorm:"foreignKey:ProductID" json:"images,omitempty"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ProductImage struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
ProductID uint64 `gorm:"not null;index" json:"product_id"`
|
||||
ShopID uint64 `gorm:"not null" json:"shop_id"`
|
||||
URL string `gorm:"size:500;not null" json:"url"`
|
||||
SortOrder int `gorm:"default:0" json:"sort_order"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package model
|
||||
|
||||
type ProductNameOption struct {
|
||||
TenantBase
|
||||
Code string `gorm:"size:50" json:"code"`
|
||||
Name string `gorm:"size:200;not null" json:"name"`
|
||||
Remark string `gorm:"size:500" json:"remark"`
|
||||
}
|
||||
|
||||
type ProductSeriesOption struct {
|
||||
TenantBase
|
||||
Code string `gorm:"size:50" json:"code"`
|
||||
Name string `gorm:"size:200;not null" json:"name"`
|
||||
Remark string `gorm:"size:500" json:"remark"`
|
||||
}
|
||||
|
||||
type ProductSpecOption struct {
|
||||
TenantBase
|
||||
Code string `gorm:"size:50" json:"code"`
|
||||
Name string `gorm:"size:200;not null" json:"name"`
|
||||
Quantity int `gorm:"default:0" json:"quantity"`
|
||||
Remark string `gorm:"size:500" json:"remark"`
|
||||
}
|
||||
@@ -23,6 +23,7 @@ type StockInOrder struct {
|
||||
Warehouse *Warehouse `gorm:"foreignKey:WarehouseID" json:"warehouse,omitempty"`
|
||||
Partner *Partner `gorm:"foreignKey:PartnerID" json:"partner,omitempty"`
|
||||
Operator *User `gorm:"foreignKey:OperatorID" json:"operator,omitempty"`
|
||||
Reviewer *User `gorm:"foreignKey:ReviewerID" json:"reviewer,omitempty"`
|
||||
}
|
||||
|
||||
type StockInItem struct {
|
||||
@@ -62,6 +63,7 @@ type StockOutOrder struct {
|
||||
Warehouse *Warehouse `gorm:"foreignKey:WarehouseID" json:"warehouse,omitempty"`
|
||||
Partner *Partner `gorm:"foreignKey:PartnerID" json:"partner,omitempty"`
|
||||
Operator *User `gorm:"foreignKey:OperatorID" json:"operator,omitempty"`
|
||||
Reviewer *User `gorm:"foreignKey:ReviewerID" json:"reviewer,omitempty"`
|
||||
}
|
||||
|
||||
type StockOutItem struct {
|
||||
|
||||
Reference in New Issue
Block a user