feat: 入库单/商品详情展示产地保质期储存方式,商品详情显示建议零售价

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-08 07:57:10 +08:00
parent 1ec1d4209a
commit 4e64e5eb47
6 changed files with 87 additions and 3 deletions
@@ -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,