Browse Source

前端报表,无地址待发货订单增加筛选项

wufeng 2 years ago
parent
commit
832d7fafd8
1 changed files with 26 additions and 8 deletions
  1. 26 8
      app/admin/controller/SaleReport.php

+ 26 - 8
app/admin/controller/SaleReport.php

@@ -1392,11 +1392,13 @@ class SaleReport extends Base
     //【八、无地址待发货订单】
     public function orderOutNotAddr()
     {
+        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'start_sendtime' => '', 'end_sendtime' => '', 'status' => '', 'apply_company' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
 
-        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
-
-        $where = [['b.send_type', '=', 2]];//send_type==2 延迟发货
+        $where = [['b.is_del', '=', 0], ['b.send_type', '=', 2]];//send_type==2 延迟发货
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['a.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
+        if ($param['start_sendtime'] != '' && $param['end_sendtime'] != '') $where[] = ['a.sendtime', 'between', [$param['start_sendtime'] . ' 00:00:00', $param['end_sendtime'] . ' 23:59:59']];
+        if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['apply_company'] != '') $where[] = ['ci.name', 'like', '%' . $param['apply_company'] . '%'];
 
         $count = Db::name('order_out')
             ->alias('a')
@@ -1404,6 +1406,8 @@ class SaleReport extends Base
             ->leftJoin("customer_info v", "v.companyNo=b.customer_code")
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("business bus", "bus.companyNo=b.supplierNo")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
             ->where($where)
             ->order("a.addtime desc")
             ->count('a.id');
@@ -1415,6 +1419,8 @@ class SaleReport extends Base
             ->leftJoin("customer_info v", "v.companyNo=b.customer_code")
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("business bus", "bus.companyNo=b.supplierNo")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
             ->where($where)
             ->page($param['page'], $param['size'])
             ->order("a.addtime desc")
@@ -1435,7 +1441,7 @@ class SaleReport extends Base
                     ->alias('a')
                     ->field('a.id,b.cat_id,b.customized')
                     ->join('good b', 'b.spuCode=a.spuCode', 'left')
-                    ->where(['a.skuCode' => $value['skuCode']])
+                    ->where(['a.is_del' => 0, 'a.skuCode' => $value['skuCode']])
                     ->find();
             }
 
@@ -1454,10 +1460,13 @@ class SaleReport extends Base
     public function orderOutNotAddrExport()
     {
 
-        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => ''], 'post', 'trim');
+        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'start_sendtime' => '', 'end_sendtime' => '', 'status' => '', 'apply_company' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
 
-        $where = [['b.send_type', '=', 2]];//send_type==2 延迟发货
+        $where = [['b.is_del', '=', 0], ['b.send_type', '=', 2]];//send_type==2 延迟发货
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['a.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
+        if ($param['start_sendtime'] != '' && $param['end_sendtime'] != '') $where[] = ['a.sendtime', 'between', [$param['start_sendtime'] . ' 00:00:00', $param['end_sendtime'] . ' 23:59:59']];
+        if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['apply_company'] != '') $where[] = ['ci.name', 'like', '%' . $param['apply_company'] . '%'];
 
         $data = Db::name('order_out')
             ->alias('a')
@@ -1466,9 +1475,17 @@ class SaleReport extends Base
             ->leftJoin("customer_info v", "v.companyNo=b.customer_code")
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("business bus", "bus.companyNo=b.supplierNo")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
             ->where($where)
             ->order("a.addtime desc")
-            ->cursor();
+            ->select()
+            ->toArray();
+//            ->cursor();
+//halt($data);
+
+        
+
 
         $list = [];
         foreach ($data as $value) {
@@ -1480,12 +1497,13 @@ class SaleReport extends Base
                     ->field('id,cat_id,customized')
                     ->where(["spuCode" => $value['商品编码'], "is_del" => 0])
                     ->find();
+
             } else {
                 $goon = Db::name('good_platform')
                     ->alias('a')
                     ->field('a.id,b.cat_id,b.customized')
                     ->join('good b', 'b.spuCode=a.spuCode', 'left')
-                    ->where(['a.skuCode' => $value['skuCode']])
+                    ->where(['a.is_del' => 0, 'a.skuCode' => $value['skuCode']])
                     ->find();
             }