feat : add_staple_food

This commit is contained in:
2025-03-24 15:44:57 +08:00
parent 33ed3bf960
commit 4fcc5286a1
3 changed files with 58 additions and 6 deletions

View File

@@ -248,6 +248,7 @@ trait OrderTrait
'id' => $key,
'spu_id' => $this->skuArr[$key]['spu_id'],
'is_add_staple_food' => $this->skuArr[$key]['is_add_staple_food'],
'meal_copies' => $this->skuArr[$key]['is_add_staple_food'] == GoodCode::IS_ADD_STAPLE_FOOD ? 0 : 1,
];
} else {
$oneCopiesGoodInfo[$key]['num'] += $oneGood;
@@ -265,11 +266,16 @@ trait OrderTrait
'price' => $oneCopiesTotalPrice,
];
// if ($copiesType == 1) {
// $this->orderRes['optional_copies']++;
// } else {
$this->orderRes['copies']++;
// }
// 加一份米饭不算份数
switch ($this->orderType) {
case OrderCode::ORDER_TYPE_OPTIONAL:
$this->orderRes['copies']++;
break;
case OrderCode::ORDER_TYPE_MEAL:
$this->orderRes['copies'] = $this->orderRes['copies'] + array_sum(array_column($oneCopiesGoodInfo,'meal_copies'));
break;
}
// if ($this->skuArr[$key]['is_add_staple_food'] != GoodCode::IS_ADD_STAPLE_FOOD) $this->orderRes['copies']++;
$this->orderRes['total_good_price'] = bcadd($this->orderRes['total_good_price'],$oneCopiesTotalPrice,2);
}