feat: 财务结清、酒行信息、库存备注编辑、标签溯源、入库必填校验

后端
- 新增 shop handler:GET/PUT /shop/info(管理员权限)
- 新增 finance CloseByRef:按单据 ref_type+ref_id 结清账款
- 新增 inventory UpdateRemark:PUT /inventory/:id/remark
- 入库/出库审批自动生成财务应付/应收记录(去除金额>0限制)
- 种子数据 S001-S003 补充真实门店信息

前端
- 设置页新增「酒行信息」Tab,管理员可编辑门店名称/地址/电话/负责人
- 入库单列表新增结清按钮(含确认弹窗),出库单同步
- 入库表单:规格、系列、生产日期、供应商、商品名称改为提交必填
- 入库/出库列表新增入库时间、出库时间、创建时间列
- 商品标签标题改为读取 shop 表门店名,扫码文案改为「扫码溯源 · TRACE」
- 标签页脚显示门店地址和电话(从 API 读取,不再依赖编译时 dart-define)
- 库存备注支持点击编辑,超4字截断显示+Hover展示全文
- ApiClient 新增 patch() 方法(已改用 PUT 规避 CORS)

文档
- 新增 docs/user-manual.md 完整用户操作手册(12章)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-05-23 14:05:41 +08:00
parent c77e1c1490
commit c1ed81dfab
60 changed files with 4664 additions and 1572 deletions
+1
View File
@@ -9,6 +9,7 @@ type FinanceRecord struct {
Type string `gorm:"type:enum('receivable','payable','receipt','payment')" json:"type"`
Amount float64 `gorm:"type:decimal(16,2)" json:"amount"`
Balance float64 `gorm:"type:decimal(16,2)" json:"balance"`
Status string `gorm:"size:10;default:open" json:"status"`
RefType string `gorm:"size:30" json:"ref_type"`
RefID *uint64 `json:"ref_id"`
OperatorID uint64 `gorm:"not null" json:"operator_id"`
+28 -11
View File
@@ -34,8 +34,9 @@ type StockInItem struct {
Quantity float64 `gorm:"type:decimal(12,3);not null" json:"quantity"`
UnitPrice float64 `gorm:"type:decimal(16,2);default:0" json:"unit_price"`
TotalPrice float64 `gorm:"type:decimal(16,2);default:0" json:"total_price"`
BatchNo string `gorm:"size:50" json:"batch_no"`
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
BatchNo string `gorm:"size:50" json:"batch_no"`
ProductionDate *Date `gorm:"type:date" json:"production_date"`
CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"`
Remark string `gorm:"size:255" json:"remark"`
Product *Product `gorm:"foreignKey:ProductID" json:"product,omitempty"`
@@ -80,18 +81,34 @@ type StockOutItem struct {
Product *Product `gorm:"foreignKey:ProductID" json:"product,omitempty"`
}
// -------- 实时库存 --------
// -------- 实时库存(批次模式:每条记录代表一个批次/批次) --------
type Inventory struct {
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
ShopID uint64 `gorm:"not null;uniqueIndex:uk_shop_wh_product" json:"shop_id"`
WarehouseID uint64 `gorm:"not null;uniqueIndex:uk_shop_wh_product" json:"warehouse_id"`
ProductID uint64 `gorm:"not null;uniqueIndex:uk_shop_wh_product" json:"product_id"`
Quantity float64 `gorm:"type:decimal(12,3);default:0" json:"quantity"`
UpdatedAt time.Time `json:"updated_at"`
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
ShopID uint64 `gorm:"not null" json:"shop_id"`
WarehouseID *uint64 `json:"warehouse_id"`
ProductID *uint64 `json:"product_id"`
StockInItemID *uint64 `json:"stock_in_item_id"`
InventoryCheckID *uint64 `json:"inventory_check_id"`
Quantity float64 `gorm:"type:decimal(12,3);not null;default:0" json:"quantity"`
ProductCode string `gorm:"size:50" json:"product_code"`
ProductName string `gorm:"size:200" json:"product_name"`
Series string `gorm:"size:100" json:"series"`
Spec string `gorm:"size:100" json:"spec"`
Unit string `gorm:"size:20" json:"unit"`
WarehouseName string `gorm:"size:100" json:"warehouse_name"`
UnitPrice *float64 `gorm:"type:decimal(16,2)" json:"unit_price"`
ProductionDate *Date `gorm:"type:date" json:"production_date"`
BatchNo string `gorm:"size:50" json:"batch_no"`
SupplierName string `gorm:"size:200" json:"supplier_name"`
Remark string `gorm:"size:500" json:"remark"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `gorm:"index" json:"-"`
Product *Product `gorm:"foreignKey:ProductID" json:"product,omitempty"`
Warehouse *Warehouse `gorm:"foreignKey:WarehouseID" json:"warehouse,omitempty"`
StockInItem *StockInItem `gorm:"foreignKey:StockInItemID" json:"stock_in_item,omitempty"`
Product *Product `gorm:"foreignKey:ProductID" json:"product,omitempty"`
Warehouse *Warehouse `gorm:"foreignKey:WarehouseID" json:"warehouse,omitempty"`
}
// -------- 库存流水 --------