wang jun 2 lat temu
rodzic
commit
a50d2b0be1

+ 16 - 0
application/admin/controller/Meal.php

@@ -245,4 +245,20 @@ class Meal extends Controller
             return backjson2(200, $result['msg']);
         }
     }
+    /**
+     * 根据id获取信息
+     *
+     * @return void
+     * @author wj
+     * @date 2023-02-01
+     */
+    public function getmealcenterinfobyid(){
+        $post = request()->post();
+        $l_m = new MealLogic();
+        $result = $l_m->getmealcenterinfobyid($post);
+        if (empty($result['status'])) {
+            return backjson2(0, $result['msg']);
+        }
+        return backjson2(200, $result['msg'], $result['data']);
+    }
 }

+ 6 - 6
application/admin/logic/visitlogic.php

@@ -29,36 +29,36 @@ class visitlogic
     public function getlist($arr)
     {
         $userinfo = checkToken();
-        $wherefield = ['name', 'telno'];
+        $wherefield = ['name', 'telno', 'name_center'];
         $where = [];
         foreach ($wherefield as $key => $value) {
             if (isset($arr[$value]) && !empty($arr[$value])) {
-                $where[] = [$value, 'like', '%' . $arr[$value] . '%'];
+                $where[$value] = $arr[$value];
             }
         }
         $wherefield2 = ['is_member', 'business_type'];
         foreach ($wherefield2 as $key => $value) {
             if (isset($arr[$value]) && is_numeric($arr[$value])) {
-                $where[] = [$value, '=', $arr[$value]];
+                $where[$value] = $arr[$value];
             }
         }
         if (isset($arr['createtime'])) {
             if (is_array($arr['createtime'])
                 && !empty(array_filter($arr['createtime']))
                 && $arr['createtime'] = array_filter($arr['createtime'])) {
-                $where[] = ['createtime', 'between', $arr['createtime']];
+                $where['createtime'] = $arr['createtime'];
             }
         }
         $page = isset($arr['page']) && is_numeric($arr['page']) && !empty($arr['page']) && $arr['page'] > 0 ? $arr['page'] : 1;
         $size = isset($arr['size']) && is_numeric($arr['size']) && !empty($arr['size']) && $arr['size'] > 0 ? $arr['size'] : 10;
         $m_v = new VisitModel();
-        $count = $m_v->getList($where, 'count');
+        $count = $m_v->getListjoinmealcenter($where, 'count');
         if ($count <= 0) {
             return backarr(0, "无数据");
         }
         $totalpage = ceil($count / $size);
         $page > $totalpage && $page = $totalpage;
-        $list = $m_v->getList($where, "*", $page, $size)->toArray();
+        $list = $m_v->getListjoinmealcenter($where, "*", $page, $size)->toArray();
         $m_vbt = new VisitBusinessTypeModel();
         $tylist = $m_vbt->getList([], "*", 1, 0, "id asc");
         if (!empty($tylist)) {

+ 5 - 0
application/api/logic/StatisticsLogic.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\api\logic;
 
+use app\common\model\AppointmentModel;
 use app\common\model\MealcenterModel;
 use app\common\model\MealOrdersModel;
 use app\common\model\serverappointmentmodel;
@@ -16,6 +17,8 @@ class StatisticsLogic
         $m_mo = new MealOrdersModel();
         $m_v = new VisitModel();
         $m_sa = new serverappointmentmodel();
+        $m_a = new AppointmentModel();
+
         $where = [];
         $count = $m_mc->getList($where, 'count');
         if ($count <= 0) {
@@ -26,9 +29,11 @@ class StatisticsLogic
             $mocount = $m_mo->getList(['center_id' => $value['id']], 'count');
             $vcount = $m_v->getList(['center_id' => $value['id']], 'count');
             $sacount = $m_sa->getList(['center_id' => $value['id']], 'count');
+            $acount = $m_a->getList(['center_id' => $value['id']], 'count');
             $value['mocount'] = empty($mocount) ? 0 : $mocount;
             $value['vcount'] = empty($vcount) ? 0 : $vcount;
             $value['sacount'] = empty($sacount) ? 0 : $sacount;
+            $value['acount'] = empty($acount) ? 0 : $acount;
             $list[$key] = $value;
         }
         $restunData = [

+ 40 - 0
application/common/model/VisitModel.php

@@ -70,4 +70,44 @@ class VisitModel extends Model
         }
         return $data;
     }
+    public function getListjoinmealcenter($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
+    {
+        $usewhere = [];
+        if (isset($where['createtime'])) {
+            $usewhere[] = ['v.createtime', 'between', $where['createtime']];
+        }
+        if (isset($where['name']) && !empty($where['name'])) {
+            $usewhere['v.name'] = ['like', "%" . $where['name'] . "%"];
+        }
+        if (isset($where['name_center']) && !empty($where['name_center'])) {
+            $usewhere['mc.name_center'] = ['like', "%" . $where['name_center'] . "%"];
+        }
+        if (isset($where['telno']) && !empty($where['telno'])) {
+            $usewhere['v.telno'] = ['like', "%" . $where['telno'] . "%"];
+        }
+        if (isset($where['is_member'])) {
+            $usewhere['v.is_member'] = $where['is_member'];
+        }
+        if (isset($where['business_type'])) {
+            $usewhere['v.business_type'] = $where['business_type'];
+        }
+        if (isset($where['status_delivery'])) {
+            $usewhere['mo.status_delivery'] = $where['status_delivery'];
+        }
+        $sqlObj = $this->alias('v')->join("t_mealcenter mc", "mc.id=v.center_id")->where($usewhere);
+        if ("count" != $field) {
+            if ("*" == $field) {
+                $field = ['v.*', 'mc.name_center'];
+            }
+            $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
+            if ($row) {
+                $data = $sqlObj->find();
+            } else {
+                $data = $sqlObj->select();
+            }
+        } else {
+            $data = $sqlObj = $sqlObj->count();
+        }
+        return $data;
+    }
 }

+ 1 - 0
application/index/view/index/mealcenterlist.html

@@ -77,6 +77,7 @@
                 <el-table-column prop="mocount" label="套餐订单量"></el-table-column>
                 <el-table-column prop="sacount" label="家政服务订单量"></el-table-column>
                 <el-table-column prop="vcount" label="到访量"></el-table-column>
+                <el-table-column prop="acount" label="常规业务量"></el-table-column>
             </el-table>
             <div class="block">
                 <el-pagination