From 4275b90f605451459fc9658a9484e721eaef90a4 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Sat, 25 Feb 2023 17:41:58 +0800 Subject: [PATCH] 1 --- app/Listeners/OrderPrint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Listeners/OrderPrint.php b/app/Listeners/OrderPrint.php index 1a3c1865..a6a177ee 100644 --- a/app/Listeners/OrderPrint.php +++ b/app/Listeners/OrderPrint.php @@ -27,7 +27,7 @@ class OrderPrint if ($devices->count() > 0 && $templateId) { $service = PrintService::make(); $products = []; - foreach($order->products()->get() as $item) { + foreach($order->products as $item) { array_push($products, [ 'name' => $item->name, 'price' => round($item->sell_price / 100, 2, PHP_ROUND_HALF_DOWN), @@ -42,7 +42,7 @@ class OrderPrint 'desk' => $desk->name, 'products' => json_encode($products), 'total' => round($order->total_amount, 2, PHP_ROUND_HALF_DOWN), - 'remarks' => $order->note, + 'remarks' => $order->note ?: '', ]; foreach($devices as $item) { $result = $service->template($item->device_no, $templateId, $data);