Просмотр исходного кода

订单列表,统计栏数据,未根据筛选条件变动

sunxbiao 1 год назад
Родитель
Сommit
a5ebcd5370

+ 16 - 12
app/common/repositories/store/order/StoreOrderRepository.php

@@ -4632,34 +4632,34 @@ class StoreOrderRepository extends BaseRepository
4632 4632
         return compact('all', 'statusAll', 'unpaid', 'unshipped', 'untake', 'unevaluate', 'complete', 'refund', 'del');
4633 4633
     }
4634 4634
 
4635
-    public function adminOrderNumber($orderType = -1)
4635
+    public function adminOrderNumber($orderType = -1, $where = [])
4636 4636
     {
4637 4637
         $order_ids = input('order_ids', '');
4638
-//        $where['order_type'] = $orderType;
4638
+        //        $where['order_type'] = $orderType;
4639 4639
         //1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除
4640
-        $all = $this->dao->search(['order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
4640
+        $all = $this->dao->search(array_merge(['order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4641 4641
             $q->whereIn('order_id', $order_ids);
4642 4642
         })->count();
4643 4643
         $statusAll = $all;
4644
-        $unpaid = $this->dao->search(['paid' => 0, 'is_del' => 0, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
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) {
4645 4645
             $q->whereIn('order_id', $order_ids);
4646 4646
         })->count();
4647
-        $unshipped = $this->dao->search(['status' => 0, 'paid' => 1, 'is_del' => 0, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
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 4648
             $q->whereIn('order_id', $order_ids);
4649 4649
         })->count();
4650
-        $untake = $this->dao->search(['status' => 1, 'is_del' => 0, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
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 4651
             $q->whereIn('order_id', $order_ids);
4652 4652
         })->count();
4653
-        $unevaluate = $this->dao->search(['status' => 2, 'is_del' => 0, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
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 4654
             $q->whereIn('order_id', $order_ids);
4655 4655
         })->count();
4656
-        $complete = $this->dao->search(['status' => 3, 'is_del' => 0, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
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 4657
             $q->whereIn('order_id', $order_ids);
4658 4658
         })->count();
4659
-        $refund = $this->dao->search(['status' => -1, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
4659
+        $refund = $this->dao->search(array_merge(['status' => -1, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4660 4660
             $q->whereIn('order_id', $order_ids);
4661 4661
         })->count();
4662
-        $del = $this->dao->search(['is_del' => 1, 'order_type' => $orderType], null)->when($order_ids, function ($q) use ($order_ids) {
4662
+        $del = $this->dao->search(array_merge(['is_del' => 1, 'order_type' => $orderType], $where), null)->when($order_ids, function ($q) use ($order_ids) {
4663 4663
             $q->whereIn('order_id', $order_ids);
4664 4664
         })->count();
4665 4665
 
@@ -5026,7 +5026,11 @@ class StoreOrderRepository extends BaseRepository
5026 5026
         $banclPay = $query->where($this->getOrderType($status))->where('test_order', 0)->where('paid', 1)->where('pay_type', 0)->field('sum(pay_price) as pay_price')->find();
5027 5027
         $wechatpay = $query->where($this->getOrderType($status))->where('test_order', 0)->where('paid', 1)->where('pay_type', '<>', 0)->field('sum(pay_price) as pay_price')->find();
5028 5028
 
5029
+        $fzone_pay_price = 0.00;
5030
+        $fzone_pay_vr = 0.00;
5029 5031
         foreach ($list as $key => $item) {
5032
+            $fzone_pay_price = bcadd($fzone_pay_price, $item['fzone_pay_price'], 2);
5033
+            $fzone_pay_vr = bcadd($fzone_pay_vr, $item['fzone_pay_vr'], 2);
5030 5034
             if ($item['fzone_paytype']) {
5031 5035
                 $list[$key]['fzone_paytype'] = json_decode($item['fzone_paytype'], true);
5032 5036
                 if (!count($list[$key]['fzone_paytype'])) {
@@ -5037,8 +5041,8 @@ class StoreOrderRepository extends BaseRepository
5037 5041
             }
5038 5042
         }
5039 5043
 
5040
-        $list1[] = ['count' => 1753141, 'name' => '现金'];
5041
-        $list1[] = ['count' => 159977, 'name' => 'VR'];
5044
+        $list1[] = ['count' => $fzone_pay_price, 'name' => '现金'];
5045
+        $list1[] = ['count' => $fzone_pay_vr, 'name' => 'VR'];
5042 5046
         $stat = [
5043 5047
             [
5044 5048
                 'className' => 'el-icon-s-goods',

+ 2 - 1
app/controller/admin/order/Order.php

@@ -101,7 +101,8 @@ class Order extends BaseController
101 101
      */
102 102
     public function chart()
103 103
     {
104
-        return app('json')->success($this->repository->adminOrderNumber());
104
+        $where = $this->request->params(['type', 'date', 'mer_id','keywords','status','username','order_sn','order_ids']);
105
+        return app('json')->success($this->repository->adminOrderNumber(-1, $where));
105 106
     }
106 107
 
107 108
     /**