fix(store): 修复订单总金额计算逻辑

- 移除了订单查询条件中的 refund_status 筛选
- 优化了退款金额的计算逻辑,直接使用 $where 参数
- 删除了不必要的条件重置和额外变量声明
This commit is contained in:
mkm 2024-11-08 01:01:45 +08:00
parent 573ff9dc9d
commit e8dc53409a

View File

@ -53,7 +53,7 @@ class WorkbenchLogic extends BaseLogic
$endTime = $params['end_time'];
$endTime = date('Y-m-d', strtotime($endTime) + 86400);
$dateDiff = (new \DateTime($endTime))->diff(new \DateTime($startTime));
$where = ['paid' => 1,'refund_status'=>0];
$where = ['paid' => 1];
$userRechargeWhere = ['paid' => 1];
$cashFinanceWhere = [];
$storeFinanceWhere = ['financial_type'=>2,'financial_pm'=>1];
@ -71,9 +71,7 @@ class WorkbenchLogic extends BaseLogic
$orderLogic = new StoreOrderLogic();
//订单总金额
$pay_price=$orderLogic->storeOrderSumByDate($startTime, $endTime, $where);
unset($where['refund_status']);
$wheres=$where;
$refund_price=$orderLogic->storeOrderSumByDate($startTime, $endTime, $wheres,'refund_price');
$refund_price=$orderLogic->storeOrderSumByDate($startTime, $endTime, $where,'refund_price');
$data['order_amount'] = bcsub($pay_price,$refund_price,2);
//余额支付总金额
$data['balance_amount'] = $orderLogic->storeOrderSumByDate($startTime, $endTime, array_merge($where, ['pay_type' => PayEnum::BALANCE_PAY]));