fix(admin): 修复仓库产品退货逻辑中的总价计算问题
- 优化了 WarehouseProductReturnLogic 中的总价计算逻辑 - 在更新商品数量后,同步更新订单总价和预订单支付价格 - 移除了冗余的异常捕获代码
This commit is contained in:
parent
23912039a5
commit
3166a06a56
@ -6,6 +6,7 @@ namespace app\admin\logic\warehouse_product_return;
|
||||
use app\common\model\warehouse_product_return\WarehouseProductReturn;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\beforehand_order\BeforehandOrder;
|
||||
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
|
||||
use app\common\model\warehouse_order\WarehouseOrder;
|
||||
use app\common\model\warehouse_product\WarehouseProduct;
|
||||
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||
@ -64,8 +65,11 @@ class WarehouseProductReturnLogic extends BaseLogic
|
||||
$total_price=bcmul($nums,$find['price'],2);
|
||||
}
|
||||
$find->save(['nums'=>$nums,'total_price'=>$total_price]);
|
||||
$total_price=WarehouseProduct::where('oid',$find['oid'])->sum('total_price');
|
||||
if($nums>0){
|
||||
$total_price=WarehouseProduct::where('oid',$find['oid'])->sum('total_price');
|
||||
WarehouseOrder::where(['id'=>$find['oid']])->update(['total_price'=>$total_price]);
|
||||
BeforehandOrder::update(['pay_price'=>$total_price],['id'=>$params['bhoid']]);
|
||||
}elseif($nums==0){
|
||||
WarehouseOrder::where(['id'=>$find['oid']])->update(['total_price'=>$total_price]);
|
||||
BeforehandOrder::update(['pay_price'=>$total_price],['id'=>$params['bhoid']]);
|
||||
}
|
||||
@ -80,7 +84,6 @@ class WarehouseProductReturnLogic extends BaseLogic
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
d($e);
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user