feat: 营养用餐新增经营分析/餐品分析页面,小票小计按克重×100g单价计算

- 新增 din-biz-analysis.html(经营分析):营业日期筛选、数据总览4KPI、交易分析宽表、餐次/订单/支付/异常四面板
- 新增 din-meal-analysis.html(餐品分析):查询日期+餐次筛选、数据总览5KPI(含开餐总重量)、营养秤/档口秤多卡片11列明细表
- 营养用餐29个页面侧边栏新增「数据分析」子菜单,index.html SITE_MAP 同步
- 小票小计改为 克重÷100×单价(100g) 实时计算,金额重新核算
- 餐卡余额仅会员支付订单展示
This commit is contained in:
zhangyan
2026-08-04 14:05:40 +08:00
parent c8606b37f5
commit 558ff9f8dd
35 changed files with 1002 additions and 32 deletions
@@ -581,12 +581,13 @@
time: '2026-08-03 12:15:30',
payTime: '2026-08-03 12:15:35',
items: [
{ name: '宫保鸡丁', zone: '档口秤', weight: '200g', price: 18.00, qty: 1, subtotal: 18.00 },
{ name: '番茄炒蛋', zone: '营养秤', weight: '150g', price: 8.00, qty: 1, subtotal: 8.00 },
{ name: '米饭', zone: '营养秤', weight: '250g', price: 2.00, qty: 1, subtotal: 2.00 },
{ name: '紫菜蛋花汤', zone: '档口秤', weight: '300g', price: 5.00, qty: 1, subtotal: 5.00 }
/* 小计 = 克重 ÷ 100 × 单价(100g) */
{ name: '宫保鸡丁', zone: '档口秤', weight: 200, price: 9.00, qty: 1 },
{ name: '番茄炒蛋', zone: '营养秤', weight: 150, price: 5.00, qty: 1 },
{ name: '米饭', zone: '营养秤', weight: 250, price: 1.60, qty: 1 },
{ name: '紫菜蛋花汤', zone: '档口秤', weight: 300, price: 2.00, qty: 1 }
],
total: 33.00, discount: 3.00, payable: 30.00, paid: 30.00,
total: 35.50, discount: 3.00, payable: 32.50, paid: 32.50,
payType: '会员支付', payMethod: '人脸支付', balance: 1280.50,
nutrition: { calories: 685, protein: 28, fat: 18, carb: 95, score: 82 },
printed: true
@@ -600,11 +601,11 @@
time: '2026-08-03 07:42:18',
payTime: '2026-08-03 07:42:23',
items: [
{ name: '豆浆', zone: '营养秤', weight: '300g', price: 3.00, qty: 1, subtotal: 3.00 },
{ name: '油条', zone: '档口秤', weight: '120g', price: 2.50, qty: 2, subtotal: 5.00 },
{ name: '茶叶蛋', zone: '营养秤', weight: '60g', price: 4.00, qty: 1, subtotal: 4.00 }
{ name: '豆浆', zone: '营养秤', weight: 300, price: 1.00, qty: 1 },
{ name: '油条', zone: '档口秤', weight: 240, price: 2.50, qty: 2 },
{ name: '茶叶蛋', zone: '营养秤', weight: 60, price: 4.00, qty: 1 }
],
total: 12.00, discount: 0, payable: 12.00, paid: 12.00,
total: 11.40, discount: 0, payable: 11.40, paid: 11.40,
payType: '会员支付', payMethod: '人脸支付', balance: 1292.50,
nutrition: { calories: 425, protein: 15, fat: 12, carb: 60, score: 75 },
printed: true
@@ -618,13 +619,13 @@
time: '2026-08-03 12:32:45',
payTime: '2026-08-03 12:32:50',
items: [
{ name: '红烧肉', zone: '档口秤', weight: '180g', price: 22.00, qty: 1, subtotal: 22.00 },
{ name: '清炒时蔬', zone: '营养秤', weight: '150g', price: 6.00, qty: 1, subtotal: 6.00 },
{ name: '鱼香肉丝', zone: '档口秤', weight: '160g', price: 12.00, qty: 1, subtotal: 12.00 },
{ name: '米饭', zone: '营养秤', weight: '250g', price: 2.00, qty: 1, subtotal: 2.00 },
{ name: '冬瓜排骨汤', zone: '档口秤', weight: '300g', price: 3.00, qty: 1, subtotal: 3.00 }
{ name: '红烧肉', zone: '档口秤', weight: 180, price: 12.00, qty: 1 },
{ name: '清炒时蔬', zone: '营养秤', weight: 150, price: 4.00, qty: 1 },
{ name: '鱼香肉丝', zone: '档口秤', weight: 160, price: 7.50, qty: 1 },
{ name: '米饭', zone: '营养秤', weight: 250, price: 1.60, qty: 1 },
{ name: '冬瓜排骨汤', zone: '档口秤', weight: 300, price: 1.00, qty: 1 }
],
total: 45.00, discount: 5.00, payable: 40.00, paid: 40.00,
total: 46.60, discount: 5.00, payable: 41.60, paid: 41.60,
payType: '会员支付', payMethod: '人脸支付', balance: 1240.50,
nutrition: { calories: 720, protein: 35, fat: 28, carb: 88, score: 88 },
printed: false
@@ -638,12 +639,12 @@
time: '2026-08-03 18:15:20',
payTime: '2026-08-03 18:15:25',
items: [
{ name: '清蒸鲈鱼', zone: '档口秤', weight: '200g', price: 25.00, qty: 1, subtotal: 25.00 },
{ name: '蒜蓉西兰花', zone: '营养秤', weight: '150g', price: 6.00, qty: 1, subtotal: 6.00 },
{ name: '紫米饭', zone: '营养秤', weight: '200g', price: 3.00, qty: 1, subtotal: 3.00 }
{ name: '清蒸鲈鱼', zone: '档口秤', weight: 200, price: 12.50, qty: 1 },
{ name: '蒜蓉西兰花', zone: '营养秤', weight: 150, price: 4.00, qty: 1 },
{ name: '紫米饭', zone: '营养秤', weight: 200, price: 1.50, qty: 1 }
],
total: 28.00, discount: 0, payable: 28.00, paid: 28.00,
payType: '扫码支付', payMethod: '微信支付', balance: 1212.50,
total: 34.00, discount: 0, payable: 34.00, paid: 34.00,
payType: '扫码支付', payMethod: '微信支付',
nutrition: { calories: 510, protein: 32, fat: 14, carb: 65, score: 90 },
printed: false
},
@@ -656,12 +657,12 @@
time: '2026-08-03 12:48:10',
payTime: '2026-08-03 12:48:15',
items: [
{ name: '番茄炒蛋', zone: '营养秤', weight: '150g', price: 8.00, qty: 1, subtotal: 8.00 },
{ name: '麻婆豆腐', zone: '档口秤', weight: '180g', price: 10.00, qty: 1, subtotal: 10.00 },
{ name: '米饭', zone: '营养秤', weight: '250g', price: 2.00, qty: 1, subtotal: 2.00 },
{ name: '番茄蛋汤', zone: '档口秤', weight: '280g', price: 5.00, qty: 1, subtotal: 5.00 }
{ name: '番茄炒蛋', zone: '营养秤', weight: 150, price: 5.00, qty: 1 },
{ name: '麻婆豆腐', zone: '档口秤', weight: 180, price: 5.00, qty: 1 },
{ name: '米饭', zone: '营养秤', weight: 250, price: 1.60, qty: 1 },
{ name: '番茄蛋汤', zone: '档口秤', weight: 280, price: 1.50, qty: 1 }
],
total: 25.00, discount: 0, payable: 25.00, paid: 25.00,
total: 24.70, discount: 0, payable: 24.70, paid: 24.70,
payType: '会员支付', payMethod: '人脸支付', balance: 1187.50,
nutrition: { calories: 480, protein: 22, fat: 15, carb: 70, score: 78 },
printed: false
@@ -675,11 +676,11 @@
time: '2026-08-03 08:15:30',
payTime: '2026-08-03 08:15:33',
items: [
{ name: '皮蛋瘦肉粥', zone: '档口秤', weight: '350g', price: 5.00, qty: 1, subtotal: 5.00 },
{ name: '鲜肉包子', zone: '营养秤', weight: '150g', price: 3.00, qty: 1, subtotal: 3.00 }
{ name: '皮蛋瘦肉粥', zone: '档口秤', weight: 350, price: 1.40, qty: 1 },
{ name: '鲜肉包子', zone: '营养秤', weight: 150, price: 2.00, qty: 1 }
],
total: 8.00, discount: 0, payable: 8.00, paid: 8.00,
payType: '扫码支付', payMethod: '支付宝支付', balance: 1195.50,
total: 7.90, discount: 0, payable: 7.90, paid: 7.90,
payType: '扫码支付', payMethod: '支付宝支付',
nutrition: { calories: 320, protein: 12, fat: 8, carb: 48, score: 70 },
printed: false
}
@@ -757,11 +758,13 @@
if (!zoneItems || zoneItems.length === 0) return;
itemsHtml += '<tr class="receipt-zone-header"><td colspan="4">【' + zoneName + '】</td></tr>';
zoneItems.forEach(function(it) {
/* 小计 = 餐品克重 ÷ 100 × 单价(100g) */
var subtotal = it.weight / 100 * it.price;
itemsHtml += '<tr>'
+ '<td>' + it.name + '<span style="color:#999;font-size:10px;">' + it.weight + '</span></td>'
+ '<td>' + it.name + '<span style="color:#999;font-size:10px;">' + it.weight + 'g</span></td>'
+ '<td>' + it.price.toFixed(2) + '</td>'
+ '<td>' + it.qty + '</td>'
+ '<td>' + it.subtotal.toFixed(2) + '</td>'
+ '<td>' + subtotal.toFixed(2) + '</td>'
+ '</tr>';
});
});
@@ -806,7 +809,10 @@
+ '<div class="receipt-info">'
+ '<div class="receipt-row"><span class="receipt-row__label">支付类型</span><span class="receipt-row__value">' + order.payType + '</span></div>'
+ '<div class="receipt-row"><span class="receipt-row__label">支付方式</span><span class="receipt-row__value">' + order.payMethod + '</span></div>'
+ '<div class="receipt-row"><span class="receipt-row__label">餐卡余额</span><span class="receipt-row__value">¥' + order.balance.toFixed(2) + '</span></div>'
/* 仅会员支付订单展示餐卡余额 */
+ (order.payType === '会员支付'
? '<div class="receipt-row"><span class="receipt-row__label">餐卡余额</span><span class="receipt-row__value">¥' + order.balance.toFixed(2) + '</span></div>'
: '')
+ '</div>'
+ '<div class="receipt-divider"></div>'
/* 营养摄入摘要 */
@@ -1,5 +1,11 @@
# 结算设备 CHANGELOG
## 2026-08-04 | 小票金额计算与支付信息优化
### 变更
- `02-print-receipt.html` 小计计算规则改为「餐品克重 ÷ 100 × 单价(100g)」,渲染时实时计算;Mock 数据 price 改为 100g 单价、weight 改为数值克重,移除硬编码 subtotal 字段,各订单合计/应付/实付重新核算
- 餐卡余额行仅会员支付订单展示;扫码支付/现金支付订单不再显示餐卡余额,并移除两笔扫码支付订单的 balance 字段
## 2026-08-04 | 打印小票功能完善
### 新增