fix(admin): 修复订单修改时的权限和状态问题
- 增加了对订单已出库状态的检查,防止修改已出库订单 - 调整了权限检查逻辑,只允许特定管理员编辑价格 - 优化了订单总价和数量的计算逻辑 - 移除了重复的订单查询代码
This commit is contained in:
parent
198e5e2a78
commit
81c766a2f1
@ -111,6 +111,11 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
if($params['admin_id']==23&&$params['purchases']!=$find['price'] ){
|
||||
throw new BusinessException('当前账号没有权限编辑价格, 请联系管理员修改');
|
||||
}
|
||||
$bhoid = $params['bhoid'];
|
||||
$order=BeforehandOrder::where('id', $bhoid)->find();
|
||||
if($order['outbound_id']>0){
|
||||
throw new BusinessException('该订单已出库,不能修改');
|
||||
}
|
||||
if($params['total_price']<=0){
|
||||
$total_price=bcmul($params['purchases'],$params['nums'],2);
|
||||
}else{
|
||||
@ -124,12 +129,10 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
'accept_num' => $params['nums'],
|
||||
'mark' => $params['mark']??'',
|
||||
]);
|
||||
$bhoid = $params['bhoid'];
|
||||
$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){
|
||||
PurchaseProductOffer::where('order_id',$bhoid)->where('product_id',$find['product_id'])->update(['need_num'=>$params['nums']]);
|
||||
}
|
||||
$order=BeforehandOrder::where('id', $bhoid)->find();
|
||||
$order->save(['total_price' => $info['total_price'],'pay_price' => $info['pay_price'], 'total_num' => $info['cart_num']]);
|
||||
|
||||
if($order['outbound_id']>0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user