Browse Source

订单列表-修改-列表

sunxbiao 1 year ago
parent
commit
8092842f8f
1 changed files with 17 additions and 15 deletions
  1. 17 15
      app/common/repositories/store/order/StoreOrderRepository.php

+ 17 - 15
app/common/repositories/store/order/StoreOrderRepository.php

@@ -4635,33 +4635,35 @@ class StoreOrderRepository extends BaseRepository
4635 4635
     public function adminOrderNumber($orderType = -1, $where = [])
4636 4636
     {
4637 4637
         $order_ids = input('order_ids', '');
4638
+        $where['order_type'] = $orderType;
4639
+
4638 4640
         //        $where['order_type'] = $orderType;
4639 4641
         //1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除
4640
-        $all = $this->dao->search(array_merge(['order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4642
+        $all = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4641 4643
             $q->whereIn('order_id', $order_ids);
4642 4644
         })->count();
4643 4645
         $statusAll = $all;
4644
-        $unpaid = $this->dao->search(array_merge(['paid' => 0, 'is_del' => 0, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4646
+        $unpaid = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4645 4647
             $q->whereIn('order_id', $order_ids);
4646
-        })->count();
4647
-        $unshipped = $this->dao->search(array_merge(['status' => 0, 'paid' => 1, 'is_del' => 0, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4648
+        })->where(['paid' => 0, 'is_del' => 0])->count();
4649
+        $unshipped = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4648 4650
             $q->whereIn('order_id', $order_ids);
4649
-        })->count();
4650
-        $untake = $this->dao->search(array_merge(['status' => 1, 'is_del' => 0, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4651
+        })->where(['status' => 0, 'paid' => 1, 'is_del' => 0])->count();
4652
+        $untake = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4651 4653
             $q->whereIn('order_id', $order_ids);
4652
-        })->count();
4653
-        $unevaluate = $this->dao->search(array_merge(['status' => 2, 'is_del' => 0, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4654
+        })->where(['status' => 1, 'is_del' => 0])->count();
4655
+        $unevaluate = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4654 4656
             $q->whereIn('order_id', $order_ids);
4655
-        })->count();
4656
-        $complete = $this->dao->search(array_merge(['status' => 3, 'is_del' => 0, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4657
+        })->where(['status' => 2, 'is_del' => 0])->count();
4658
+        $complete = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4657 4659
             $q->whereIn('order_id', $order_ids);
4658
-        })->count();
4659
-        $refund = $this->dao->search(array_merge(['status' => -1, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4660
+        })->where(['status' => 3, 'is_del' => 0])->count();
4661
+        $refund = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4660 4662
             $q->whereIn('order_id', $order_ids);
4661
-        })->count();
4662
-        $del = $this->dao->search(array_merge(['is_del' => 1, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4663
+        })->where(['status' => -1])->count();
4664
+        $del = $this->dao->search($where, null)->when($order_ids, function ($q) use ($order_ids) {
4663 4665
             $q->whereIn('order_id', $order_ids);
4664
-        })->count();
4666
+        })->where(['is_del' => 1])->count();
4665 4667
 
4666 4668
         return compact('all', 'statusAll', 'unpaid', 'unshipped', 'untake', 'unevaluate', 'complete', 'refund', 'del');
4667 4669
     }