From fdd8ccb3404f3c63c578c7e5ab6c7c7320cdb013 Mon Sep 17 00:00:00 2001 From: ypsdf1 Date: Tue, 7 Jul 2026 11:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E5=8F=B0=E6=96=B0=E5=A2=9E=E6=89=93=E5=8C=85=E5=B0=8F=E7=A5=A8?= =?UTF-8?q?(=E5=B0=8F=E7=A5=A8=E5=BC=B9=E7=AA=97+=E6=89=93=E5=8D=B0)=20+?= =?UTF-8?q?=20buy=5Fcart=E8=BF=94=E5=9B=9Eorder=5Fno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/shop.php | 6 ++-- cashier.php | 95 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 94 insertions(+), 7 deletions(-) diff --git a/api/shop.php b/api/shop.php index f3dad5a..b36e8d2 100644 --- a/api/shop.php +++ b/api/shop.php @@ -332,6 +332,7 @@ function shopBuyCart($token) { $isAdminSession = false; $operatorDiscountLimit = 0; $cashierRow = null; + $orderNo = ''; if ($token) { $tokenInfo = validateToken($token); @@ -544,7 +545,7 @@ function shopBuyCart($token) { if ($isCashier || $isAdminToken || $isAdminSession) { $operatorType = $isCashier ? 'cashier' : 'admin'; $operatorName = $isCashier ? ($cashierRow['username'] ?? '') : 'admin'; - recordCashierOrder([ + $orderNo = recordCashierOrder([ 'operator_type' => $operatorType, 'operator_name' => $operatorName, 'player_name' => $player, @@ -582,7 +583,8 @@ function shopBuyCart($token) { 'discount_percent' => (int)$discountPercent, 'discount_amount' => (int)$discountAmount, 'saved' => $saved, - 'player' => $player + 'player' => $player, + 'order_no' => $orderNo ?? '' ], '购物车结算成功'); } diff --git a/cashier.php b/cashier.php index 4b19251..8aa674b 100644 --- a/cashier.php +++ b/cashier.php @@ -191,6 +191,32 @@ $initialState = json_encode([ *::-webkit-scrollbar-thumb { background:var(--border); border-radius:6px; } *::-webkit-scrollbar-thumb:hover { background:var(--dim); } * { scrollbar-width:thin; scrollbar-color:var(--border) transparent; } + + /* 小票(打包收据)样式:模拟热敏纸小票 */ + #receiptOverlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,.55); z-index:6000; justify-content:center; align-items:flex-start; padding:24px 12px; overflow-y:auto; } + #receiptOverlay.show { display:flex; } + .receipt { background:#fdfdf7; color:#1a1a1a; width:340px; max-width:100%; border-radius:8px; padding:22px 20px; box-shadow:0 16px 48px rgba(0,0,0,.5); font-family:'Courier New',monospace; font-size:13px; line-height:1.5; } + .receipt h2 { text-align:center; font-size:17px; margin-bottom:4px; letter-spacing:1px; } + .receipt .r-sub { text-align:center; font-size:11px; color:#555; margin-bottom:10px; } + .receipt .r-line { display:flex; justify-content:space-between; gap:8px; } + .receipt .r-sep { border-top:1px dashed #999; margin:8px 0; } + .receipt .r-item { font-size:12px; } + .receipt .r-item .ri-name { flex:1; } + .receipt .r-total { font-size:16px; font-weight:700; border-top:2px solid #1a1a1a; margin-top:8px; padding-top:6px; } + .receipt .r-foot { text-align:center; font-size:10px; color:#666; margin-top:12px; } + .receipt .r-actions { display:flex; gap:10px; margin-top:16px; } + .receipt .r-actions button { flex:1; padding:10px; border:none; border-radius:6px; font-size:13px; font-weight:700; cursor:pointer; } + .receipt .r-print { background:#1a1a1a; color:#fff; } + .receipt .r-done { background:#d9d9cf; color:#1a1a1a; } + + /* 打印时只显示小票本体 */ + @media print { + body * { visibility:hidden !important; } + #receiptOverlay, #receiptOverlay * { visibility:visible !important; } + #receiptOverlay { position:absolute; background:#fff; padding:0; align-items:flex-start; } + .receipt { box-shadow:none; width:80mm; max-width:80mm; margin:0 auto; } + .receipt .r-actions { display:none !important; } + } @@ -305,6 +331,11 @@ $initialState = json_encode([ + +
+
+
+