shish 5 năm trước cách đây
mục cha
commit
af876906b2
1 tập tin đã thay đổi với 28 bổ sung2 xóa
  1. 28 2
      biz-ghs/order/classes/OrderClass.php

+ 28 - 2
biz-ghs/order/classes/OrderClass.php

@@ -453,7 +453,33 @@ class OrderClass extends BaseClass
 
 
         if (isset($respond['product']) && !empty($respond['product'])) {
         if (isset($respond['product']) && !empty($respond['product'])) {
             foreach ($respond['product'] as $current) {
             foreach ($respond['product'] as $current) {
-                $content .= $current['name'] . " " . $current['num'] . ' ' . $current['price'] . '<BR>';
+                //58mm的机器,一行打印16个汉字,32个字母
+                $name = $current['name'] ?? '';
+
+                $currentNum = stringUtil::getWordNum($name);
+                if ($currentNum >= 6) {
+                    $name = stringUtil::subStringUtf8($name, 5, '..');
+                }
+
+                preg_match_all("/([\x{4e00}-\x{9fa5}]){1}/u", $name, $arrCh);
+                //中文字数
+                $zwNum = count($arrCh[0]);
+                $totalNum = strlen($name);
+                $notZwNum = bcsub($totalNum, $zwNum * 3);
+                $holdNum = bcadd($notZwNum, $zwNum * 2);
+                $blankNum = bcsub(16, $holdNum);
+
+                $name = $name . str_repeat(' ', $blankNum);
+
+                $productNum = $current['num'] ?? '';
+                $blankNum = bcsub(9, strlen($productNum));
+                $productNum = $productNum . str_repeat(' ', $blankNum);
+
+                $productPrice = $current['price'] ?? '';
+                $blankNum = bcsub(7, strlen($productPrice));
+                $productPrice = $productPrice . str_repeat(' ', $blankNum);
+
+                $content .= $name . " " . $productNum . ' ' . $productPrice . '<BR>';
             }
             }
         }
         }
         $content .= '--------------------------------<BR>';
         $content .= '--------------------------------<BR>';
@@ -519,7 +545,7 @@ class OrderClass extends BaseClass
         $sendNum = $val['sendNum'] ?? '';
         $sendNum = $val['sendNum'] ?? '';
 
 
         $printData = [
         $printData = [
-            'address' => '--',
+            'address' => '',
             'sendCost' => $val['sendCost'] ?? '0.00',
             'sendCost' => $val['sendCost'] ?? '0.00',
             'prePrice' => $val['prePrice'] ?? '0.00',
             'prePrice' => $val['prePrice'] ?? '0.00',
             'discountAmount' => $val['discountAmount'] ?? '0.00',
             'discountAmount' => $val['discountAmount'] ?? '0.00',