正在显示
25 个修改的文件
包含
584 行增加
和
73 行删除
@@ -135,12 +135,107 @@ class Category extends Backend | @@ -135,12 +135,107 @@ class Category extends Backend | ||
135 | 135 | ||
136 | 136 | ||
137 | /** | 137 | /** |
138 | - * Selectpage搜索 | 138 | + * Selectpage的实现方法 |
139 | + * | ||
140 | + * 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可 | ||
141 | + * 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可 | ||
139 | * | 142 | * |
140 | - * @internal | ||
141 | */ | 143 | */ |
142 | public function selectpage() | 144 | public function selectpage() |
143 | { | 145 | { |
144 | - return parent::selectpage(); | 146 | + //设置过滤方法 |
147 | + $this->request->filter(['strip_tags', 'htmlspecialchars']); | ||
148 | + | ||
149 | + //搜索关键词,客户端输入以空格分开,这里接收为数组 | ||
150 | + $word = (array)$this->request->request("q_word/a"); | ||
151 | + //当前页 | ||
152 | + $page = $this->request->request("pageNumber"); | ||
153 | + //分页大小 | ||
154 | + $pagesize = $this->request->request("pageSize"); | ||
155 | + //搜索条件 | ||
156 | + $andor = $this->request->request("andOr", "and", "strtoupper"); | ||
157 | + //排序方式 | ||
158 | + $orderby = (array)$this->request->request("orderBy/a"); | ||
159 | + //显示的字段 | ||
160 | + $field = $this->request->request("showField"); | ||
161 | + //主键 | ||
162 | + $primarykey = $this->request->request("keyField"); | ||
163 | + //主键值 | ||
164 | + $primaryvalue = $this->request->request("keyValue"); | ||
165 | + //搜索字段 | ||
166 | + $searchfield = (array)$this->request->request("searchField/a"); | ||
167 | + //自定义搜索条件 | ||
168 | + $custom = (array)$this->request->request("custom/a"); | ||
169 | + //是否返回树形结构 | ||
170 | + $istree = $this->request->request("isTree", 0); | ||
171 | + $ishtml = $this->request->request("isHtml", 0); | ||
172 | + if ($istree) { | ||
173 | + $word = []; | ||
174 | + $pagesize = 99999; | ||
175 | + } | ||
176 | + $order = []; | ||
177 | + foreach ($orderby as $k => $v) { | ||
178 | + $order[$v[0]] = $v[1]; | ||
179 | + } | ||
180 | + $field = $field ? $field : 'name'; | ||
181 | + | ||
182 | + //如果有primaryvalue,说明当前是初始化传值 | ||
183 | + if ($primaryvalue !== null) { | ||
184 | + $where = [$primarykey => ['in', $primaryvalue]]; | ||
185 | + } else { | ||
186 | + $where = function ($query) use ($word, $andor, $field, $searchfield, $custom) { | ||
187 | + $logic = $andor == 'AND' ? '&' : '|'; | ||
188 | + $searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield; | ||
189 | + foreach ($word as $k => $v) { | ||
190 | + $query->where(str_replace(',', $logic, $searchfield), "like", "%{$v}%"); | ||
191 | + } | ||
192 | + if ($custom && is_array($custom)) { | ||
193 | + foreach ($custom as $k => $v) { | ||
194 | + if (is_array($v) && 2 == count($v)) { | ||
195 | + $query->where($k, trim($v[0]), $v[1]); | ||
196 | + } else { | ||
197 | + $query->where($k, '=', $v); | ||
198 | + } | ||
199 | + } | ||
200 | + } | ||
201 | + }; | ||
202 | + } | ||
203 | + $adminIds = $this->getDataLimitAdminIds(); | ||
204 | + if (is_array($adminIds)) { | ||
205 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
206 | + } | ||
207 | + $list = []; | ||
208 | + $total = $this->model->where($where)->where(['status'=>'normal'])->count(); | ||
209 | + if ($total > 0) { | ||
210 | + if (is_array($adminIds)) { | ||
211 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
212 | + } | ||
213 | + $datalist = $this->model->where($where)->where(['status'=>'normal']) | ||
214 | + ->order($order) | ||
215 | + ->page($page, $pagesize) | ||
216 | + ->field($this->selectpageFields) | ||
217 | + ->select(); | ||
218 | + foreach ($datalist as $index => $item) { | ||
219 | + unset($item['password'], $item['salt']); | ||
220 | + $list[] = [ | ||
221 | + $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '', | ||
222 | + $field => isset($item[$field]) ? $item[$field] : '', | ||
223 | + 'pid' => isset($item['pid']) ? $item['pid'] : 0 | ||
224 | + ]; | ||
225 | + } | ||
226 | + if ($istree && !$primaryvalue) { | ||
227 | + $tree = Tree::instance(); | ||
228 | + $tree->init(collection($list)->toArray(), 'pid'); | ||
229 | + $list = $tree->getTreeList($tree->getTreeArray(0), $field); | ||
230 | + if (!$ishtml) { | ||
231 | + foreach ($list as &$item) { | ||
232 | + $item = str_replace(' ', ' ', $item); | ||
233 | + } | ||
234 | + unset($item); | ||
235 | + } | ||
236 | + } | ||
237 | + } | ||
238 | + //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 | ||
239 | + return json(['list' => $list, 'total' => $total]); | ||
145 | } | 240 | } |
146 | } | 241 | } |
@@ -45,18 +45,40 @@ class CourseSignStartSet extends Backend | @@ -45,18 +45,40 @@ class CourseSignStartSet extends Backend | ||
45 | return $this->selectpage(); | 45 | return $this->selectpage(); |
46 | } | 46 | } |
47 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 47 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
48 | - $total = $this->model | ||
49 | - ->with(['store','course']) | ||
50 | - ->where($where) | ||
51 | - ->order($sort, $order) | ||
52 | - ->count(); | ||
53 | - | ||
54 | - $list = $this->model | ||
55 | - ->with(['store','course']) | ||
56 | - ->where($where) | ||
57 | - ->order($sort, $order) | ||
58 | - ->limit($offset, $limit) | ||
59 | - ->select(); | 48 | + |
49 | + $admin = $this->auth->getUserInfo(); | ||
50 | + if (!empty($admin['store_id'])) { | ||
51 | + $total = $this->model | ||
52 | + ->with(['store','course']) | ||
53 | + ->where($where) | ||
54 | + ->where(['store_id'=>$admin['store_id']]) | ||
55 | + ->order($sort, $order) | ||
56 | + ->count(); | ||
57 | + | ||
58 | + $list = $this->model | ||
59 | + ->with(['store','course']) | ||
60 | + ->where($where) | ||
61 | + ->where(['store_id'=>$admin['store_id']]) | ||
62 | + ->order($sort, $order) | ||
63 | + ->limit($offset, $limit) | ||
64 | + ->select(); | ||
65 | + }else{ | ||
66 | + $total = $this->model | ||
67 | + ->with(['store','course']) | ||
68 | + ->where($where) | ||
69 | + ->order($sort, $order) | ||
70 | + ->count(); | ||
71 | + | ||
72 | + $list = $this->model | ||
73 | + ->with(['store','course']) | ||
74 | + ->where($where) | ||
75 | + ->order($sort, $order) | ||
76 | + ->limit($offset, $limit) | ||
77 | + ->select(); | ||
78 | + } | ||
79 | + | ||
80 | + | ||
81 | + | ||
60 | 82 | ||
61 | $list = collection($list)->toArray(); | 83 | $list = collection($list)->toArray(); |
62 | $result = array("total" => $total, "rows" => $list); | 84 | $result = array("total" => $total, "rows" => $list); |
@@ -87,4 +109,23 @@ class CourseSignStartSet extends Backend | @@ -87,4 +109,23 @@ class CourseSignStartSet extends Backend | ||
87 | $this->success("切换成功"); | 109 | $this->success("切换成功"); |
88 | } | 110 | } |
89 | 111 | ||
112 | + | ||
113 | + public function add() | ||
114 | + { | ||
115 | + $admin = $this->auth->getUserInfo(); | ||
116 | + if (!empty($admin['store_id'])) { | ||
117 | + $this->assign("store_id", $admin['store_id']); | ||
118 | + } | ||
119 | + return parent::add(); | ||
120 | + } | ||
121 | + | ||
122 | + public function edit($ids = NULL) | ||
123 | + { | ||
124 | + $admin = $this->auth->getUserInfo(); | ||
125 | + if (!empty($admin['store_id'])) { | ||
126 | + $this->assign("store_id", $admin['store_id']); | ||
127 | + } | ||
128 | + return parent::edit($ids); | ||
129 | + } | ||
130 | + | ||
90 | } | 131 | } |
@@ -300,4 +300,95 @@ class CourseStore extends Backend | @@ -300,4 +300,95 @@ class CourseStore extends Backend | ||
300 | 300 | ||
301 | $this->success(); | 301 | $this->success(); |
302 | } | 302 | } |
303 | + | ||
304 | + /** | ||
305 | + * 发布 | ||
306 | + * | ||
307 | + * @param $arr | ||
308 | + * | ||
309 | + * @throws \think\Exception | ||
310 | + * @throws \think\db\exception\DataNotFoundException | ||
311 | + * @throws \think\db\exception\ModelNotFoundException | ||
312 | + * @throws \think\exception\DbException | ||
313 | + */ | ||
314 | + public function publishAll($arr){ | ||
315 | + | ||
316 | + foreach ($arr as $k) { | ||
317 | + $courseStore = new \app\admin\model\CourseStore; | ||
318 | + $courseStore = $courseStore->where(['id'=>$k])->find(); | ||
319 | + if(empty($courseStore)){ | ||
320 | + continue; | ||
321 | + } | ||
322 | + $courseStore = $courseStore->toArray(); | ||
323 | + if($courseStore['status'] != 'new'){ | ||
324 | + continue; | ||
325 | + } | ||
326 | + $courseStore = new \app\admin\model\CourseStore; | ||
327 | + $courseStore->save(['status'=>'confirmed'],['id'=>$k]); | ||
328 | + } | ||
329 | + | ||
330 | + $this->success('ok',null); | ||
331 | + } | ||
332 | + | ||
333 | + /** | ||
334 | + * 发布 | ||
335 | + * | ||
336 | + * @param $arr | ||
337 | + * | ||
338 | + * @throws \think\Exception | ||
339 | + * @throws \think\db\exception\DataNotFoundException | ||
340 | + * @throws \think\db\exception\ModelNotFoundException | ||
341 | + * @throws \think\exception\DbException | ||
342 | + */ | ||
343 | + public function cancelAll($arr){ | ||
344 | + | ||
345 | + foreach ($arr as $k) { | ||
346 | + $courseStore = new \app\admin\model\CourseStore; | ||
347 | + $courseStore = $courseStore->where(['id'=>$k])->find(); | ||
348 | + if(empty($courseStore)){ | ||
349 | + continue; | ||
350 | + } | ||
351 | + $courseStore = $courseStore->toArray(); | ||
352 | + if($courseStore['status'] != 'confirmed'){ | ||
353 | + continue; | ||
354 | + } | ||
355 | + $courseStore = new \app\admin\model\CourseStore; | ||
356 | + $courseStore->save(['status'=>'cancel'],['id'=>$k]); | ||
357 | + } | ||
358 | + | ||
359 | + $this->success('ok',null); | ||
360 | + } | ||
361 | + | ||
362 | + /** | ||
363 | + * 发布 | ||
364 | + * | ||
365 | + * @param $arr | ||
366 | + * | ||
367 | + * @throws \think\Exception | ||
368 | + * @throws \think\db\exception\DataNotFoundException | ||
369 | + * @throws \think\db\exception\ModelNotFoundException | ||
370 | + * @throws \think\exception\DbException | ||
371 | + */ | ||
372 | + public function deleteAll($arr){ | ||
373 | + | ||
374 | + foreach ($arr as $k) { | ||
375 | + $courseStore = new \app\admin\model\CourseStore; | ||
376 | + $courseStore = $courseStore->where(['id'=>$k])->find(); | ||
377 | + if(empty($courseStore)){ | ||
378 | + continue; | ||
379 | + } | ||
380 | + $courseStore = $courseStore->toArray(); | ||
381 | + if($courseStore['status'] != 'new'){ | ||
382 | + continue; | ||
383 | + } | ||
384 | + $courseStore = new \app\admin\model\CourseStore; | ||
385 | + $courseStore->where(['id'=>$k])->delete(); | ||
386 | + } | ||
387 | + | ||
388 | + $this->success('ok',null); | ||
389 | + } | ||
390 | + | ||
391 | + | ||
392 | + | ||
393 | + | ||
303 | } | 394 | } |
@@ -81,4 +81,77 @@ class Store extends Backend | @@ -81,4 +81,77 @@ class Store extends Backend | ||
81 | return $this->view->fetch(); | 81 | return $this->view->fetch(); |
82 | } | 82 | } |
83 | 83 | ||
84 | + | ||
85 | + /** | ||
86 | + * 切换 | ||
87 | + * @param $ids | ||
88 | + * @return mixed | ||
89 | + */ | ||
90 | + public function change($ids = '') | ||
91 | + { | ||
92 | + //你需要在此做具体的操作逻辑 | ||
93 | + $data = $this->model->where(['id'=>$ids])->find(); | ||
94 | + if(empty($data)){ | ||
95 | + $this->error("没有这个门店",$ids); | ||
96 | + } | ||
97 | + $data = $data->toArray(); | ||
98 | + | ||
99 | + ($data['status'] == 'enable')?$status = 'disable':$status = 'enable'; | ||
100 | + | ||
101 | + $data = $this->model->where(['id'=>$ids])->update(['status'=>$status]); | ||
102 | + | ||
103 | + $this->success("切换成功"); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * 上架 | ||
108 | + * | ||
109 | + * @param $arr | ||
110 | + * | ||
111 | + * @throws \think\Exception | ||
112 | + * @throws \think\db\exception\DataNotFoundException | ||
113 | + * @throws \think\db\exception\ModelNotFoundException | ||
114 | + * @throws \think\exception\DbException | ||
115 | + */ | ||
116 | + public function change1All($arr){ | ||
117 | + | ||
118 | + foreach ($arr as $k) { | ||
119 | + $store = new \app\admin\model\Store(); | ||
120 | + $store = $store->where(['id'=>$k])->find(); | ||
121 | + if(empty($store)){ | ||
122 | + continue; | ||
123 | + } | ||
124 | + $store = new \app\admin\model\Store; | ||
125 | + $store->save(['status'=>'enable'],['id'=>$k]); | ||
126 | + } | ||
127 | + | ||
128 | + $this->success('ok',null); | ||
129 | + } | ||
130 | + | ||
131 | + | ||
132 | + /** | ||
133 | + * 下架 | ||
134 | + * | ||
135 | + * @param $arr | ||
136 | + * | ||
137 | + * @throws \think\Exception | ||
138 | + * @throws \think\db\exception\DataNotFoundException | ||
139 | + * @throws \think\db\exception\ModelNotFoundException | ||
140 | + * @throws \think\exception\DbException | ||
141 | + */ | ||
142 | + public function changeAll($arr){ | ||
143 | + | ||
144 | + foreach ($arr as $k) { | ||
145 | + $store = new \app\admin\model\Store(); | ||
146 | + $store = $store->where(['id'=>$k])->find(); | ||
147 | + if(empty($store)){ | ||
148 | + continue; | ||
149 | + } | ||
150 | + $store = new \app\admin\model\Store; | ||
151 | + $store->save(['status'=>'disable'],['id'=>$k]); | ||
152 | + } | ||
153 | + | ||
154 | + $this->success('ok',null); | ||
155 | + } | ||
156 | + | ||
84 | } | 157 | } |
@@ -9,10 +9,11 @@ return [ | @@ -9,10 +9,11 @@ return [ | ||
9 | 'Order_id' => '会员', | 9 | 'Order_id' => '会员', |
10 | 'Date' => '日期', | 10 | 'Date' => '日期', |
11 | 'Start' => '开始时间', | 11 | 'Start' => '开始时间', |
12 | - 'End' => '结束', | 12 | + 'End' => '结束时间', |
13 | 'create' => '结束', | 13 | 'create' => '结束', |
14 | 'publish' => '已预约', | 14 | 'publish' => '已预约', |
15 | 'finish' => '已完成', | 15 | 'finish' => '已完成', |
16 | 'evaluate' => '已评价', | 16 | 'evaluate' => '已评价', |
17 | 'miss' => '缺课', | 17 | 'miss' => '缺课', |
18 | + 'Teacher' => '上课老师', | ||
18 | ]; | 19 | ]; |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <div class="form-group"> | 9 | <div class="form-group"> |
10 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> | 10 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> |
11 | <div class="col-xs-12 col-sm-8"> | 11 | <div class="col-xs-12 col-sm-8"> |
12 | - {:build_select('row[store_id]', $storedata, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])} | 12 | + {:build_select('row[store_id]', $storedata, null, ['class'=>'form-control selectpicker'])} |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <div class="form-group"> | 15 | <div class="form-group"> |
@@ -65,12 +65,23 @@ | @@ -65,12 +65,23 @@ | ||
65 | <input id="c-course_id" data-source="course/index" class="form-control selectpage" name="row[course_id]" type="text" value=""> | 65 | <input id="c-course_id" data-source="course/index" class="form-control selectpage" name="row[course_id]" type="text" value=""> |
66 | </div> | 66 | </div> |
67 | </div> | 67 | </div> |
68 | + | ||
69 | + {if isset($store_id)} | ||
70 | + <div class="form-group" style="display: none"> | ||
71 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> | ||
72 | + <div class="col-xs-12 col-sm-8"> | ||
73 | + <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control" name="row[store_id]" type="text" value="{$store_id}"> | ||
74 | + </div> | ||
75 | + </div> | ||
76 | + {else} | ||
68 | <div class="form-group"> | 77 | <div class="form-group"> |
69 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> | 78 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> |
70 | <div class="col-xs-12 col-sm-8"> | 79 | <div class="col-xs-12 col-sm-8"> |
71 | <input id="c-store_id" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value=""> | 80 | <input id="c-store_id" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value=""> |
72 | </div> | 81 | </div> |
73 | </div> | 82 | </div> |
83 | + {/if} | ||
84 | + | ||
74 | <div class="form-group"> | 85 | <div class="form-group"> |
75 | <label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label> | 86 | <label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label> |
76 | <div class="col-xs-12 col-sm-8"> | 87 | <div class="col-xs-12 col-sm-8"> |
@@ -60,12 +60,22 @@ | @@ -60,12 +60,22 @@ | ||
60 | <input id="c-course_id" data-rule="required" data-source="course/index" class="form-control selectpage" name="row[course_id]" type="text" value="{$row.course_id|htmlentities}"> | 60 | <input id="c-course_id" data-rule="required" data-source="course/index" class="form-control selectpage" name="row[course_id]" type="text" value="{$row.course_id|htmlentities}"> |
61 | </div> | 61 | </div> |
62 | </div> | 62 | </div> |
63 | + | ||
64 | + {if isset($store_id)} | ||
65 | + <div class="form-group" tyle="display: none"> | ||
66 | + <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> | ||
67 | + <div class="col-xs-12 col-sm-8"> | ||
68 | + <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="{$row.store_id|htmlentities}"> | ||
69 | + </div> | ||
70 | + </div> | ||
71 | + {else} | ||
63 | <div class="form-group"> | 72 | <div class="form-group"> |
64 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> | 73 | <label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label> |
65 | <div class="col-xs-12 col-sm-8"> | 74 | <div class="col-xs-12 col-sm-8"> |
66 | <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="{$row.store_id|htmlentities}"> | 75 | <input id="c-store_id" data-rule="required" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="{$row.store_id|htmlentities}"> |
67 | </div> | 76 | </div> |
68 | </div> | 77 | </div> |
78 | + {/if} | ||
69 | <div class="form-group"> | 79 | <div class="form-group"> |
70 | <label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label> | 80 | <label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label> |
71 | <div class="col-xs-12 col-sm-8"> | 81 | <div class="col-xs-12 col-sm-8"> |
@@ -29,6 +29,13 @@ | @@ -29,6 +29,13 @@ | ||
29 | </div> | 29 | </div> |
30 | 30 | ||
31 | <div class="form-group"> | 31 | <div class="form-group"> |
32 | + <label class="control-label col-xs-12 col-sm-2">{:__('Teacher')}:</label> | ||
33 | + <div class="col-xs-12 col-sm-8"> | ||
34 | + <input id="c-teacher" data-rule="required" class="form-control" name="row[teacher]" type="text"> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + | ||
38 | + <div class="form-group"> | ||
32 | <label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label> | 39 | <label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label> |
33 | <div class="col-xs-12 col-sm-8"> | 40 | <div class="col-xs-12 col-sm-8"> |
34 | <input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number"> | 41 | <input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number"> |
@@ -20,6 +20,13 @@ | @@ -20,6 +20,13 @@ | ||
20 | </div> | 20 | </div> |
21 | 21 | ||
22 | <div class="form-group"> | 22 | <div class="form-group"> |
23 | + <label class="control-label col-xs-12 col-sm-2">{:__('Teacher')}:</label> | ||
24 | + <div class="col-xs-12 col-sm-8"> | ||
25 | + <input id="c-teacher" data-rule="required" class="form-control" name="row[teacher]" type="text" value="{$row.teacher|htmlentities}"> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + | ||
29 | + <div class="form-group"> | ||
23 | <label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label> | 30 | <label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label> |
24 | <div class="col-xs-12 col-sm-8"> | 31 | <div class="col-xs-12 col-sm-8"> |
25 | <input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number" value="{$row.notify_count|htmlentities}"> | 32 | <input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number" value="{$row.notify_count|htmlentities}"> |
@@ -21,7 +21,10 @@ | @@ -21,7 +21,10 @@ | ||
21 | <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | 21 | <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> |
22 | </ul> | 22 | </ul> |
23 | </div>--> | 23 | </div>--> |
24 | - | 24 | + <a href="javascript:;" class="btn btn-danger btn-publishAll btn-disabled {:$auth->check('course_store/publishAll')?'':'hide'}" title="发布"><i class="fa fa-check"></i> 发布</a> |
25 | + <a href="javascript:;" class="btn btn-danger btn-cancelAll btn-disabled {:$auth->check('course_store/cancelAll')?'':'hide'}" title="取消"><i class="fa fa-times"></i> 取消</a> | ||
26 | + | ||
27 | + | ||
25 | </div> | 28 | </div> |
26 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | 29 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" |
27 | data-operate-edit="{:$auth->check('course_store/edit')}" | 30 | data-operate-edit="{:$auth->check('course_store/edit')}" |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | <label class="control-label col-xs-12 col-sm-2">{:__('Map_info')}:</label> | 16 | <label class="control-label col-xs-12 col-sm-2">{:__('Map_info')}:</label> |
17 | <div class="col-xs-12 col-sm-8"> | 17 | <div class="col-xs-12 col-sm-8"> |
18 | <button type="button" class="btn btn-success" data-toggle="addresspicker">选择地图</button> | 18 | <button type="button" class="btn btn-success" data-toggle="addresspicker">选择地图</button> |
19 | - <input id="c-map_info" data-rule="required" data-lat="{$row.lat}" data-lng="{$row.lng}" class="form-control" name="row[map_info]" type="text" style="display: none" value="{$row.map_info|htmlentities}"> | 19 | + <input id="c-map_info" data-rule="required" class="form-control" name="row[map_info]" type="text" style="display: none" value="{$row.map_info|htmlentities}"> |
20 | </div> | 20 | </div> |
21 | </div> | 21 | </div> |
22 | <div class="form-group"> | 22 | <div class="form-group"> |
@@ -19,6 +19,8 @@ | @@ -19,6 +19,8 @@ | ||
19 | <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> | 19 | <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li> |
20 | </ul> | 20 | </ul> |
21 | </div>--> | 21 | </div>--> |
22 | + <a href="javascript:;" class="btn btn-danger btn-change1All btn-disabled {:$auth->check('course_store/change1All')?'':'hide'}" title="上架"><i class="fa fa-check"></i> 上架</a> | ||
23 | + <a href="javascript:;" class="btn btn-danger btn-changeAll btn-disabled {:$auth->check('course_store/changeAll')?'':'hide'}" title="下架"><i class="fa fa-check"></i> 下架</a> | ||
22 | 24 | ||
23 | 25 | ||
24 | </div> | 26 | </div> |
@@ -38,7 +38,7 @@ class Store extends Api | @@ -38,7 +38,7 @@ class Store extends Api | ||
38 | if(!empty($value)&&!empty($type)){ | 38 | if(!empty($value)&&!empty($type)){ |
39 | $where[$type] = $value; | 39 | $where[$type] = $value; |
40 | } | 40 | } |
41 | - | 41 | + $where['status'] = 'enable'; |
42 | $store = new \app\admin\model\Store(); | 42 | $store = new \app\admin\model\Store(); |
43 | $store = $store->where($where)->select(); | 43 | $store = $store->where($where)->select(); |
44 | 44 | ||
@@ -115,7 +115,7 @@ class Store extends Api | @@ -115,7 +115,7 @@ class Store extends Api | ||
115 | } | 115 | } |
116 | 116 | ||
117 | $store = new \app\admin\model\Store(); | 117 | $store = new \app\admin\model\Store(); |
118 | - $store = $store->where(['id'=>$id])->find(); | 118 | + $store = $store->where(['id'=>$id,'status'=>'enable'])->find(); |
119 | if(empty($store)){ | 119 | if(empty($store)){ |
120 | $this->error(__('Invalid parameters')); | 120 | $this->error(__('Invalid parameters')); |
121 | } | 121 | } |
@@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | columns: [ | 30 | columns: [ |
31 | [ | 31 | [ |
32 | {checkbox: true}, | 32 | {checkbox: true}, |
33 | - {field: 'id', title: __('Id')}, | ||
34 | - {field: 'name', title: __('Name')}, | ||
35 | - {field: 'category.name', title: __('Category_id')}, | ||
36 | - {field: 'level.name', title: __('Level_id')}, | ||
37 | - {field: 'sub_name', title: __('Sub_name')}, | ||
38 | - {field: 'cover', title: __('Cover'),formatter: Table.api.formatter.image, events: Table.api.events.image}, | 33 | + {field: 'id', title: __('Id'),sortable: true}, |
34 | + {field: 'name', title: __('Name'),sortable: true}, | ||
35 | + {field: 'category.name', title: __('Category_id'),sortable: true}, | ||
36 | + {field: 'level.name', title: __('Level_id'),sortable: true}, | ||
37 | + {field: 'sub_name', title: __('Sub_name'),sortable: true}, | ||
38 | + {field: 'cover', title: __('Cover'),formatter: Table.api.formatter.image, events: Table.api.events.image,sortable: true}, | ||
39 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 39 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
40 | ] | 40 | ] |
41 | ] | 41 | ] |
@@ -30,8 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,8 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | columns: [ | 30 | columns: [ |
31 | [ | 31 | [ |
32 | {checkbox: true}, | 32 | {checkbox: true}, |
33 | - {field: 'id', title: __('Id')}, | ||
34 | - {field: 'name', title: __('Name')}, | 33 | + {field: 'id', title: __('Id'),sortable: true}, |
34 | + {field: 'name', title: __('Name'),sortable: true}, | ||
35 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 35 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
36 | ] | 36 | ] |
37 | ] | 37 | ] |
@@ -32,12 +32,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -32,12 +32,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
32 | [ | 32 | [ |
33 | {checkbox: true}, | 33 | {checkbox: true}, |
34 | /* {field: 'id', title: __('Id')},*/ | 34 | /* {field: 'id', title: __('Id')},*/ |
35 | - {field: 'course.name', title: __('Course_id')}, | ||
36 | - {field: 'store.name', title: __('Store_id')}, | ||
37 | - {field: 'user.mobile', title: __('User_id')}, | ||
38 | - {field: 'course_store.date', title: __('Date')}, | ||
39 | - {field: 'course_store.time_start', title: __('Start')}, | ||
40 | - {field: 'course_store.time_end', title: __('End')}, | 35 | + {field: 'course.name', title: __('Course_id'),sortable: true}, |
36 | + {field: 'store.name', title: __('Store_id'),sortable: true}, | ||
37 | + {field: 'user.mobile', title: __('User_id'),sortable: true}, | ||
38 | + {field: 'course_store.teacher', title: __('Teacher'),sortable: true}, | ||
39 | + {field: 'course_store.date', title: __('Date'),sortable: true}, | ||
40 | + {field: 'course_store.time_start', title: __('Start'),sortable: true}, | ||
41 | + {field: 'course_store.time_end', title: __('End'),sortable: true}, | ||
41 | { | 42 | { |
42 | field: 'status', title: __('Status'), formatter: function (value) { | 43 | field: 'status', title: __('Status'), formatter: function (value) { |
43 | var color = ''; | 44 | var color = ''; |
@@ -45,7 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -45,7 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
45 | color = ''; | 46 | color = ''; |
46 | } | 47 | } |
47 | return '<span style="color:' + color + '">' + __(value) + '</span>'; | 48 | return '<span style="color:' + color + '">' + __(value) + '</span>'; |
48 | - } | 49 | + },sortable: true |
49 | }, | 50 | }, |
50 | /*{field: 'order_id', title: __('Order_id')},*/ | 51 | /*{field: 'order_id', title: __('Order_id')},*/ |
51 | { | 52 | { |
@@ -74,11 +74,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -74,11 +74,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
74 | {field: 'course_sign_id', title: __('Course_sign_id')},*/ | 74 | {field: 'course_sign_id', title: __('Course_sign_id')},*/ |
75 | //{field: 'course.name', title: __('Course_id')}, | 75 | //{field: 'course.name', title: __('Course_id')}, |
76 | //{field: 'store.name', title: __('Store_id')}, | 76 | //{field: 'store.name', title: __('Store_id')}, |
77 | - {field: 'user.mobile', title: __('User_id')}, | ||
78 | - {field: 'course_star', title: __('Course_star'), operate:'BETWEEN'}, | ||
79 | - {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'}, | ||
80 | - {field: 'service_star', title: __('Service_star'), operate:'BETWEEN'}, | ||
81 | - {field: 'content', title: __('Content')}, | 77 | + {field: 'user.mobile', title: __('User_id'),sortable: true}, |
78 | + {field: 'course_star', title: __('Course_star'), operate:'BETWEEN',sortable: true}, | ||
79 | + {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN',sortable: true}, | ||
80 | + {field: 'service_star', title: __('Service_star'), operate:'BETWEEN',sortable: true}, | ||
81 | + {field: 'content', title: __('Content'),sortable: true}, | ||
82 | {field: 'pic', title: __('Pic'), formatter: function (value) { | 82 | {field: 'pic', title: __('Pic'), formatter: function (value) { |
83 | var arr = value.split(','); | 83 | var arr = value.split(','); |
84 | var html = ''; | 84 | var html = ''; |
@@ -86,7 +86,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -86,7 +86,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
86 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' | 86 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' |
87 | } | 87 | } |
88 | return html; | 88 | return html; |
89 | - },events: Table.api.events.image}, | 89 | + },events: Table.api.events.image,sortable: true}, |
90 | {field: 'status', title: __('是否显示'),formatter: function (value, row, index) { | 90 | {field: 'status', title: __('是否显示'),formatter: function (value, row, index) { |
91 | return '<a class="btn-change text-success" data-url="course_sign_start/change" data-id="' + row.id + '"><i class="fa ' + (row.status === 'true' ?'fa-toggle-on fa-flip-horizontal' : 'fa-toggle-off fa-flip-horizontal text-gray' ) + ' fa-2x"></i></a>'; | 91 | return '<a class="btn-change text-success" data-url="course_sign_start/change" data-id="' + row.id + '"><i class="fa ' + (row.status === 'true' ?'fa-toggle-on fa-flip-horizontal' : 'fa-toggle-off fa-flip-horizontal text-gray' ) + ' fa-2x"></i></a>'; |
92 | } | 92 | } |
@@ -26,10 +26,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -26,10 +26,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
26 | {checkbox: true}, | 26 | {checkbox: true}, |
27 | {field: 'id', title: __('Id')}, | 27 | {field: 'id', title: __('Id')}, |
28 | /* {field: 'course_sign_id', title: __('Course_sign_id')},*/ | 28 | /* {field: 'course_sign_id', title: __('Course_sign_id')},*/ |
29 | - {field: 'course_star', title: __('Course_star'), operate:'BETWEEN'}, | ||
30 | - {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'}, | ||
31 | - {field: 'service_star', title: __('Service_star'), operate:'BETWEEN'}, | ||
32 | - {field: 'content', title: __('Content')}, | 29 | + {field: 'course_star', title: __('Course_star'), operate:'BETWEEN',sortable: true}, |
30 | + {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN',sortable: true}, | ||
31 | + {field: 'service_star', title: __('Service_star'), operate:'BETWEEN',sortable: true}, | ||
32 | + {field: 'content', title: __('Content'),sortable: true}, | ||
33 | {field: 'pic', title: __('Pic'), formatter: function (value) { | 33 | {field: 'pic', title: __('Pic'), formatter: function (value) { |
34 | var arr = value.split(','); | 34 | var arr = value.split(','); |
35 | var html = ''; | 35 | var html = ''; |
@@ -37,8 +37,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -37,8 +37,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
37 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' | 37 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' |
38 | } | 38 | } |
39 | return html; | 39 | return html; |
40 | - },events: Table.api.events.image}, | ||
41 | - {field: 'username', title: __('名字')}, | 40 | + },events: Table.api.events.image,sortable: true}, |
41 | + {field: 'username', title: __('名字'),sortable: true}, | ||
42 | {field: 'weChat_pic', title: __('头像'), formatter: function (value) { | 42 | {field: 'weChat_pic', title: __('头像'), formatter: function (value) { |
43 | var arr = value.split(','); | 43 | var arr = value.split(','); |
44 | var html = ''; | 44 | var html = ''; |
@@ -46,11 +46,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -46,11 +46,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
46 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' | 46 | html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>' |
47 | } | 47 | } |
48 | return html; | 48 | return html; |
49 | - },events: Table.api.events.image}, | ||
50 | - {field: 'course.name', title: __('Course_id')}, | ||
51 | - {field: 'store.name', title: __('Store_id')}, | ||
52 | - {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange'}, | ||
53 | - {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange'}, | 49 | + },events: Table.api.events.image,sortable: true}, |
50 | + {field: 'course.name', title: __('Course_id'),sortable: true}, | ||
51 | + {field: 'store.name', title: __('Store_id'),sortable: true}, | ||
52 | + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange',sortable: true}, | ||
53 | + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange',sortable: true}, | ||
54 | {field: 'status', title: __('是否显示'),formatter: function (value, row, index) { | 54 | {field: 'status', title: __('是否显示'),formatter: function (value, row, index) { |
55 | return '<a class="btn-change text-success" data-url="course_sign_start_set/change" data-id="' + row.id + '"><i class="fa ' + (row.status === 'true' ?'fa-toggle-on fa-flip-horizontal' : 'fa-toggle-off fa-flip-horizontal text-gray' ) + ' fa-2x"></i></a>'; | 55 | return '<a class="btn-change text-success" data-url="course_sign_start_set/change" data-id="' + row.id + '"><i class="fa ' + (row.status === 'true' ?'fa-toggle-on fa-flip-horizontal' : 'fa-toggle-off fa-flip-horizontal text-gray' ) + ' fa-2x"></i></a>'; |
56 | } | 56 | } |
@@ -31,15 +31,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -31,15 +31,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
31 | columns: [ | 31 | columns: [ |
32 | [ | 32 | [ |
33 | {checkbox: true}, | 33 | {checkbox: true}, |
34 | - {field: 'id', title: __('Id')}, | ||
35 | - {field: 'course.name', title: __('Course_id')}, | ||
36 | - {field: 'store.name', title: __('Store_id')}, | ||
37 | - {field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange'}, | ||
38 | - {field: 'time_start', title: __('Time_start')}, | ||
39 | - {field: 'count', title: __('Count')}, | ||
40 | - {field: 'notify_count', title: __('Notify_count')}, | ||
41 | - {field: 'sign_count', title: __('Sign_count')}, | ||
42 | - {field: 'time_end', title: __('Time_end')}, | 34 | + {field: 'id', title: __('Id'),sortable: true}, |
35 | + {field: 'course.name', title: __('Course_id'),sortable: true}, | ||
36 | + {field: 'store.name', title: __('Store_id'),sortable: true}, | ||
37 | + {field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange',sortable: true}, | ||
38 | + {field: 'time_start', title: __('Time_start'),sortable: true}, | ||
39 | + {field: 'count', title: __('Count'),sortable: true}, | ||
40 | + {field: 'teacher', title: __('Teacher'),sortable: true}, | ||
41 | + {field: 'notify_count', title: __('Notify_count'),sortable: true}, | ||
42 | + {field: 'sign_count', title: __('Sign_count'),sortable: true}, | ||
43 | + {field: 'time_end', title: __('Time_end'),sortable: true}, | ||
43 | {field: 'status', title: __('Status'), formatter: function (value) { | 44 | {field: 'status', title: __('Status'), formatter: function (value) { |
44 | var color = 'red'; | 45 | var color = 'red'; |
45 | if (value === 'new') { | 46 | if (value === 'new') { |
@@ -49,7 +50,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -49,7 +50,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
49 | color = 'black'; | 50 | color = 'black'; |
50 | } | 51 | } |
51 | return '<span style="color:' + color + '">' + __(value) + '</span>'; | 52 | return '<span style="color:' + color + '">' + __(value) + '</span>'; |
52 | - }}, | 53 | + },sortable: true}, |
53 | { | 54 | { |
54 | field : 'operate', title: __('Operate'), table: table, buttons: [ | 55 | field : 'operate', title: __('Operate'), table: table, buttons: [ |
55 | { | 56 | { |
@@ -98,6 +99,111 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -98,6 +99,111 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
98 | Table.api.bindevent(table); | 99 | Table.api.bindevent(table); |
99 | 100 | ||
100 | //发布 | 101 | //发布 |
102 | + $(document).on("click",".btn-publishAll",function (e) { | ||
103 | + var temp=table.bootstrapTable('getSelections'); | ||
104 | + var arr = []; | ||
105 | + var a = true; | ||
106 | + $.each(temp, function(key, value){ | ||
107 | + if(value.status !=='new'){ | ||
108 | + Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'}); | ||
109 | + a = false; | ||
110 | + return false; | ||
111 | + } | ||
112 | + arr.push(value.id); | ||
113 | + }); | ||
114 | + if(a){ | ||
115 | + $.ajax({ | ||
116 | + type : "POST", | ||
117 | + url : "course_store/publishAll", | ||
118 | + data : { | ||
119 | + arr : arr, | ||
120 | + }, | ||
121 | + dataType: "json", | ||
122 | + success : function (data) { | ||
123 | + if (data.code === 1) { | ||
124 | + Layer.msg('发布成功'); | ||
125 | + Layer.closeAll(); | ||
126 | + $('.btn-refresh').trigger('click') | ||
127 | + } else { | ||
128 | + Layer.msg('发布失败'); | ||
129 | + } | ||
130 | + } | ||
131 | + }); | ||
132 | + } | ||
133 | + | ||
134 | + }); | ||
135 | + | ||
136 | + //发布 | ||
137 | + $(document).on("click",".btn-publishAll",function (e) { | ||
138 | + var temp=table.bootstrapTable('getSelections'); | ||
139 | + var arr = []; | ||
140 | + var a = true; | ||
141 | + $.each(temp, function(key, value){ | ||
142 | + if(value.status !=='new'){ | ||
143 | + Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'}); | ||
144 | + a = false; | ||
145 | + return false; | ||
146 | + } | ||
147 | + arr.push(value.id); | ||
148 | + }); | ||
149 | + if(a){ | ||
150 | + $.ajax({ | ||
151 | + type : "POST", | ||
152 | + url : "course_store/publishAll", | ||
153 | + data : { | ||
154 | + arr : arr, | ||
155 | + }, | ||
156 | + dataType: "json", | ||
157 | + success : function (data) { | ||
158 | + if (data.code === 1) { | ||
159 | + Layer.msg('发布成功'); | ||
160 | + Layer.closeAll(); | ||
161 | + $('.btn-refresh').trigger('click') | ||
162 | + } else { | ||
163 | + Layer.msg('发布失败'); | ||
164 | + } | ||
165 | + } | ||
166 | + }); | ||
167 | + } | ||
168 | + | ||
169 | + }); | ||
170 | + | ||
171 | + //发布 | ||
172 | + $(document).on("click",".btn-deleteAll",function (e) { | ||
173 | + var temp=table.bootstrapTable('getSelections'); | ||
174 | + var arr = []; | ||
175 | + var a = true; | ||
176 | + $.each(temp, function(key, value){ | ||
177 | + if(value.status !=='new'){ | ||
178 | + Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'}); | ||
179 | + a = false; | ||
180 | + return false; | ||
181 | + } | ||
182 | + arr.push(value.id); | ||
183 | + }); | ||
184 | + if(a){ | ||
185 | + $.ajax({ | ||
186 | + type : "POST", | ||
187 | + url : "course_store/deleteAll", | ||
188 | + data : { | ||
189 | + arr : arr, | ||
190 | + }, | ||
191 | + dataType: "json", | ||
192 | + success : function (data) { | ||
193 | + if (data.code === 1) { | ||
194 | + Layer.msg('发布成功'); | ||
195 | + Layer.closeAll(); | ||
196 | + $('.btn-refresh').trigger('click') | ||
197 | + } else { | ||
198 | + Layer.msg('发布失败'); | ||
199 | + } | ||
200 | + } | ||
201 | + }); | ||
202 | + } | ||
203 | + | ||
204 | + }); | ||
205 | + | ||
206 | + //发布 | ||
101 | $(document).on("click",".btn-publish",function (e) { | 207 | $(document).on("click",".btn-publish",function (e) { |
102 | var id = $(this).data('publish-id'); | 208 | var id = $(this).data('publish-id'); |
103 | var status = $(this).data('publish-status'); | 209 | var status = $(this).data('publish-status'); |
@@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | dblClickToEdit: false, | 30 | dblClickToEdit: false, |
31 | columns: [ | 31 | columns: [ |
32 | [ | 32 | [ |
33 | - {checkbox: true}, | 33 | + //{checkbox: true}, |
34 | //{field: 'id', title: __('Id')}, | 34 | //{field: 'id', title: __('Id')}, |
35 | {field: 'product.name', title: __('Product_id')}, | 35 | {field: 'product.name', title: __('Product_id')}, |
36 | {field: 'user.mobile', title: __('User_id')}, | 36 | {field: 'user.mobile', title: __('User_id')}, |
@@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | columns: [ | 30 | columns: [ |
31 | [ | 31 | [ |
32 | {checkbox: true}, | 32 | {checkbox: true}, |
33 | - {field: 'id', title: __('Id')}, | ||
34 | - {field: 'name', title: __('Name')}, | ||
35 | - {field: 'sub_name', title: __('Sub_name')}, | ||
36 | - {field: 'dateCount', title: __('Datecount')}, | ||
37 | - {field: 'price', title: __('Price'), operate:'BETWEEN'}, | ||
38 | - {field: 'count', title: __('Count'), operate:'BETWEEN'}, | 33 | + {field: 'id', title: __('Id'),sortable: true}, |
34 | + {field: 'name', title: __('Name'),sortable: true}, | ||
35 | + {field: 'sub_name', title: __('Sub_name'),sortable: true}, | ||
36 | + {field: 'dateCount', title: __('Datecount'),sortable: true}, | ||
37 | + {field: 'price', title: __('Price'), operate:'BETWEEN',sortable: true}, | ||
38 | + {field: 'count', title: __('Count'), operate:'BETWEEN',sortable: true}, | ||
39 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 39 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
40 | ] | 40 | ] |
41 | ] | 41 | ] |
@@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
29 | dblClickToEdit: false, | 29 | dblClickToEdit: false, |
30 | columns: [ | 30 | columns: [ |
31 | [ | 31 | [ |
32 | - {checkbox: true}, | 32 | + //{checkbox: true}, |
33 | {field: 'id', title: __('Id')}, | 33 | {field: 'id', title: __('Id')}, |
34 | {field: 'name', title: __('Name')}, | 34 | {field: 'name', title: __('Name')}, |
35 | {field: 'address', title: __('Address')}, | 35 | {field: 'address', title: __('Address')}, |
@@ -39,6 +39,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -39,6 +39,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
39 | {field: 'area', title: __('Area')}, | 39 | {field: 'area', title: __('Area')}, |
40 | {field: 'lng', title: __('Lng')}, | 40 | {field: 'lng', title: __('Lng')}, |
41 | {field: 'lat', title: __('Lat')}, | 41 | {field: 'lat', title: __('Lat')}, |
42 | + {field: 'status', title: __('Status'),formatter: function (value, row, index) { | ||
43 | + if(value === 'enable'){ | ||
44 | + return '上架'; | ||
45 | + }else{ | ||
46 | + return '下架'; | ||
47 | + } | ||
48 | + },operate:false}, | ||
49 | + {field: 'status', title: __('Status'),formatter: function (value, row, index) { | ||
50 | + return '<a class="btn-change text-success" data-url="store/change" data-id="' + row.id + '"><i class="fa ' + (row.status == 'enable' ?'fa-toggle-on fa-flip-horizontal' : 'fa-toggle-off fa-flip-horizontal text-gray' ) + ' fa-2x"></i></a>'; | ||
51 | + }, searchList: {"enable": __('上架'), "disable": __('下架')} | ||
52 | + }, | ||
42 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 53 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
43 | ] | 54 | ] |
44 | ] | 55 | ] |
@@ -46,12 +57,63 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -46,12 +57,63 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
46 | 57 | ||
47 | // 为表格绑定事件 | 58 | // 为表格绑定事件 |
48 | Table.api.bindevent(table); | 59 | Table.api.bindevent(table); |
60 | + | ||
61 | + //上架 | ||
62 | + $(document).on("click",".btn-btn-change1All",function (e) { | ||
63 | + var temp=table.bootstrapTable('getSelections'); | ||
64 | + var arr = []; | ||
65 | + $.each(temp, function(key, value){ | ||
66 | + arr.push(value.id); | ||
67 | + }); | ||
68 | + $.ajax({ | ||
69 | + type : "POST", | ||
70 | + url : "store/change1All", | ||
71 | + data : { | ||
72 | + arr : arr, | ||
73 | + }, | ||
74 | + dataType: "json", | ||
75 | + success : function (data) { | ||
76 | + if (data.code === 1) { | ||
77 | + Layer.msg('上架成功'); | ||
78 | + Layer.closeAll(); | ||
79 | + $('.btn-refresh').trigger('click') | ||
80 | + } else { | ||
81 | + Layer.msg('上架失败'); | ||
82 | + } | ||
83 | + } | ||
84 | + }); | ||
85 | + }); | ||
86 | + | ||
87 | + //下架 | ||
88 | + $(document).on("click",".btn-btn-changeAll",function (e) { | ||
89 | + var temp=table.bootstrapTable('getSelections'); | ||
90 | + var arr = []; | ||
91 | + $.each(temp, function(key, value){ | ||
92 | + arr.push(value.id); | ||
93 | + }); | ||
94 | + $.ajax({ | ||
95 | + type : "POST", | ||
96 | + url : "store/changeAll", | ||
97 | + data : { | ||
98 | + arr : arr, | ||
99 | + }, | ||
100 | + dataType: "json", | ||
101 | + success : function (data) { | ||
102 | + if (data.code === 1) { | ||
103 | + Layer.msg('下架成功'); | ||
104 | + Layer.closeAll(); | ||
105 | + $('.btn-refresh').trigger('click') | ||
106 | + } else { | ||
107 | + Layer.msg('下架失败'); | ||
108 | + } | ||
109 | + } | ||
110 | + }); | ||
111 | + }); | ||
49 | }, | 112 | }, |
50 | add: function () { | 113 | add: function () { |
51 | Controller.api.bindevent(); | 114 | Controller.api.bindevent(); |
52 | 115 | ||
53 | $("[data-toggle='addresspicker']").data("callback", function(res){ | 116 | $("[data-toggle='addresspicker']").data("callback", function(res){ |
54 | - console.log(res); | ||
55 | $("#c-province").val(res.info.addressComponents.province); | 117 | $("#c-province").val(res.info.addressComponents.province); |
56 | $("#c-city").val(res.info.addressComponents.city); | 118 | $("#c-city").val(res.info.addressComponents.city); |
57 | $("#c-area").val(res.info.addressComponents.district); | 119 | $("#c-area").val(res.info.addressComponents.district); |
@@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
27 | dblClickToEdit: false, | 27 | dblClickToEdit: false, |
28 | columns: [ | 28 | columns: [ |
29 | [ | 29 | [ |
30 | - {checkbox: true}, | 30 | + //{checkbox: true}, |
31 | {field: 'id', title: __('Id'), sortable: true}, | 31 | {field: 'id', title: __('Id'), sortable: true}, |
32 | {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, | 32 | {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, |
33 | {field: 'username', title: __('Username'), operate: 'LIKE'}, | 33 | {field: 'username', title: __('Username'), operate: 'LIKE'}, |
-
请 注册 或 登录 后发表评论