shish пре 7 месеци
родитељ
комит
14d31b71bc
1 измењених фајлова са 12 додато и 8 уклоњено
  1. 12 8
      app-ghs/controllers/ProductController.php

+ 12 - 8
app-ghs/controllers/ProductController.php

@@ -172,10 +172,13 @@ class ProductController extends BaseController
         $num = floatval($num);
         $num = floatval($num);
         $num = (int)$num;
         $num = (int)$num;
         $type = $get['type'] ?? 0;
         $type = $get['type'] ?? 0;
+        $priceOption = $get['priceOption'] ?? 0;
         $info = ProductClass::getById($id, true);
         $info = ProductClass::getById($id, true);
         if (empty($info)) {
         if (empty($info)) {
             util::fail('没有找到花材');
             util::fail('没有找到花材');
         }
         }
+        $price = $info->skPrice ?? 0;
+        $price = floatval($price);
         $name = $info->name ?? '';
         $name = $info->name ?? '';
         $ptItemId = $info->itemId ?? 0;
         $ptItemId = $info->itemId ?? 0;
         $mainId = $info->mainId ?? 0;
         $mainId = $info->mainId ?? 0;
@@ -190,7 +193,7 @@ class ProductController extends BaseController
             $unit = '若干' . $info->smallUnit . '/' . $info->bigUnit;
             $unit = '若干' . $info->smallUnit . '/' . $info->bigUnit;
         }
         }
         $p->times = $num;
         $p->times = $num;
-        if (stringUtil::getWordNum($name) > 8) {
+        if (stringUtil::getWordNum($name) > 14) {
             $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
             $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
         } else {
         } else {
             $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
             $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
@@ -206,7 +209,11 @@ class ProductController extends BaseController
             } elseif ($mainId == 72057) {
             } elseif ($mainId == 72057) {
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
                 $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
             } else {
             } else {
-                $content .= '<TEXT x="30" y="250" font="12" w="1" h="1" r="0">' . $unit . '</TEXT>';
+                if ($priceOption == 0) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                } else {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '  ' . $price . '元</TEXT>';
+                }
             }
             }
         } else {
         } else {
             if (getenv('YII_ENV') == 'production') {
             if (getenv('YII_ENV') == 'production') {
@@ -216,21 +223,18 @@ class ProductController extends BaseController
             }
             }
             if (in_array($this->mainId, $doublePrice)) {
             if (in_array($this->mainId, $doublePrice)) {
                 //打价格,显示正价和会员价
                 //打价格,显示正价和会员价
-                $price = $info->skPrice ?? 0;
-                $price = floatval($price);
                 $hyPrice = $info->price ?? 0;
                 $hyPrice = $info->price ?? 0;
                 $hyPrice = floatval($hyPrice);
                 $hyPrice = floatval($hyPrice);
                 $content .= '<TEXT x="35" y="90" font="12" w="2" h="2" r="0">----------</TEXT>';
                 $content .= '<TEXT x="35" y="90" font="12" w="2" h="2" r="0">----------</TEXT>';
                 $content .= '<TEXT x="35" y="150" font="12" w="2" h="2" r="0">正价 ' . $price . '元</TEXT>';
                 $content .= '<TEXT x="35" y="150" font="12" w="2" h="2" r="0">正价 ' . $price . '元</TEXT>';
                 $content .= '<TEXT x="35" y="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';
                 $content .= '<TEXT x="35" y="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';
-            } else {
+            } elseif ($this->main == 4556) {
                 //打价格,显示零售价,并且不带元,杭州斗南鲜花不要带元
                 //打价格,显示零售价,并且不带元,杭州斗南鲜花不要带元
-                $price = $info->skPrice ?? 0;
-                $price = floatval($price);
                 $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '</TEXT>';
                 $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '</TEXT>';
+            } else {
+                $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '元</TEXT>';
             }
             }
         }
         }
-
         $p->printLabelMsg($content);
         $p->printLabelMsg($content);
         util::complete();
         util::complete();
     }
     }