shish 3 lat temu
rodzic
commit
94fc54e8e8
1 zmienionych plików z 32 dodań i 9 usunięć
  1. 32 9
      biz-ghs/order/classes/OrderClass.php

+ 32 - 9
biz-ghs/order/classes/OrderClass.php

@@ -910,10 +910,20 @@ class OrderClass extends BaseClass
     {
         //58mm的机器,一行打印16个汉字,32个字母
         $name = $current['name'] ?? '';
-        $content .= "<B>".$name . '</B><BR>';
+
         $productNum = $current['num'] ?? '';
+        $content .= '<B>' . $name . ' ' . $productNum . '</B><BR>';
+        $blankNum = bcsub(12, strlen($productNum));
+        if ($blankNum > 0) {
+            $productNum = $productNum . str_repeat(' ', $blankNum);
+        }
+
         $productPrice = $current['price'] ?? '';
-        $content .= "<B>" . $productNum . ' ' . $productPrice . '</B><BR>';
+        $blankNum = bcsub(7, strlen($productPrice));
+        if ($blankNum > 0) {
+            $productPrice = $productPrice . str_repeat(' ', $blankNum);
+        }
+        $content .= $productNum . ' ' . $productPrice . '<BR>';
         return $content;
     }
 
@@ -973,7 +983,9 @@ class OrderClass extends BaseClass
 
         if (isset($respond['product']) && !empty($respond['product'])) {
             foreach ($respond['product'] as $current) {
+
                 $content = self::printGroup($current, $content);
+
             }
             $content .= '--------------------------------<BR>';
         }
@@ -983,17 +995,28 @@ class OrderClass extends BaseClass
             foreach ($respond['refund'] as $current) {
                 //58mm的机器,一行打印16个汉字,32个字母
                 $name = $current['name'] ?? '';
-                $content .= "<B>".$name . '</B><BR>';
+                $content .= $name . '<BR>';
+                $name = str_repeat(' ', 10);
+
                 $productNum = $current['num'] ?? '';
+                $blankNum = bcsub(12, strlen($productNum));
+                if ($blankNum > 0) {
+                    $productNum = $productNum . str_repeat(' ', $blankNum);
+                }
+
                 $productPrice = $current['price'] ?? '';
-                $content .= "<B>" . $productNum . '  ' . $productPrice . '</B><BR>';
+                $blankNum = bcsub(7, strlen($productPrice));
+                if ($blankNum > 0) {
+                    $productPrice = $productPrice . str_repeat(' ', $blankNum);
+                }
+                $content .= $name . " " . $productNum . ' ' . $productPrice . '<BR>';
             }
             $content .= '--------------------------------<BR>';
         }
 
-         if (isset($orderInfo['itemPrice']) && $orderInfo['itemPrice'] > 0) {
-             $content .= '商品金额:' . floatval($orderInfo['itemPrice']) . '<BR>';
-         }
+        if (isset($orderInfo['itemPrice']) && $orderInfo['itemPrice'] > 0) {
+            $content .= '商品金额:' . floatval($orderInfo['itemPrice']) . '<BR>';
+        }
         if (isset($respond['sendCost']) && $respond['sendCost'] > 0) {
             $content .= '    运费:' . floatval($respond['sendCost']) . '<BR>';
         }
@@ -1106,7 +1129,7 @@ class OrderClass extends BaseClass
                     $bigTotalPrice = bcmul($bigUnitPrice, $bigNum, 2);
                     $printProduct[] = [
                         'name' => $itemVal['name'] ?? '',
-                        'num' => floatval($bigNum) . '扎 *' . floatval($bigUnitPrice),
+                        'num' => floatval($bigNum) . '扎*' . floatval($bigUnitPrice),
                         'price' => floatval($bigTotalPrice),
                     ];
                 }
@@ -1114,7 +1137,7 @@ class OrderClass extends BaseClass
                     $smallTotalPrice = bcmul($smallUnitPrice, $smallNum, 2);
                     $printProduct[] = [
                         'name' => $itemVal['name'] ?? '',
-                        'num' => floatval($smallNum) . '支 *' . floatval($smallUnitPrice),
+                        'num' => floatval($smallNum) . '支*' . floatval($smallUnitPrice),
                         'price' => floatval($smallTotalPrice),
                     ];
                 }