Просмотр исходного кода

Merge branch 'master' into dev

shish 6 месяцев назад
Родитель
Сommit
184e52fc57

+ 1 - 1
app-ghs/controllers/CustomController.php

@@ -147,7 +147,7 @@ class CustomController extends BaseController
         if (getenv('YII_ENV') == 'production') {
             //小向花卉
             if (in_array($this->shopId, [23580, 24713])) {
-                if (!in_array($this->adminId, [24043, 23960, 4, 77951])) {
+                if (!in_array($this->adminId, [24043, 23960, 4, 77951, 77951])) {
                     util::fail('不能销单哦!!');
                 }
             }

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

@@ -177,8 +177,15 @@ class ProductController extends BaseController
         if (empty($info)) {
             util::fail('没有找到花材');
         }
-        $price = $info->skPrice ?? 0;
+
+        $priceMap = CustomClass::$levelPriceKeyMap;
+        $addPriceMap = CustomClass::$levelAddPriceKeyMap;
+
+        $price = ProductClass::getFinalPrice($info, 0, $priceMap, $addPriceMap);
         $price = floatval($price);
+        $hyPrice = ProductClass::getFinalPrice($info, 1, $priceMap, $addPriceMap);
+        $hyPrice = floatval($hyPrice);
+
         $name = $info->name ?? '';
         $ptItemId = $info->itemId ?? 0;
         $mainId = $info->mainId ?? 0;
@@ -223,8 +230,6 @@ class ProductController extends BaseController
             }
             if (in_array($this->mainId, $doublePrice)) {
                 //惠雅鲜花,打价格,显示正价和会员价,多处同步修改,关键词 hy_print_label_price ssh 20260101
-                $hyPrice = $info->price ?? 0;
-                $hyPrice = floatval($hyPrice);
                 $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="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';

+ 16 - 7
app-ghs/controllers/PurchaseOrderController.php

@@ -5,6 +5,7 @@ namespace ghs\controllers;
 use biz\ghs\classes\GhsClass;
 use biz\sj\classes\SjClass;
 use bizGhs\book\classes\BookItemClass;
+use bizGhs\custom\classes\CustomClass;
 use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\order\classes\PurchaseOrderItemClass;
 use bizGhs\product\classes\ProductClass;
@@ -203,6 +204,9 @@ class PurchaseOrderController extends BaseController
         $ids = array_unique($ids);
         $infoList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
 
+        $priceMap = CustomClass::$levelPriceKeyMap;
+        $addPriceMap = CustomClass::$levelAddPriceKeyMap;
+
         foreach ($itemList as $key => $item) {
             $name = $item->name ?? '';
             $num = !empty($item->itemNum) ? floatval($item->itemNum) : 0;
@@ -220,8 +224,15 @@ class PurchaseOrderController extends BaseController
                 $unit = '若干' . $smallUnit . '装';
             }
 
-            $price = $infoList[$productId] && $infoList[$productId]['skPrice'] ? $infoList[$productId]['skPrice'] : 0;
-            $price = floatval($price);
+            $price = 0;
+            $hyPrice = 0;
+            if (isset($infoList[$productId])) {
+                $currentInfo = $infoList[$productId];
+                $price = ProductClass::getFinalPrice($currentInfo, 0, $priceMap, $addPriceMap);
+                $price = floatval($price);
+                $hyPrice = ProductClass::getFinalPrice($currentInfo, 1, $priceMap, $addPriceMap);
+                $hyPrice = floatval($hyPrice);
+            }
 
             if (stringUtil::getWordNum($name) > 8) {
                 $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
@@ -240,9 +251,9 @@ class PurchaseOrderController extends BaseController
                 } elseif ($mainId == 72057) {
                     $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
                 } else {
-                    if($priceOption == 0){
+                    if ($priceOption == 0) {
                         $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
-                    }else{
+                    } else {
                         $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
                     }
                 }
@@ -254,12 +265,10 @@ class PurchaseOrderController extends BaseController
                 }
                 if (in_array($this->mainId, $doublePrice)) {
                     //惠雅鲜花,打价格,显示正价和会员价,多处同步修改,关键词 hy_print_label_price ssh 20260101
-                    $hyPrice = $infoList[$productId] && $infoList[$productId]['price'] ? $infoList[$productId]['price'] : 0;
-                    $hyPrice = floatval($hyPrice);
                     $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="230" font="12" w="2" h="2" r="0">会员价 ' . $hyPrice . '元</TEXT>';
-                }elseif ($this->mainId == 4556) {
+                } elseif ($this->mainId == 4556) {
                     //打价格,显示零售价,并且不带元,杭州斗南鲜花不要带元
                     $content .= '<TEXT x="35" y="150" font="12" w="4" h="4" r="0">' . $price . '</TEXT>';
                 } else {