diff --git a/app/common/dao/store/order/StoreGroupOrderDao.php b/app/common/dao/store/order/StoreGroupOrderDao.php index 1f68e380..00ccba01 100644 --- a/app/common/dao/store/order/StoreGroupOrderDao.php +++ b/app/common/dao/store/order/StoreGroupOrderDao.php @@ -48,7 +48,7 @@ class StoreGroupOrderDao extends BaseDao $storeOrderWhere = StoreOrder::where('activity_type', $productType); return StoreGroupOrder::hasWhere('orderList', $storeOrderWhere)->when($uid, function ($query, $uid) { $query->where('StoreGroupOrder.uid', $uid); - })->where('StoreGroupOrder.is_del', 0)->whereRaw("StoreGroupOrder.paid=0 or (StoreGroupOrder.paid=1 and StoreGroupOrder.pay_type=8)")->count(); + })->where('StoreGroupOrder.is_del', 0)->whereRaw("StoreGroupOrder.paid=0 or (StoreGroupOrder.paid=1 and StoreGroupOrder.pay_type=8 and StoreOrder.status=2)")->count(); } /** diff --git a/app/common/repositories/store/order/StoreGroupOrderRepository.php b/app/common/repositories/store/order/StoreGroupOrderRepository.php index c84e7547..39121df4 100644 --- a/app/common/repositories/store/order/StoreGroupOrderRepository.php +++ b/app/common/repositories/store/order/StoreGroupOrderRepository.php @@ -70,7 +70,7 @@ class StoreGroupOrderRepository extends BaseRepository } $query->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) { if ($where['paid'] == 0) { - $query->whereRaw("StoreGroupOrder.paid=0 or (StoreGroupOrder.paid=1 and StoreGroupOrder.pay_type=8)"); + $query->whereRaw("StoreGroupOrder.paid=0 or (StoreGroupOrder.paid=1 and StoreGroupOrder.pay_type=8 and StoreOrder.status=2)"); } else { $query->where('StoreGroupOrder.paid', $where['paid']); } @@ -128,14 +128,11 @@ class StoreGroupOrderRepository extends BaseRepository if (empty($order)) { throw new DataNotFoundException('订单不存在或已取消'); } - $return = $order->toArray(); if (!empty($order->interest)) { $interest = $order->interest->calculateInterest(); - $return['interest']['total_amount'] = bcadd($order->interest->total_price, $interest, 2); - } else { - $return['interest']['total_amount'] = $order['total_price']; + $order->interest->total_amount = bcadd($order->interest->total_price, $interest, 2); } - return $return; + return $order; } public function status($uid, $id)