Merge pull request 'feat(admin): 优化预售订单购物车信息逻辑' (#308) from dev into main

Reviewed-on: #308
This commit is contained in:
mkm 2024-11-06 16:23:09 +08:00
commit f26a037897

View File

@ -110,15 +110,17 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$find->save([ $find->save([
'price' => $params['purchases'], 'price' => $params['purchases'],
'total_price' => $total_price, 'total_price' => $total_price,
'pay_price' => $total_price,
'cart_num' => $params['nums'], 'cart_num' => $params['nums'],
'accept_num' => $params['nums'],
]); ]);
$bhoid = $params['bhoid']; $bhoid = $params['bhoid'];
$info = BeforehandOrderCartInfo::where('bhoid', $bhoid)->field('sum(cart_num) as cart_num,sum(total_price) as total_price')->find(); $info = BeforehandOrderCartInfo::where('bhoid', $bhoid)->field('sum(cart_num) as cart_num,sum(total_price) as total_price,sum(pay_price) as pay_price')->find();
if($find['is_buyer']==1){ if($find['is_buyer']==1){
PurchaseProductOffer::where('order_id',$bhoid)->where('product_id',$find['product_id'])->update(['need_num'=>$params['nums']]); PurchaseProductOffer::where('order_id',$bhoid)->where('product_id',$find['product_id'])->update(['need_num'=>$params['nums']]);
} }
$order=BeforehandOrder::where('id', $bhoid)->find(); $order=BeforehandOrder::where('id', $bhoid)->find();
$order->save(['total_price' => $info['total_price'], 'total_num' => $info['cart_num']]); $order->save(['total_price' => $info['total_price'],'pay_price' => $info['pay_price'], 'total_num' => $info['cart_num']]);
if($order['outbound_id']>0){ if($order['outbound_id']>0){
$wp= WarehouseProduct::where('oid',$order['outbound_id'])->where('product_id',$find['product_id'])->where('financial_pm',0)->find(); $wp= WarehouseProduct::where('oid',$order['outbound_id'])->where('product_id',$find['product_id'])->where('financial_pm',0)->find();