From 470740b8da3fbfe13fab8ecc8e816072ad3c6aee Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 23 Aug 2023 17:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=AA=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=95=B0=E5=8F=8A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderRepository.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 3a9acc52..89138531 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -589,7 +589,7 @@ class StoreOrderRepository extends BaseRepository if ($product_type == 98) { $isUser = 0; } - $noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); + $noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $noPostage = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(2))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $noDeliver = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(3))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); @@ -849,7 +849,7 @@ class StoreOrderRepository extends BaseRepository //1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除 8: 已支付 $all = $this->dao->search($where, $sysDel)->where($this->getOrderType(0))->count(); $statusAll = $all; - $unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count(); + $unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count(); $unshipped = $this->dao->search($where, $sysDel)->where($this->getOrderType(2))->count(); $untake = $this->dao->search($where, $sysDel)->where($this->getOrderType(3))->count(); $unevaluate = $this->dao->search($where, $sysDel)->where($this->getOrderType(4))->where('paid', 1)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY)->count(); @@ -1545,7 +1545,7 @@ class StoreOrderRepository extends BaseRepository $query->where('paid', 1)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY); }) ->when($status == 1, function ($query) { - $query->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)"); + $query->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)"); }) ->with([ 'orderProduct', @@ -1726,7 +1726,13 @@ class StoreOrderRepository extends BaseRepository { $status = $where['status'] ?? ''; unset($where['status']); - $query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0); + // 未支付订单 + if ($status == 1) { + $query = $this->dao->search($where)->where($this->getOrderType($status))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('StoreOrder.is_del', 0); + } else { + $query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0); + } + $count = $query->count(); $list = $query->with([ 'orderProduct',