فهرست منبع

fix:
- 预约记录
- 号源管理

zzb 2 سال پیش
والد
کامیت
8a79c899c8

+ 47 - 38
app/admin/controller/Appointment.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\admin\controller\base\Permissions;
-use think\Db;
+use app\common\model\Appointment as appointmentModel;
 
 class Appointment extends Permissions
 {
@@ -86,7 +86,7 @@ class Appointment extends Permissions
             $validate = new \think\Validate([
                 ['title|服务名称', 'max:50'],
                 ['provider_id', 'require|number'],
-//                ['phone|咨询电话', 'require|max:50'],
+//                ['phone|咨询电话', 'max:50'],
                 ['start_time', 'number', '排号日期格式不对'],
                 ['end_time', 'number', '排号日期格式不对'],
                 ['morning_num|上午放号个数', 'number'],
@@ -108,26 +108,35 @@ class Appointment extends Permissions
 
         if ($id > 0) {
             //修改
-            $data = $model->where('id', $id)->find();
-            if (empty($data)) {
-                $this->error('id不正确');
-            }
-            if ($this->request->isPost()) {
-                if (false == $model->allowField(true)->save($post, ['id' => $id])) {
-                    $this->error('修改失败');
-                } else {
-                    $this->success('修改成功', 'index', ['pid' => $pid]);
-                }
-            } else {
-                $this->assign('data', $data);
-                return $this->fetch();
-            }
+//            $data = $model->where('id', $id)->find();
+//            if (empty($data)) {
+//                $this->error('id不正确');
+//            }
+//            if ($this->request->isPost()) {
+//                if (false == $model->allowField(true)->save($post, ['id' => $id])) {
+            $this->error('修改失败');
+//                } else {
+//                    $this->success('修改成功', 'index', ['pid' => $pid]);
+//                }
+//            } else {
+//                $this->assign('data', $data);
+//                return $this->fetch();
+//            }
         } else {
             //新增
             if ($this->request->isPost()) {
+
+                //判断是否存在排号
+                $exits = (new \app\common\model\AppointmentTicket())->where(['provider_id' => $pid, 'appointment_daytime' => [['>=', $post['start_time']], ['<=', $post['end_time']]]])->count();
+                if ($exits > 0) {
+                    $this->error('该时间跨度内,已存在排号,请重新选择时间');
+                }
+
                 if (false == $model->allowField(true)->save($post)) {
                     $this->error('添加失败');
                 } else {
+                    //生成号源
+                    appointmentModel::createTicketFromAllAppointment();
                     $this->success('添加成功', 'index', ['pid' => $pid]);
                 }
             } else {
@@ -136,27 +145,27 @@ class Appointment extends Permissions
         }
     }
 
-    public function delete()
-    {
-        if ($this->request->isAjax()) {
-            $id = $this->request->param('id', 0, 'intval');
-            if (false == $this->getModel()->where('id', $id)->delete()) {
-                $this->error('删除失败');
-            } else {
-                $this->success('删除成功', 'index');
-            }
-        }
-    }
-
-    public function deletes()
-    {
-        if ($this->request->isAjax()) {
-            $post = $this->request->param();
-            $ids = $post['ids'];
-            if ($this->getModel()->where('id', 'in', $ids)->delete()) {
-                $this->success('删除成功');
-            }
-        }
-    }
+//    public function delete()
+//    {
+//        if ($this->request->isAjax()) {
+//            $id = $this->request->param('id', 0, 'intval');
+//            if (false == $this->getModel()->where('id', $id)->delete()) {
+//                $this->error('删除失败');
+//            } else {
+//                $this->success('删除成功', 'index');
+//            }
+//        }
+//    }
+//
+//    public function deletes()
+//    {
+//        if ($this->request->isAjax()) {
+//            $post = $this->request->param();
+//            $ids = $post['ids'];
+//            if ($this->getModel()->where('id', 'in', $ids)->delete()) {
+//                $this->success('删除成功');
+//            }
+//        }
+//    }
 
 }

+ 12 - 19
app/admin/controller/AppointmentApplication.php

@@ -54,7 +54,11 @@ class AppointmentApplication extends Permissions
             $model = $this->getModel();
             $count = $model->where($where)->count();
             $data = $model->where($where)->page($post['page']??0, $post['limit']??15)->order('id desc')->select();
-
+            foreach ($data as $key => $value) {
+                $value['sex_text'] = $value->sex_text;
+                $value['status_text'] = $value->status_text;
+                $data[$key] = $value;
+            }
             return array('code' => 0, 'count' => $count, 'data' => $data);
         } else {
             return $this->fetch();
@@ -100,27 +104,16 @@ class AppointmentApplication extends Permissions
         }
     }
 
-    public function delete()
-    {
-        if ($this->request->isAjax()) {
-            $id = $this->request->param('id', 0, 'intval');
-            if (false == $this->getModel()->where('id', $id)->delete()) {
-                $this->error('删除失败');
-            } else {
-                $this->success('删除成功', 'index');
-            }
-        }
-    }
 
-    public function deletes()
+    public function status()
     {
-        if ($this->request->isAjax()) {
-            $post = $this->request->param();
-            $ids = $post['ids'];
-            if ($this->getModel()->where('id', 'in', $ids)->delete()) {
-                $this->success('删除成功');
+        if ($this->request->isPost()) {
+            $post = $this->request->post();
+            if (false == Db::name('appointment_application')->where('id', $post['id'])->update(['status' => $post['status'],'finish_time'=>time()])) {
+                $this->error('设置失败');
+            } else {
+                $this->success('设置成功', 'index');
             }
         }
     }
-
 }

+ 134 - 0
app/admin/controller/AppointmentTicket.php

@@ -0,0 +1,134 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\controller\base\Permissions;
+use think\Db;
+
+class AppointmentTicket extends Permissions
+{
+    private function getModel()
+    {
+        return new \app\common\model\AppointmentTicket();
+    }
+
+    public function index()
+    {
+        $pid = $this->request->param('pid', 0, 'intval');
+        if ($this->request->isAjax()) {
+            $post = $this->request->param();
+            $where = [
+                'provider_id' => $pid
+            ];
+            if (isset($post['ids']) and !empty($post['ids'])) {
+                $where['id'] = ['in', $post['ids']];
+            }
+            if (isset($post["appointment_id"]) and "" != $post["appointment_id"]) {
+                $where["appointment_id"] = $post["appointment_id"];
+            }
+            if (isset($post["appointment_daytime"]) and !empty($post["appointment_daytime"])) {
+                $timerang = explode(' - ', $post["appointment_daytime"]);
+                $min_time = strtotime($timerang[0]);
+                $max_time = $timerang[0] == $timerang[1] ? $min_time + 24 * 3600 - 1 : strtotime($timerang[1]??'');
+                $where["appointment_daytime"] = [['>=', $min_time], ['<=', $max_time]];
+            }
+            if (isset($post["provider_id"]) and "" != $post["provider_id"]) {
+                $where["provider_id"] = $post["provider_id"];
+            }
+            if (isset($post["address_id"]) and "" != $post["address_id"]) {
+                $where["address_id"] = $post["address_id"];
+            }
+            if (isset($post["morning_use"]) and "" != $post["morning_use"]) {
+                $where["morning_use"] = $post["morning_use"];
+            }
+            if (isset($post["afternoon_use"]) and "" != $post["afternoon_use"]) {
+                $where["afternoon_use"] = $post["afternoon_use"];
+            }
+            if (isset($post["night_use"]) and "" != $post["night_use"]) {
+                $where["night_use"] = $post["night_use"];
+            }
+
+            $model = $this->getModel();
+            $count = $model->where($where)->count();
+            $data = $model->where($where)->page($post['page']??0, $post['limit']??15)->order('appointment_daytime desc')->select();
+            foreach ($data as $key => $value) {
+                $value['specialist_name'] = $value->specialist->name;
+                $data[$key] = $value;
+            }
+            return array('code' => 0, 'count' => $count, 'data' => $data);
+        } else {
+            return $this->fetch();
+        }
+    }
+
+
+    public function publish()
+    {
+        $id = $this->request->param('id', 0, 'intval');
+        $model = $this->getModel();
+        $post = $this->request->post();
+        if ($this->request->isPost()) {
+
+            if (isset($post['appointment_daytime']) && !empty($post['appointment_daytime'])) {
+                $post['appointment_daytime'] = strtotime($post['appointment_daytime']);
+            }
+
+            //验证
+            $validate = new \think\Validate([
+                ['appointment_id|放号配置', 'require|number'],
+                ['appointment_daytime|排号日期', 'require|number'],
+                ['provider_id|服务人id', 'require|number'],
+                ['address_id|地址id', 'number'],
+                ['morning_use|上午报名个数', 'number'],
+                ['afternoon_use|中午报名个数', 'number'],
+                ['night_use|晚上报名个数', 'number'],
+            ]);
+            if (!$validate->check($post)) {
+                $this->error('提交失败:' . $validate->getError());
+            }
+        }
+
+        if ($id > 0) {
+            //修改
+            $data = $model->where('id', $id)->find();
+            if (empty($data)) {
+                $this->error('id不正确');
+            }
+            if ($this->request->isPost()) {
+                if (false == $model->allowField(true)->save($post, ['id' => $id])) {
+                    $this->error('修改失败');
+                } else {
+                    $this->success('修改成功');
+                }
+            } else {
+                $this->assign('data', $data);
+                return $this->fetch();
+            }
+        } else {
+        }
+    }
+
+    public function delete()
+    {
+        if ($this->request->isAjax()) {
+            $id = $this->request->param('id', 0, 'intval');
+            if (false == $this->getModel()->where('id', $id)->delete()) {
+                $this->error('删除失败');
+            } else {
+                $this->success('删除成功', 'index');
+            }
+        }
+    }
+
+    public function deletes()
+    {
+        if ($this->request->isAjax()) {
+            $post = $this->request->param();
+            $ids = $post['ids'];
+            if ($this->getModel()->where('id', 'in', $ids)->delete()) {
+                $this->success('删除成功');
+            }
+        }
+    }
+
+}

+ 11 - 2
app/admin/view/appointment/publish.html

@@ -34,7 +34,7 @@
 
     <div class="layui-tab">
         <ul class="layui-tab-title">
-            <li><a href="{:url('index',['pid'=>$Request.param.pid])}" class="a_menu">列表</a></li>
+            <li><a href="{:url('admin/appointment_ticket/index',['pid'=>$Request.param.pid])}" class="a_menu">列表</a></li>
             <li class="layui-this">{empty name="$data"}新增{else/}修改{/empty}</li>
         </ul>
     </div>
@@ -111,6 +111,15 @@
         <!--</div>-->
 
 
+        <div class="layui-form-item">
+        <label class="layui-form-label">服务价格</label>
+        <div class="layui-input-inline" style="max-width:300px;">
+        <input name="price" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input"
+        type="text" value="{notempty name="$data"}{$data.price}{/notempty}">
+        </div>
+        <div class="layui-form-mid layui-word-aux">必填</div>
+        </div>
+
 
         <input type="hidden" name="pid" value="{$Request.param.pid}">
 
@@ -143,7 +152,7 @@
                         success: function (res) {
                             if (res.code == 1) {
                                 layer.alert(res.msg, function (index) {
-                                    location.href = res.url + "?pid=" + res.data.pid;
+                                    location.href = "{:url('admin/appointment_ticket/index')}?pid=" + res.data.pid;
                                 })
                             } else {
                                 layer.msg(res.msg);

+ 111 - 65
app/admin/view/appointment_application/index.html

@@ -36,19 +36,14 @@
         </ul>
     </div>
 
-    <script type="text/html" id="toolbarDemo">
-        <div class="layui-btn-container">
-            <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="deletes">批量删除</button>
-        </div>
-    </script>
 
     <form class="layui-form serch" action="index" method="post">
         <div class="layui-form-item" style="float: left;">
 
-            <div class="layui-input-inline">
-                <input type="text" name="ids" autocomplete="off" placeholder="请输入ID,多个id逗号分隔"
-                       class="layui-input layui-btn-sm">
-            </div>
+            <!--<div class="layui-input-inline">-->
+                <!--<input type="text" name="ids" autocomplete="off" placeholder="请输入ID,多个id逗号分隔"-->
+                       <!--class="layui-input layui-btn-sm">-->
+            <!--</div>-->
             <div class="layui-input-inline">
                 <input type="text" name="name" autocomplete="off" placeholder="姓名(模糊搜索)"
                        class="layui-input layui-btn-sm">
@@ -98,16 +93,36 @@
 
     <script type="text/html" id="barDemo">
         <div class="layui-btn-group">
+            <button class="layui-btn layui-btn-xs delete" lay-event="view"><i class="layui-icon"
+                                                                              style="margin-right: 0;">&#xe622;</i></button>
             <button class="layui-btn layui-btn-xs a_menu" lay-event="edit"><i class="layui-icon"
                                                                               style="margin-right: 0;"></i></button>
-            <button class="layui-btn layui-btn-xs delete" lay-event="del"><i class="layui-icon"
-                                                                             style="margin-right: 0;"></i></button>
         </div>
     </script>
 
     <table class="layui-table" id="table" lay-filter="table"></table>
     {include file="public/foot"}
 
+
+    <form id="myForm" style="display:none;margin: 10px 30px;" class="layui-form alert-form">
+        <table class="layui-table">
+            <colgroup>
+                <col width="100">
+                <col width="200">
+            </colgroup>
+            <tbody id="mytable">
+            <!--<tr>-->
+                <!--<td>贤心</td>-->
+                <!--<td>2016-11-29</td>-->
+            <!--</tr>-->
+            <!--<tr>-->
+                <!--<td>许闲心</td>-->
+                <!--<td>2016-11-28</td>-->
+            <!--</tr>-->
+            </tbody>
+        </table>
+    </form>
+
     <script type="text/javascript">
         layui.use(['table', 'layer', 'form', 'laydate'], function () {
             var table = layui.table,
@@ -126,24 +141,56 @@
                 , page: true //开启分页
                 , cols: [[ //表头
                     {type: 'checkbox'},
-
                     {field: 'id', title: 'ID', width: 60},
-                    {field: "name", title: '姓名'},
-                    {field: "sex", title: '性别'},
-                    {field: "phone", title: '电话'},
+                    {field: "name", title: '姓名', width: 90},
+                    {field: "phone", title: '电话', width: 120},
                     {field: "problem_desc", title: '问题描述'},
                     {field: "requirement_desc", title: '需求描述'},
                     {field: "appointment_time", title: '预约时间段'},
-                    {field: "status", title: '订单状态'},
                     {field: "remark", title: '备注'},
                     {field: "create_time", title: '下单时间'},
-                    {field: "finish_time", title: '完成时间'},
-                    {field: 'action', title: '操作', toolbar: '#barDemo', fixed: 'right'}
+                    {field:'status',title:'订单状态', width: 80, templet:function (row) {
+                        if (row.finish_time == 0) {
+                            return '<span class="layui-badge status" style="background-color: #8FCDA0" data-id="' + row.id + '">' + row.status_text + '</span>';
+                        }
+                        return '<span class="layui-badge layui-bg-gray">' + row.status_text + '</span>';
+                    }},
+                    {field: 'action', title: '操作', toolbar: '#barDemo', fixed: 'right' ,align: 'center',width:110}
                 ]],
                 done: function () {
-                    if (isExitsFunction('showThumb')) {
-                        showThumb()
-                    }
+                    $('.status').click(function () {
+                        var id = $(this).attr('data-id');
+                        layer.msg('修改订单状态', {
+                            time: 20000,
+                            btn: ['已签到', '已爽约', '再想想'],
+                            yes: function (index, layero) {
+                                $.ajax({
+                                    url: "{:url('status')}",
+                                    type: 'post',
+                                    dataType: 'json', data: {id: id, status: '1'},
+                                    success: function (res) {
+                                        layer.msg(res.msg);
+                                        if (res.code == 1) {
+                                            table.reload('table');
+                                        }
+                                    }
+                                })
+                            },
+                            btn2: function (index, layero) {
+                                $.ajax({
+                                    url: "{:url('status')}",
+                                    type: 'post',
+                                    dataType: 'json', data: {id: id, status: '2'},
+                                    success: function (res) {
+                                        layer.msg(res.msg);
+                                        if (res.code == 1) {
+                                            table.reload('table');
+                                        }
+                                    }
+                                })
+                            }
+                        })
+                    })
                 }
             });
 
@@ -193,56 +240,55 @@
                     window.parent.tab.tabAdd({
                         icon: "fa-bookmark",
                         id: "tplay_appointment_application" + obj.data.id,
-                        title: obj.data.title == null ? "预约记录" + obj.data.id : obj.data.title,
+                        title: "预约记录:" + obj.data.name,
                         url: "/admin/appointment_application/publish?id=" + obj.data.id
                     });
                 }
-                else if (obj.event == 'del') {
-                    layer.confirm('确定要删除?', function (index) {
-                        $.ajax({
-                            url: "{:url('delete')}",
-                            dataType: 'json',
-                            data: {id: obj.data.id},
-                            success: function (res) {
-                                layer.msg(res.msg);
-                                if (res.code == 1) {
-                                    table.reload('table');
-                                }
-                            }
-                        })
-                    })
-                }
-            });
-            //监听事件
-            table.on('toolbar(table)', function (obj) {
-                if (obj.event == 'deletes') {
-                    var checkStatus = table.checkStatus(obj.config.id);//获取选中的数据
-                    var data = checkStatus.data;
-                    if (data.length > 0) {
-                        var ids = [];//数组
-                        data.forEach(function (item, key) {
-                            ids[key] = item.id;
-                        })
-                        layer.confirm('是否删除?', function (index, layero) {
-                            $.ajax({
-                                url: "{:url('deletes')}",
-                                dataType: 'json',
-                                data: {"ids": ids},
-                                type: 'post',
-                                success: function (res) {
-                                    layer.msg(res.msg);
-                                    if (res.code == 1) {
-                                        table.reload('table');
-                                    }
-                                }
-                            })
-                            layer.close(index)
-                        });
-                    } else {
-                        layer.msg('请先勾选需要操作的记录');
+                else if (obj.event == 'view') {
+
+                    var fromdata = {
+                        "姓名":obj.data.name,
+                        "性别":obj.data.sex_text,
+                        "年龄":obj.data.age,
+                        "出生年月":obj.data.birthday,
+                        "电话":obj.data.phone,
+                        "身份证":obj.data.id_card,
+                        "子女数量":obj.data.childs_num,
+                        "问题描述":obj.data.problem_desc,
+                        "需求描述":obj.data.requirement_desc,
+                        "预约时间段": obj.data.appointment_time,
+                        "订单状态" : obj.data.status_text,
+                        "备注" :obj.data.remark,
+                        "下单时间":obj.data.create_time,
+                        "完成时间":obj.data.finish_time,
+                    };
+
+                    var html = "";
+                    for (var val in fromdata) {
+                        html += "<tr><td>" + val + "</td><td>" + fromdata[val] + "</td></tr>";
                     }
+
+                    $('#mytable').html(html);
+
+                    var fromobj = $('#myForm');
+                    //弹出框
+                    layer.open({
+                        type: 1,
+                        title: '预约订单详情',
+                        area: ['800px', '90%'],
+                        id: 'layerDemo', //防止重复弹出
+                        content: fromobj,
+                        btn: ['关闭'],
+                        maxmin: true,
+                        btnAlign: 'c', //按钮居中
+                        yes: function (index, layero) {
+                            layer.close(index);
+                        },
+                        zIndex: 999 //重点1
+                    });
                 }
             });
+
         });
     </script>
 

+ 6 - 77
app/admin/view/appointment_application/publish.html

@@ -40,84 +40,13 @@
     <div style="margin-top: 20px;"></div>
     <form class="layui-form" id="publish" method="post">
 
-        <!-- 输入框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">姓名</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="name" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input"
-                       type="text" {notempty name="$data" }value="{$data.name}" {/notempty}>
-            </div>
-            <div class="layui-form-mid layui-word-aux">必填</div>
-        </div>
-        <!-- 数字 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">年龄</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="age" autocomplete="off" placeholder="请输入" class="layui-input" type="number" {notempty
-                       name="$data" }value="{$data.age}" {/notempty}>
-            </div>
-        </div>
-        <!-- 输入框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">出生年月</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="birthday" autocomplete="off" placeholder="请输入" class="layui-input" type="text" {notempty
-                       name="$data" }value="{$data.birthday}" {/notempty}>
-            </div>
-        </div>
-        <!-- 输入框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">身份证</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="id_card" autocomplete="off" placeholder="请输入" class="layui-input" type="text" {notempty
-                       name="$data" }value="{$data.id_card}" {/notempty}>
-            </div>
-        </div>
-        <!-- 数字 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">子女数量</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="childs_num" autocomplete="off" placeholder="请输入" class="layui-input" type="number"
-                       {notempty name="$data" }value="{$data.childs_num}" {/notempty}>
-            </div>
-        </div>
-        <!-- 输入框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">问题描述</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="problem_desc" autocomplete="off" placeholder="请输入" class="layui-input" type="text"
-                       {notempty name="$data" }value="{$data.problem_desc}" {/notempty}>
-            </div>
-        </div>
-        <!-- 输入框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">需求描述</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="requirement_desc" autocomplete="off" placeholder="请输入" class="layui-input" type="text"
-                       {notempty name="$data" }value="{$data.requirement_desc}" {/notempty}>
-            </div>
-        </div>
-        <!-- 下拉框 -->
-        <div class="layui-form-item">
-            <label class="layui-form-label">订单状态</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <select name="status" lay-filter="" lay-search="">
-                    <option value="">请选择</option>
-                    <option value="0" {notempty name="$data" }{eq name="$data.status" value="0" } selected="" {
-                    /eq}{/notempty}>未签到</option>
-                    <option value="1" {notempty name="$data" }{eq name="$data.status" value="1" } selected="" {
-                    /eq}{/notempty}>已签到</option>
-                    <option value="2" {notempty name="$data" }{eq name="$data.status" value="2" } selected="" {
-                    /eq}{/notempty}>爽约</option>
-                </select>
-            </div>
-        </div>
-        <!-- 输入框 -->
-        <div class="layui-form-item">
+
+        <!-- 纯文本段落 -->
+        <div class="layui-form-item layui-form-text">
             <label class="layui-form-label">备注</label>
-            <div class="layui-input-inline" style="max-width:300px;">
-                <input name="remark" autocomplete="off" placeholder="请输入" class="layui-input" type="text" {notempty
-                       name="$data" }value="{$data.remark}" {/notempty}>
+            <div class="layui-input-inline" style="width:600px;">
+                <textarea name="remark" rows="10" placeholder="请输入"
+                          class="layui-textarea">{notempty name="$data"}{$data.remark}{/notempty}</textarea>
             </div>
         </div>
 

+ 186 - 0
app/admin/view/appointment_ticket/index.html

@@ -0,0 +1,186 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>layui</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link rel="stylesheet" href="/static/public/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="/static/public/font-awesome/css/font-awesome.min.css" media="all"/>
+    <link rel="stylesheet" href="/static/admin/css/admin.css" media="all">
+    <style type="text/css">
+        /* tooltip */
+        #tooltip {
+            position: absolute;
+            border: 1px solid #ccc;
+            background: #333;
+            padding: 2px;
+            display: none;
+            color: #fff;
+        }
+
+        .tooltip > img {
+            width: 20px;
+            height: 20px;
+        }
+    </style>
+</head>
+<body style="padding:10px;">
+<div class="tplay-body-div">
+
+    <div class="layui-tab">
+        <ul class="layui-tab-title">
+            <li class="layui-this">列表</li>
+            <li><a href="{:url('admin/appointment/publish',['pid'=>$Request.param.pid])}" class="a_menu">新增</a></li>
+        </ul>
+    </div>
+
+    <script type="text/html" id="toolbarDemo">
+        <div class="layui-btn-container">
+            <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="deletes">批量删除</button>
+        </div>
+    </script>
+
+    <form class="layui-form serch" action="index" method="post">
+        <div class="layui-form-item" style="float: left;">
+
+            <div class="layui-input-inline">
+                <input type="text" class="layui-input time_range" id="time_range_appointment_daytime" autocomplete="off"
+                       placeholder="排号日期" name="appointment_daytime">
+            </div>
+            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
+        </div>
+    </form>
+
+    <script type="text/html" id="barDemo">
+        <div class="layui-btn-group">
+            <button class="layui-btn layui-btn-xs a_menu" lay-event="edit"><i class="layui-icon"
+                                                                              style="margin-right: 0;"></i></button>
+            <button class="layui-btn layui-btn-xs delete" lay-event="del"><i class="layui-icon"
+                                                                             style="margin-right: 0;"></i></button>
+        </div>
+    </script>
+
+    <table class="layui-table" id="table" lay-filter="table"></table>
+    {include file="public/foot"}
+
+    <script type="text/javascript">
+        layui.use(['table', 'layer', 'form', 'laydate'], function () {
+            var table = layui.table,
+                form = layui.form,
+                layer = layui.layer;
+            var laydate = layui.laydate;
+            //第一个实例
+            table.render({
+                id: 'table'
+                , elem: '#table'
+                , size: 'sm' //小尺寸的表格
+                , toolbar: '#toolbarDemo'
+                , limit: 15
+                , limits: [15, 20, 30, 40, 50, 100]
+                , url: "{:url('index',['pid'=>$Request.param.pid])}" //数据接口
+                , page: true //开启分页
+                , cols: [[ //表头
+                    {type: 'checkbox'},
+                    {field: "appointment_daytime", title: '排号日期'},
+                    {field: "specialist_name", title: '专家名字'},
+                    {field: "morning_use", title: '上午报名个数'},
+                    {field: "afternoon_use", title: '中午报名个数'},
+                    {field: "night_use", title: '晚上报名个数'},
+                    {field: 'action', title: '操作', toolbar: '#barDemo', fixed: 'right'}
+                ]],
+                done: function () {
+                    if (isExitsFunction('showThumb')) {
+                        showThumb()
+                    }
+                }
+            });
+
+            laydate.render({
+                elem: '#time_range_appointment_daytime'
+                , type: 'datetime'
+                , range: true
+                , theme: 'molv'
+                , calendar: true
+                , done: function (value, date, endDate) {
+                    if (endDate.hours == 0 && endDate.minutes == 0 && endDate.seconds == 0) {
+                        setTimeout(function () {
+                            $('#time_range_appointment_daytime').val(value.replace(/00:00:00$/, '23:59:59'))
+                        }, 100)
+                    }
+                }
+            });
+
+            form.on('submit(serch)', function (data) {
+                table.reload('table', {
+                    where: data.field
+                    , page: {
+                        curr: 1 //重新从第 1 页开始
+                    }
+                });
+                return false;
+            });
+
+            table.on('tool(table)', function (obj) {
+                if (obj.event == 'edit') {
+                    window.parent.tab.tabAdd({
+                        icon: "fa-bookmark",
+                        id: "tplay_appointment_ticket" + obj.data.id,
+                        title: obj.data.title == null ? "号源管理" + obj.data.id : obj.data.title,
+                        url: "/admin/appointment_ticket/publish?id=" + obj.data.id
+                    });
+                }
+                else if (obj.event == 'del') {
+                    layer.confirm('确定要删除?', function (index) {
+                        $.ajax({
+                            url: "{:url('delete')}",
+                            dataType: 'json',
+                            data: {id: obj.data.id},
+                            success: function (res) {
+                                layer.msg(res.msg);
+                                if (res.code == 1) {
+                                    table.reload('table');
+                                }
+                            }
+                        })
+                    })
+                }
+            });
+            //监听事件
+            table.on('toolbar(table)', function (obj) {
+                if (obj.event == 'deletes') {
+                    var checkStatus = table.checkStatus(obj.config.id);//获取选中的数据
+                    var data = checkStatus.data;
+                    if (data.length > 0) {
+                        var ids = [];//数组
+                        data.forEach(function (item, key) {
+                            ids[key] = item.id;
+                        })
+                        layer.confirm('是否删除?', function (index, layero) {
+                            $.ajax({
+                                url: "{:url('deletes')}",
+                                dataType: 'json',
+                                data: {"ids": ids},
+                                type: 'post',
+                                success: function (res) {
+                                    layer.msg(res.msg);
+                                    if (res.code == 1) {
+                                        table.reload('table');
+                                    }
+                                }
+                            })
+                            layer.close(index)
+                        });
+                    } else {
+                        layer.msg('请先勾选需要操作的记录');
+                    }
+                }
+            });
+        });
+    </script>
+
+
+</div>
+</body>
+</html>

+ 165 - 0
app/admin/view/appointment_ticket/publish.html

@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>号源管理编辑</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link rel="stylesheet" href="/static/public/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="/static/public/font-awesome/css/font-awesome.min.css" media="all"/>
+    <link rel="stylesheet" href="/static/admin/css/admin.css" media="all">
+    <script src="/static/public/layui/layui.js"></script>
+    <script src="/static/public/jquery/jquery.min.js"></script>
+</head>
+<style>
+    .layui-upload-img {
+        cursor: pointer;
+        width: 150px;
+        height: 150px;
+        background: url('/static/public/images/uploadimg.jpg');
+        background-size: contain;
+        border-radius: 2px;
+        border-width: 1px;
+        border-style: solid;
+        border-color: #e6e6e6;
+    }
+</style>
+<body style="padding:10px;">
+<div class="tplay-body-div">
+
+    {empty name="$data"}
+    <div class="layui-tab">
+        <ul class="layui-tab-title">
+            <li><a href="index" class="a_menu">列表</a></li>
+            <li class="layui-this">新增</li>
+        </ul>
+    </div>
+    {/empty}
+
+    <div style="margin-top: 20px;"></div>
+    <form class="layui-form" id="publish" method="post">
+
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">放号配置</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="appointment_id" lay-verify="required" autocomplete="off" placeholder="请输入"
+                       class="layui-input" type="number" {notempty name="$data" }value="{$data.appointment_id}" {/notempty}>
+            </div>
+            <div class="layui-form-mid layui-word-aux">必填</div>
+        </div>
+        <!-- 时间 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">排号日期</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="appointment_daytime" id="appointment_daytime" lay-verify="required" autocomplete="off"
+                       placeholder="请输入" class="layui-input" type="text" {notempty name="$data"
+                       }value="{$data.appointment_daytime}" {/notempty}>
+            </div>
+            <div class="layui-form-mid layui-word-aux">必填</div>
+        </div>
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">服务人id</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="provider_id" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input"
+                       type="number" {notempty name="$data" }value="{$data.provider_id}" {/notempty}>
+            </div>
+            <div class="layui-form-mid layui-word-aux">必填</div>
+        </div>
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">地址id</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="address_id" autocomplete="off" placeholder="请输入" class="layui-input" type="number"
+                       {notempty name="$data" }value="{$data.address_id}" {/notempty}>
+            </div>
+        </div>
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">上午报名个数</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="morning_use" autocomplete="off" placeholder="请输入" class="layui-input" type="number"
+                       {notempty name="$data" }value="{$data.morning_use}" {/notempty}>
+            </div>
+        </div>
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">中午报名个数</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="afternoon_use" autocomplete="off" placeholder="请输入" class="layui-input" type="number"
+                       {notempty name="$data" }value="{$data.afternoon_use}" {/notempty}>
+            </div>
+        </div>
+        <!-- 数字 -->
+        <div class="layui-form-item">
+            <label class="layui-form-label">晚上报名个数</label>
+            <div class="layui-input-inline" style="max-width:300px;">
+                <input name="night_use" autocomplete="off" placeholder="请输入" class="layui-input" type="number" {notempty
+                       name="$data" }value="{$data.night_use}" {/notempty}>
+            </div>
+        </div>
+
+
+        {notempty name="$data"}
+        <input type="hidden" name="id" value="{$data.id}">
+        {/notempty}
+
+        <div class="layui-form-item">
+            <div class="layui-input-block">
+                <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
+                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+            </div>
+        </div>
+    </form>
+
+    <script>
+        layui.use(['layer', 'form', 'laydate'], function () {
+            var layer = layui.layer,
+                $ = layui.jquery,
+                form = layui.form;
+            var laydate = layui.laydate;
+
+            $(window).on('load', function () {
+                form.on('submit(admin)', function (data) {
+                    $.ajax({
+                        url: "{:url('publish')}",
+                        data: $('#publish').serialize(),
+                        type: 'post',
+                        dataType: 'json',
+                        async: false,
+                        success: function (res) {
+                            if (res.code == 1) {
+                                if (res.msg == "添加成功") {
+                                    layer.alert(res.msg, function (index) {
+                                        location.href = res.url;
+                                    })
+                                } else {
+                                    layer.confirm(res.msg, {
+                                        btn: ['关闭', '继续编辑']
+                                    }, function (index) {
+                                        window.parent.tab.close('tplay_appointment_ticket{$data.id|default=0}');
+                                    }, function (index, layero) {
+                                        location.href = res.url;
+                                    });
+                                }
+                            } else {
+                                layer.msg(res.msg);
+                            }
+                        }
+                    })
+                    return false;
+                });
+
+                laydate.render({
+                    elem: '#appointment_daytime', //指定元素
+                    type: 'datetime',
+                });
+
+            });
+        });
+    </script>
+</div>
+</body>
+</html>

+ 2 - 2
app/admin/view/specialist/index.html

@@ -173,10 +173,10 @@
                     layer.open({
                         type: 2,
                         title: '放号设置 | ' + obj.data.name ,
-                        area: ['90%', '90%'],
+                        area: ['60%', '90%'],
                         maxmin: true,
                         id: 'layerDemo', //防止重复弹出
-                        content: "{:url('admin/appointment/index')}?pid=" + obj.data.id
+                        content: "{:url('admin/appointment_ticket/index')}?pid=" + obj.data.id
                     });
                 }
             });

+ 29 - 0
app/common/model/AppointmentApplication.php

@@ -12,12 +12,41 @@ class AppointmentApplication extends Model
     const STATUS_SIGN = 1;
     const STATUS_NOT_COME = 2;
 
+    const STATUS = [
+        self::STATUS_NOT_SIGN => '未签到',
+        self::STATUS_SIGN => '已签到',
+        self::STATUS_NOT_COME => '爽约',
+    ];
+
+    const SEX_UNKNOW = 0;
+    const SEX_MAN = 1;
+    const SEX_WOMAN = 2;
+
+    const SEXS = [
+        self::SEX_UNKNOW => '未知',
+        self::SEX_MAN => '男',
+        self::SEX_WOMAN => '女'
+    ];
+
+    //sex_text
+    public function getSexTextAttr($value, $data)
+    {
+        return self::SEXS[$data['sex']]??'';
+    }
+
     //finish_time
     public function getFinishTimeAttr($value, $data)
     {
         return $value ? date('Y-m-d H:i:s', $value) : '';
     }
 
+    //status_text
+    public function getStatusTextAttr($value, $data)
+    {
+        return self::STATUS[$data['status']]??'';
+    }
+
+
     //关联地址
     public function address()
     {

+ 5 - 0
app/common/model/AppointmentTicket.php

@@ -8,6 +8,11 @@ class AppointmentTicket extends Model
 {
     protected $autoWriteTimestamp = false;
 
+    public function getAppointmentDaytimeAttr($value, $data)
+    {
+        return $value ? date('Y-m-d', $value) : '';
+    }
+
     //关联专家
     public function specialist()
     {

+ 1 - 1
app/index/controller/Index.php

@@ -14,6 +14,6 @@ class Index extends Base
 {
     public function index()
     {
-        return "本页面为 " . PRODUCT_NAME . " 系统默认页";
+        return "本页面为系统默认页";
     }
 }

+ 7 - 1
app/install/data/db.sql

@@ -840,4 +840,10 @@ INSERT INTO `tplay_webconfig` (`id`, `name`, `is_log`, `is_close_site`, `file_ty
 /*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
 
 ALTER TABLE `tplay_address`
-	ADD COLUMN `thumb` INT NOT NULL DEFAULT '0' COMMENT '封面' AFTER `title`;
+	ADD COLUMN `thumb` INT NOT NULL DEFAULT '0' COMMENT '封面' AFTER `title`;
+
+ALTER TABLE `tplay_appointment_ticket`
+	ADD COLUMN `status` TINYINT NOT NULL DEFAULT '1' COMMENT '状态:1启用0停用' AFTER `night_use`;
+
+ALTER TABLE `tplay_appointment`
+	CHANGE COLUMN `phone` `phone` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '咨询电话' COLLATE 'utf8_general_ci' AFTER `title`;