|
|
|
@ -279,6 +279,10 @@ class Goods extends GoodsModel |
|
|
|
|
$data['line_price_min'] = $data['line_price_max'] = $data['goods_price']; |
|
|
|
|
$data['stock_total'] = $data['stock_num']; |
|
|
|
|
$data['cost_price_min'] = $data['cost_price']??0; |
|
|
|
|
$profit = (float)$data['goods_price_min'] - (float)$data['cost_price_min']; |
|
|
|
|
$profit_rate = (float)$data['goods_price_min'] > 0 ? bcmul((string)($profit / (float)$data['goods_price_min']) , "100", 2) : 0.00; |
|
|
|
|
$data['profit'] = $profit; |
|
|
|
|
$data['profit_rate'] = $profit_rate; |
|
|
|
|
} |
|
|
|
|
// 规格和sku数据处理 |
|
|
|
|
if ($data['spec_type'] == GoodsSpecTypeEnum::MULTI) { |
|
|
|
@ -301,10 +305,7 @@ class Goods extends GoodsModel |
|
|
|
|
$aloneGradeEquity[$gradeId] = $value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$profit = (float)$data['goods_price_min'] - (float)$data['cost_price_min']; |
|
|
|
|
$profit_rate = (float)$data['goods_price_min'] > 0 ? bcmul((string)($profit / (float)$data['goods_price_min']) , "100", 2) : 0.00; |
|
|
|
|
$data['profit'] = $profit; |
|
|
|
|
$data['profit_rate'] = $profit_rate; |
|
|
|
|
|
|
|
|
|
$data['alone_grade_equity'] = $aloneGradeEquity; |
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|