fix(admin): 修复已出库订单修改价格的问题

- 在同步价格前增加出库状态检查
- 如果订单已出库,则抛出业务异常,禁止修改价格
- 优化查询逻辑,去除不必要的 price 条件
This commit is contained in:
mkm 2025-02-03 13:52:06 +08:00
parent 81c766a2f1
commit a6c386a298

View File

@ -320,7 +320,11 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
public static function syncPrice($params)
{
$cartInfo = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->where('price', 0)->select()->toArray();
$outbound_id=BeforehandOrder::where('id', $params['bhoid'])->value('outbound_id');
if($outbound_id>0){
throw new BusinessException('该订单已出库,不能修改');
}
$cartInfo = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select()->toArray();
$productIds = array_column($cartInfo, 'product_id');
$products = StoreProduct::whereIn('id', $productIds)->select()->toArray();
$products = reset_index($products, 'id');