浏览代码

新课程表来到预约订单里,能直接给用户预约

lizhen_gitee 6 月之前
父节点
当前提交
e6b00cd012

+ 6 - 1
application/admin/controller/Lessonorder.php

@@ -46,6 +46,11 @@ class Lessonorder extends Backend
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
         if ($this->request->isAjax()) {
+            //拿slot_id
+            $filter = $this->request->get('filter');
+            $filter = json_decode($filter,true);
+            $slot_id = isset($filter['slot_id']) ? $filter['slot_id'] : 0;
+
             //如果发送的来源是Selectpage,则转发到Selectpage
             if ($this->request->request('keyField')) {
                 return $this->selectpage();
@@ -67,7 +72,7 @@ class Lessonorder extends Backend
 				$row->getRelation('coach')->visible(['nickname']);
             }
 
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            $result = array("total" => $list->total(), "rows" => $list->items(), "extend"=>[ 'slot_id' => $slot_id ]);
 
             return json($result);
         }

+ 1 - 0
application/admin/view/lessonorder/index.html

@@ -8,6 +8,7 @@
                     <div id="toolbar" class="toolbar">
                         <?php if($is_back == 1){ ?>
                         <a class="btn btn-primary" title="返回" href="/admin.php/lessonslotnew" >返回</a>
+                        <a href="javascript:;" id="btn-booking" class="btn btn-success btn-dialog" data-url="" title="{:__('Booking')}" ><i class="fa fa-plus"></i> {:__('Booking')}</a>
                         <?php } ?>
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                         <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('lessonorder/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>

+ 1 - 0
public/assets/js/backend.js

@@ -141,6 +141,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
                 var that = this;
                 var options = $.extend({}, $(that).data() || {});
                 var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
+//                console.log(url,$(that).data("url"),this,that);
                 var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
                 var button = Backend.api.gettablecolumnbutton(options);
                 if (button && typeof button.callback === 'function') {

+ 8 - 0
public/assets/js/backend/lessonorder.js

@@ -17,6 +17,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
             var table = $("#table");
 
+            //当表格数据加载完成时
+            table.on('load-success.bs.table', function (e, data) {
+                //这里可以获取从服务端获取的JSON数据
+                console.log(data);
+                //这里我们手动设置底部的值
+                $("#btn-booking").data('url','lessonslot/booking/id/' + data.extend.slot_id);
+            });
+
             // 初始化表格
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,