feat: 入库单/商品详情展示产地保质期储存方式,商品详情显示建议零售价
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -269,6 +269,10 @@ class _ProductDetailScreenState extends ConsumerState<ProductDetailScreen> {
|
||||
_buildImageSection(p),
|
||||
const SizedBox(height: 20),
|
||||
_buildInfoSection(p),
|
||||
if (p.salePrice != null && p.salePrice! > 0) ...[
|
||||
const SizedBox(height: 20),
|
||||
_buildPriceSection(p),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
_buildDescSection(),
|
||||
const SizedBox(height: 20),
|
||||
@@ -350,7 +354,12 @@ class _ProductDetailScreenState extends ConsumerState<ProductDetailScreen> {
|
||||
SizedBox(width: 200, child: row('品牌', p.brand?.isEmpty ?? true ? '-' : p.brand!)),
|
||||
SizedBox(width: 200, child: row('单位', p.unit.isEmpty ? '-' : p.unit)),
|
||||
SizedBox(width: 200, child: row('进价', p.purchasePrice != null ? '¥${p.purchasePrice!.toStringAsFixed(2)}' : '-')),
|
||||
SizedBox(width: 200, child: row('售价', p.salePrice != null ? '¥${p.salePrice!.toStringAsFixed(2)}' : '-')),
|
||||
if (p.originName?.isNotEmpty ?? false)
|
||||
SizedBox(width: 200, child: row('产地', p.originName!)),
|
||||
if (p.shelfLifeName?.isNotEmpty ?? false)
|
||||
SizedBox(width: 200, child: row('保质期', p.shelfLifeName!)),
|
||||
if (p.storageName?.isNotEmpty ?? false)
|
||||
SizedBox(width: 200, child: row('储存方式', p.storageName!)),
|
||||
if (p.barcode?.isNotEmpty ?? false)
|
||||
SizedBox(width: 200, child: row('条码', p.barcode!)),
|
||||
],
|
||||
@@ -359,6 +368,35 @@ class _ProductDetailScreenState extends ConsumerState<ProductDetailScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPriceSection(Product p) {
|
||||
final price = p.salePrice!;
|
||||
final priceStr = price % 1 == 0
|
||||
? price.toInt().toString()
|
||||
: price.toStringAsFixed(2);
|
||||
return Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
side: BorderSide(color: AppTheme.border, width: 0.5),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
const Text('建议零售价',
|
||||
style: TextStyle(fontSize: 13, color: AppTheme.textSecondary)),
|
||||
const Spacer(),
|
||||
Text('¥$priceStr',
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.danger)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDescSection() {
|
||||
return Card(
|
||||
elevation: 0,
|
||||
|
||||
@@ -813,13 +813,34 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> {
|
||||
...o.items.asMap().entries.map((e) {
|
||||
final i = e.key;
|
||||
final item = e.value;
|
||||
// 产地/保质期/储存拼成一行辅助文本
|
||||
final attrs = [
|
||||
if (item.productOrigin?.isNotEmpty ?? false) item.productOrigin!,
|
||||
if (item.productShelfLife?.isNotEmpty ?? false) item.productShelfLife!,
|
||||
if (item.productStorage?.isNotEmpty ?? false) item.productStorage!,
|
||||
].join(' · ');
|
||||
return TableRow(
|
||||
decoration: BoxDecoration(
|
||||
color: i.isEven ? Colors.white : const Color(0xFFFAFAFA)),
|
||||
children: [
|
||||
_TableCell('${i + 1}'),
|
||||
_TableCell(item.productCode ?? '-'),
|
||||
_TableCell(item.productName ?? '-'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(item.productName ?? '-',
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
if (attrs.isNotEmpty)
|
||||
Text(attrs,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFF888888))),
|
||||
],
|
||||
),
|
||||
),
|
||||
_TableCell(item.productSeries ?? '-'),
|
||||
_TableCell(item.productSpec ?? '-'),
|
||||
_TableCell(item.quantity.toStringAsFixed(3)),
|
||||
|
||||
Reference in New Issue
Block a user