|
|
@@ -15,6 +15,53 @@ class ProductClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizHd\product\models\Product';
|
|
|
|
|
|
+ //花材列表用到的数据组合 ssh 20221225
|
|
|
+ public static function itemListGroup($list, $level = 0)
|
|
|
+ {
|
|
|
+ //各个等级对应的price addPrice字段
|
|
|
+ $priceMap = \bizGhs\custom\classes\CustomClass::$levelPriceKeyMap;
|
|
|
+ $addPriceMap = \bizGhs\custom\classes\CustomClass::$levelAddPriceKeyMap;
|
|
|
+
|
|
|
+ foreach ($list as $k => $v) {
|
|
|
+ $shortCover = $v['cover'] ?? '';
|
|
|
+ $cover = imgUtil::getPrefix() . 'hhb_small.png';
|
|
|
+ if (!empty($shortCover)) {
|
|
|
+ $parse = parse_url(self::groupImg($shortCover));
|
|
|
+ if (empty($parse['query'])) {
|
|
|
+ $cover = self::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_100,w_100";
|
|
|
+ } else {
|
|
|
+ $cover = self::groupImg($shortCover);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list[$k]['cover'] = $cover;
|
|
|
+ //今日特价、会员价
|
|
|
+ $price = \bizGhs\product\classes\ProductClass::getFinalPrice($v, $level, $priceMap, $addPriceMap);
|
|
|
+ if ($level == 0) {
|
|
|
+ //零售做特价时显示的原价,不能删除
|
|
|
+ if (isset($v['skPrice'])) {
|
|
|
+ $list[$k]['prePrice'] = $v['skPrice'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
|
|
|
+ //做特价花材时,花材列表和改价列表显示的会员价和零售价,不能删除
|
|
|
+ $list[$k]['hjPrice'] = floatval($v['hjDiscountPrice']);
|
|
|
+ $list[$k]['skPrice'] = floatval($v['skDiscountPrice']);
|
|
|
+ }
|
|
|
+ $list[$k]['price'] = $price;
|
|
|
+ $cost = $v['cost'] ?? 0;
|
|
|
+ if ($price > 0) {
|
|
|
+ $profit = bcsub($price, $cost, 2);
|
|
|
+ $mll = bcdiv($profit, $price, 3);
|
|
|
+ $mll = bcmul($mll, 100);
|
|
|
+ $mll = round($mll, 1);
|
|
|
+ } else {
|
|
|
+ $mll = 0;
|
|
|
+ }
|
|
|
+ $list[$k]['mll'] = $mll;
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
public static function kdItemGroup($list, $level = 0)
|
|
|
{
|
|
|
//各个等级对应的price addPrice字段
|