feat(client): 录单表单优化 + 可搜索下拉支持新建 + 日期选择器组件
新增 DatePickerField 日期选择器与 date_util;可搜索下拉 SearchableOptionField 支持内联新建选项;入库/出库录单表单、商品页、财务页、app_shell 导航相应调整。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@ class ShopInfo {
|
||||
final String managerName;
|
||||
final String logoUrl;
|
||||
final String wechatId;
|
||||
// 店级动态配置(后端 shops.custom_fields JSON),存录入默认值等轻量配置
|
||||
final Map<String, dynamic> customFields;
|
||||
|
||||
const ShopInfo({
|
||||
required this.id,
|
||||
@@ -17,8 +19,24 @@ class ShopInfo {
|
||||
required this.managerName,
|
||||
this.logoUrl = '',
|
||||
this.wechatId = '',
|
||||
this.customFields = const {},
|
||||
});
|
||||
|
||||
/// 入库录入默认商品名称选项 id(未配置返回 null)。
|
||||
int? get defaultNameId => _asInt(customFields['default_name_id']);
|
||||
|
||||
/// 入库录入默认系列选项 id(未配置返回 null)。
|
||||
int? get defaultSeriesId => _asInt(customFields['default_series_id']);
|
||||
|
||||
/// 入库录入默认规格选项 id(未配置返回 null)。
|
||||
int? get defaultSpecId => _asInt(customFields['default_spec_id']);
|
||||
|
||||
static int? _asInt(dynamic v) {
|
||||
if (v == null) return null;
|
||||
if (v is num) return v.toInt();
|
||||
return int.tryParse(v.toString());
|
||||
}
|
||||
|
||||
factory ShopInfo.fromJson(Map<String, dynamic> json) => ShopInfo(
|
||||
id: (json['id'] as num).toInt(),
|
||||
code: json['code'] as String? ?? '',
|
||||
@@ -28,5 +46,8 @@ class ShopInfo {
|
||||
managerName: json['manager_name'] as String? ?? '',
|
||||
logoUrl: json['logo_url'] as String? ?? '',
|
||||
wechatId: json['wechat_id'] as String? ?? '',
|
||||
customFields:
|
||||
(json['custom_fields'] as Map?)?.cast<String, dynamic>() ??
|
||||
const {},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user