fix(workbench): 修复今日/昨日/最近七天订单金额未扣除退款金额的问题

- 在计算订单总金额时,增加了对退款金额的处理
- 使用 bcsub 函数精确计算支付金额和退款金额的差值
- 优化了数据计算逻辑,提高了报表数据的准确性
This commit is contained in:
mkm 2024-11-08 00:33:55 +08:00
parent 7c21a22f28
commit fd1cf9292f

View File

@ -70,7 +70,9 @@ class WorkbenchLogic extends BaseLogic
}
$orderLogic = new StoreOrderLogic();
//订单总金额
$data['order_amount'] = $orderLogic->storeOrderSumByDate($startTime, $endTime, $where);
$pay_price=$orderLogic->storeOrderSumByDate($startTime, $endTime, $where);
$refund_price=$orderLogic->storeOrderSumByDate($startTime, $endTime, $where,'refund_price');
$data['order_amount'] = bcsub($pay_price,$refund_price);
//余额支付总金额
$data['balance_amount'] = $orderLogic->storeOrderSumByDate($startTime, $endTime, array_merge($where, ['pay_type' => PayEnum::BALANCE_PAY]));
//微信条码支付总金额