shish 3 лет назад
Родитель
Сommit
3058f24c7e

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

@@ -209,7 +209,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::breakItemGroup($itemInfoData, $level);
         } elseif ($requestType == 'stockOut') {
             //出库花材
-            $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio';
+            $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio,smallRatio';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::stockOutGroup($itemInfoData, $level);
         } elseif ($requestType == 'cg') {

+ 5 - 1
biz-ghs/product/classes/ProductClass.php

@@ -135,7 +135,11 @@ class ProductClass extends BaseClass
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
             $list[$k]['price'] = $price;
             $list[$k]['bigPrice'] = $price;
-
+            $smallRatio = $v['smallRatio'] ?? 0;
+            $ratio = isset($v['ratio']) && $v['ratio'] > 0 ? $v['ratio'] : 1;
+            $smallPrice = bcdiv($price, $ratio, 2);
+            $smallPrice = bcmul($smallPrice, $smallRatio, 2);
+            $list[$k]['smallPrice'] = $smallPrice;
         }
         return $list;
     }