作者 xwp
1 个管道 的构建 通过 耗费 10 秒

全部bug

... ... @@ -135,12 +135,107 @@ class Category extends Backend
/**
* Selectpage搜索
* Selectpage的实现方法
*
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
*
* @internal
*/
public function selectpage()
{
return parent::selectpage();
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array)$this->request->request("q_word/a");
//当前页
$page = $this->request->request("pageNumber");
//分页大小
$pagesize = $this->request->request("pageSize");
//搜索条件
$andor = $this->request->request("andOr", "and", "strtoupper");
//排序方式
$orderby = (array)$this->request->request("orderBy/a");
//显示的字段
$field = $this->request->request("showField");
//主键
$primarykey = $this->request->request("keyField");
//主键值
$primaryvalue = $this->request->request("keyValue");
//搜索字段
$searchfield = (array)$this->request->request("searchField/a");
//自定义搜索条件
$custom = (array)$this->request->request("custom/a");
//是否返回树形结构
$istree = $this->request->request("isTree", 0);
$ishtml = $this->request->request("isHtml", 0);
if ($istree) {
$word = [];
$pagesize = 99999;
}
$order = [];
foreach ($orderby as $k => $v) {
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue !== null) {
$where = [$primarykey => ['in', $primaryvalue]];
} else {
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
$logic = $andor == 'AND' ? '&' : '|';
$searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield;
foreach ($word as $k => $v) {
$query->where(str_replace(',', $logic, $searchfield), "like", "%{$v}%");
}
if ($custom && is_array($custom)) {
foreach ($custom as $k => $v) {
if (is_array($v) && 2 == count($v)) {
$query->where($k, trim($v[0]), $v[1]);
} else {
$query->where($k, '=', $v);
}
}
}
};
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = [];
$total = $this->model->where($where)->where(['status'=>'normal'])->count();
if ($total > 0) {
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$datalist = $this->model->where($where)->where(['status'=>'normal'])
->order($order)
->page($page, $pagesize)
->field($this->selectpageFields)
->select();
foreach ($datalist as $index => $item) {
unset($item['password'], $item['salt']);
$list[] = [
$primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '',
$field => isset($item[$field]) ? $item[$field] : '',
'pid' => isset($item['pid']) ? $item['pid'] : 0
];
}
if ($istree && !$primaryvalue) {
$tree = Tree::instance();
$tree->init(collection($list)->toArray(), 'pid');
$list = $tree->getTreeList($tree->getTreeArray(0), $field);
if (!$ishtml) {
foreach ($list as &$item) {
$item = str_replace(' ', ' ', $item);
}
unset($item);
}
}
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
}
}
... ...
... ... @@ -45,6 +45,24 @@ class CourseSignStartSet extends Backend
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$admin = $this->auth->getUserInfo();
if (!empty($admin['store_id'])) {
$total = $this->model
->with(['store','course'])
->where($where)
->where(['store_id'=>$admin['store_id']])
->order($sort, $order)
->count();
$list = $this->model
->with(['store','course'])
->where($where)
->where(['store_id'=>$admin['store_id']])
->order($sort, $order)
->limit($offset, $limit)
->select();
}else{
$total = $this->model
->with(['store','course'])
->where($where)
... ... @@ -57,6 +75,10 @@ class CourseSignStartSet extends Backend
->order($sort, $order)
->limit($offset, $limit)
->select();
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
... ... @@ -87,4 +109,23 @@ class CourseSignStartSet extends Backend
$this->success("切换成功");
}
public function add()
{
$admin = $this->auth->getUserInfo();
if (!empty($admin['store_id'])) {
$this->assign("store_id", $admin['store_id']);
}
return parent::add();
}
public function edit($ids = NULL)
{
$admin = $this->auth->getUserInfo();
if (!empty($admin['store_id'])) {
$this->assign("store_id", $admin['store_id']);
}
return parent::edit($ids);
}
}
... ...
... ... @@ -300,4 +300,95 @@ class CourseStore extends Backend
$this->success();
}
/**
* 发布
*
* @param $arr
*
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function publishAll($arr){
foreach ($arr as $k) {
$courseStore = new \app\admin\model\CourseStore;
$courseStore = $courseStore->where(['id'=>$k])->find();
if(empty($courseStore)){
continue;
}
$courseStore = $courseStore->toArray();
if($courseStore['status'] != 'new'){
continue;
}
$courseStore = new \app\admin\model\CourseStore;
$courseStore->save(['status'=>'confirmed'],['id'=>$k]);
}
$this->success('ok',null);
}
/**
* 发布
*
* @param $arr
*
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function cancelAll($arr){
foreach ($arr as $k) {
$courseStore = new \app\admin\model\CourseStore;
$courseStore = $courseStore->where(['id'=>$k])->find();
if(empty($courseStore)){
continue;
}
$courseStore = $courseStore->toArray();
if($courseStore['status'] != 'confirmed'){
continue;
}
$courseStore = new \app\admin\model\CourseStore;
$courseStore->save(['status'=>'cancel'],['id'=>$k]);
}
$this->success('ok',null);
}
/**
* 发布
*
* @param $arr
*
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function deleteAll($arr){
foreach ($arr as $k) {
$courseStore = new \app\admin\model\CourseStore;
$courseStore = $courseStore->where(['id'=>$k])->find();
if(empty($courseStore)){
continue;
}
$courseStore = $courseStore->toArray();
if($courseStore['status'] != 'new'){
continue;
}
$courseStore = new \app\admin\model\CourseStore;
$courseStore->where(['id'=>$k])->delete();
}
$this->success('ok',null);
}
}
... ...
... ... @@ -81,4 +81,77 @@ class Store extends Backend
return $this->view->fetch();
}
/**
* 切换
* @param $ids
* @return mixed
*/
public function change($ids = '')
{
//你需要在此做具体的操作逻辑
$data = $this->model->where(['id'=>$ids])->find();
if(empty($data)){
$this->error("没有这个门店",$ids);
}
$data = $data->toArray();
($data['status'] == 'enable')?$status = 'disable':$status = 'enable';
$data = $this->model->where(['id'=>$ids])->update(['status'=>$status]);
$this->success("切换成功");
}
/**
* 上架
*
* @param $arr
*
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function change1All($arr){
foreach ($arr as $k) {
$store = new \app\admin\model\Store();
$store = $store->where(['id'=>$k])->find();
if(empty($store)){
continue;
}
$store = new \app\admin\model\Store;
$store->save(['status'=>'enable'],['id'=>$k]);
}
$this->success('ok',null);
}
/**
* 下架
*
* @param $arr
*
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function changeAll($arr){
foreach ($arr as $k) {
$store = new \app\admin\model\Store();
$store = $store->where(['id'=>$k])->find();
if(empty($store)){
continue;
}
$store = new \app\admin\model\Store;
$store->save(['status'=>'disable'],['id'=>$k]);
}
$this->success('ok',null);
}
}
... ...
... ... @@ -9,10 +9,11 @@ return [
'Order_id' => '会员',
'Date' => '日期',
'Start' => '开始时间',
'End' => '结束',
'End' => '结束时间',
'create' => '结束',
'publish' => '已预约',
'finish' => '已完成',
'evaluate' => '已评价',
'miss' => '缺课',
'Teacher' => '上课老师',
];
... ...
... ... @@ -17,4 +17,5 @@ return [
'cancel' => '已取消',
'Publish' => '发布',
'Detail' => '报名情况',
'Teacher' => '上课老师',
];
... ...
... ... @@ -9,7 +9,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[store_id]', $storedata, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
{:build_select('row[store_id]', $storedata, null, ['class'=>'form-control selectpicker'])}
</div>
</div>
<div class="form-group">
... ...
... ... @@ -65,12 +65,23 @@
<input id="c-course_id" data-source="course/index" class="form-control selectpage" name="row[course_id]" type="text" value="">
</div>
</div>
{if isset($store_id)}
<div class="form-group" style="display: none">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-store_id" data-rule="required" data-source="store/index" class="form-control" name="row[store_id]" type="text" value="{$store_id}">
</div>
</div>
{else}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-store_id" data-source="store/index" class="form-control selectpage" name="row[store_id]" type="text" value="">
</div>
</div>
{/if}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -60,12 +60,22 @@
<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}">
</div>
</div>
{if isset($store_id)}
<div class="form-group" tyle="display: none">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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}">
</div>
</div>
{else}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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}">
</div>
</div>
{/if}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('名字')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -29,6 +29,13 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Teacher')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-teacher" data-rule="required" class="form-control" name="row[teacher]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number">
... ...
... ... @@ -20,6 +20,13 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Teacher')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-teacher" data-rule="required" class="form-control" name="row[teacher]" type="text" value="{$row.teacher|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Notify_count')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-notify_count" data-rule="required integer" class="form-control" name="row[notify_count]" type="number" value="{$row.notify_count|htmlentities}">
... ...
... ... @@ -21,6 +21,9 @@
<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>
</ul>
</div>-->
<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>
<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>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
... ...
... ... @@ -16,7 +16,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Map_info')}:</label>
<div class="col-xs-12 col-sm-8">
<button type="button" class="btn btn-success" data-toggle="addresspicker">选择地图</button>
<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}">
<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}">
</div>
</div>
<div class="form-group">
... ...
... ... @@ -19,6 +19,8 @@
<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>
</ul>
</div>-->
<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>
<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>
</div>
... ...
... ... @@ -38,7 +38,7 @@ class Store extends Api
if(!empty($value)&&!empty($type)){
$where[$type] = $value;
}
$where['status'] = 'enable';
$store = new \app\admin\model\Store();
$store = $store->where($where)->select();
... ... @@ -115,7 +115,7 @@ class Store extends Api
}
$store = new \app\admin\model\Store();
$store = $store->where(['id'=>$id])->find();
$store = $store->where(['id'=>$id,'status'=>'enable'])->find();
if(empty($store)){
$this->error(__('Invalid parameters'));
}
... ...
... ... @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'category.name', title: __('Category_id')},
{field: 'level.name', title: __('Level_id')},
{field: 'sub_name', title: __('Sub_name')},
{field: 'cover', title: __('Cover'),formatter: Table.api.formatter.image, events: Table.api.events.image},
{field: 'id', title: __('Id'),sortable: true},
{field: 'name', title: __('Name'),sortable: true},
{field: 'category.name', title: __('Category_id'),sortable: true},
{field: 'level.name', title: __('Level_id'),sortable: true},
{field: 'sub_name', title: __('Sub_name'),sortable: true},
{field: 'cover', title: __('Cover'),formatter: Table.api.formatter.image, events: Table.api.events.image,sortable: true},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...
... ... @@ -30,8 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'id', title: __('Id'),sortable: true},
{field: 'name', title: __('Name'),sortable: true},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...
... ... @@ -32,12 +32,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
/* {field: 'id', title: __('Id')},*/
{field: 'course.name', title: __('Course_id')},
{field: 'store.name', title: __('Store_id')},
{field: 'user.mobile', title: __('User_id')},
{field: 'course_store.date', title: __('Date')},
{field: 'course_store.time_start', title: __('Start')},
{field: 'course_store.time_end', title: __('End')},
{field: 'course.name', title: __('Course_id'),sortable: true},
{field: 'store.name', title: __('Store_id'),sortable: true},
{field: 'user.mobile', title: __('User_id'),sortable: true},
{field: 'course_store.teacher', title: __('Teacher'),sortable: true},
{field: 'course_store.date', title: __('Date'),sortable: true},
{field: 'course_store.time_start', title: __('Start'),sortable: true},
{field: 'course_store.time_end', title: __('End'),sortable: true},
{
field: 'status', title: __('Status'), formatter: function (value) {
var color = '';
... ... @@ -45,7 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
color = '';
}
return '<span style="color:' + color + '">' + __(value) + '</span>';
}
},sortable: true
},
/*{field: 'order_id', title: __('Order_id')},*/
{
... ...
... ... @@ -74,11 +74,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'course_sign_id', title: __('Course_sign_id')},*/
//{field: 'course.name', title: __('Course_id')},
//{field: 'store.name', title: __('Store_id')},
{field: 'user.mobile', title: __('User_id')},
{field: 'course_star', title: __('Course_star'), operate:'BETWEEN'},
{field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'},
{field: 'service_star', title: __('Service_star'), operate:'BETWEEN'},
{field: 'content', title: __('Content')},
{field: 'user.mobile', title: __('User_id'),sortable: true},
{field: 'course_star', title: __('Course_star'), operate:'BETWEEN',sortable: true},
{field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN',sortable: true},
{field: 'service_star', title: __('Service_star'), operate:'BETWEEN',sortable: true},
{field: 'content', title: __('Content'),sortable: true},
{field: 'pic', title: __('Pic'), formatter: function (value) {
var arr = value.split(',');
var html = '';
... ... @@ -86,7 +86,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>'
}
return html;
},events: Table.api.events.image},
},events: Table.api.events.image,sortable: true},
{field: 'status', title: __('是否显示'),formatter: function (value, row, index) {
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>';
}
... ...
... ... @@ -26,10 +26,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true},
{field: 'id', title: __('Id')},
/* {field: 'course_sign_id', title: __('Course_sign_id')},*/
{field: 'course_star', title: __('Course_star'), operate:'BETWEEN'},
{field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'},
{field: 'service_star', title: __('Service_star'), operate:'BETWEEN'},
{field: 'content', title: __('Content')},
{field: 'course_star', title: __('Course_star'), operate:'BETWEEN',sortable: true},
{field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN',sortable: true},
{field: 'service_star', title: __('Service_star'), operate:'BETWEEN',sortable: true},
{field: 'content', title: __('Content'),sortable: true},
{field: 'pic', title: __('Pic'), formatter: function (value) {
var arr = value.split(',');
var html = '';
... ... @@ -37,8 +37,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>'
}
return html;
},events: Table.api.events.image},
{field: 'username', title: __('名字')},
},events: Table.api.events.image,sortable: true},
{field: 'username', title: __('名字'),sortable: true},
{field: 'weChat_pic', title: __('头像'), formatter: function (value) {
var arr = value.split(',');
var html = '';
... ... @@ -46,11 +46,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
html += '<a href="javascript:"><img class="img-sm img-center" src="'+Fast.api.cdnurl(arr[i])+'"></a>'
}
return html;
},events: Table.api.events.image},
{field: 'course.name', title: __('Course_id')},
{field: 'store.name', title: __('Store_id')},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange'},
},events: Table.api.events.image,sortable: true},
{field: 'course.name', title: __('Course_id'),sortable: true},
{field: 'store.name', title: __('Store_id'),sortable: true},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange',sortable: true},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange',sortable: true},
{field: 'status', title: __('是否显示'),formatter: function (value, row, index) {
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>';
}
... ...
... ... @@ -31,15 +31,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'course.name', title: __('Course_id')},
{field: 'store.name', title: __('Store_id')},
{field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange'},
{field: 'time_start', title: __('Time_start')},
{field: 'count', title: __('Count')},
{field: 'notify_count', title: __('Notify_count')},
{field: 'sign_count', title: __('Sign_count')},
{field: 'time_end', title: __('Time_end')},
{field: 'id', title: __('Id'),sortable: true},
{field: 'course.name', title: __('Course_id'),sortable: true},
{field: 'store.name', title: __('Store_id'),sortable: true},
{field: 'date', title: __('Date'), operate: 'RANGE', addclass: 'datetimerange',sortable: true},
{field: 'time_start', title: __('Time_start'),sortable: true},
{field: 'count', title: __('Count'),sortable: true},
{field: 'teacher', title: __('Teacher'),sortable: true},
{field: 'notify_count', title: __('Notify_count'),sortable: true},
{field: 'sign_count', title: __('Sign_count'),sortable: true},
{field: 'time_end', title: __('Time_end'),sortable: true},
{field: 'status', title: __('Status'), formatter: function (value) {
var color = 'red';
if (value === 'new') {
... ... @@ -49,7 +50,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
color = 'black';
}
return '<span style="color:' + color + '">' + __(value) + '</span>';
}},
},sortable: true},
{
field : 'operate', title: __('Operate'), table: table, buttons: [
{
... ... @@ -98,6 +99,111 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.bindevent(table);
//发布
$(document).on("click",".btn-publishAll",function (e) {
var temp=table.bootstrapTable('getSelections');
var arr = [];
var a = true;
$.each(temp, function(key, value){
if(value.status !=='new'){
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
a = false;
return false;
}
arr.push(value.id);
});
if(a){
$.ajax({
type : "POST",
url : "course_store/publishAll",
data : {
arr : arr,
},
dataType: "json",
success : function (data) {
if (data.code === 1) {
Layer.msg('发布成功');
Layer.closeAll();
$('.btn-refresh').trigger('click')
} else {
Layer.msg('发布失败');
}
}
});
}
});
//发布
$(document).on("click",".btn-publishAll",function (e) {
var temp=table.bootstrapTable('getSelections');
var arr = [];
var a = true;
$.each(temp, function(key, value){
if(value.status !=='new'){
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
a = false;
return false;
}
arr.push(value.id);
});
if(a){
$.ajax({
type : "POST",
url : "course_store/publishAll",
data : {
arr : arr,
},
dataType: "json",
success : function (data) {
if (data.code === 1) {
Layer.msg('发布成功');
Layer.closeAll();
$('.btn-refresh').trigger('click')
} else {
Layer.msg('发布失败');
}
}
});
}
});
//发布
$(document).on("click",".btn-deleteAll",function (e) {
var temp=table.bootstrapTable('getSelections');
var arr = [];
var a = true;
$.each(temp, function(key, value){
if(value.status !=='new'){
Layer.open({title: '错误', content: '含有已发布或取消的课程', btn: '确定'});
a = false;
return false;
}
arr.push(value.id);
});
if(a){
$.ajax({
type : "POST",
url : "course_store/deleteAll",
data : {
arr : arr,
},
dataType: "json",
success : function (data) {
if (data.code === 1) {
Layer.msg('发布成功');
Layer.closeAll();
$('.btn-refresh').trigger('click')
} else {
Layer.msg('发布失败');
}
}
});
}
});
//发布
$(document).on("click",".btn-publish",function (e) {
var id = $(this).data('publish-id');
var status = $(this).data('publish-status');
... ...
... ... @@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
dblClickToEdit: false,
columns: [
[
{checkbox: true},
//{checkbox: true},
//{field: 'id', title: __('Id')},
{field: 'product.name', title: __('Product_id')},
{field: 'user.mobile', title: __('User_id')},
... ...
... ... @@ -30,12 +30,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'sub_name', title: __('Sub_name')},
{field: 'dateCount', title: __('Datecount')},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'count', title: __('Count'), operate:'BETWEEN'},
{field: 'id', title: __('Id'),sortable: true},
{field: 'name', title: __('Name'),sortable: true},
{field: 'sub_name', title: __('Sub_name'),sortable: true},
{field: 'dateCount', title: __('Datecount'),sortable: true},
{field: 'price', title: __('Price'), operate:'BETWEEN',sortable: true},
{field: 'count', title: __('Count'), operate:'BETWEEN',sortable: true},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...
... ... @@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
dblClickToEdit: false,
columns: [
[
{checkbox: true},
//{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name')},
{field: 'address', title: __('Address')},
... ... @@ -39,6 +39,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'area', title: __('Area')},
{field: 'lng', title: __('Lng')},
{field: 'lat', title: __('Lat')},
{field: 'status', title: __('Status'),formatter: function (value, row, index) {
if(value === 'enable'){
return '上架';
}else{
return '下架';
}
},operate:false},
{field: 'status', title: __('Status'),formatter: function (value, row, index) {
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>';
}, searchList: {"enable": __('上架'), "disable": __('下架')}
},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ... @@ -46,12 +57,63 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 为表格绑定事件
Table.api.bindevent(table);
//上架
$(document).on("click",".btn-btn-change1All",function (e) {
var temp=table.bootstrapTable('getSelections');
var arr = [];
$.each(temp, function(key, value){
arr.push(value.id);
});
$.ajax({
type : "POST",
url : "store/change1All",
data : {
arr : arr,
},
dataType: "json",
success : function (data) {
if (data.code === 1) {
Layer.msg('上架成功');
Layer.closeAll();
$('.btn-refresh').trigger('click')
} else {
Layer.msg('上架失败');
}
}
});
});
//下架
$(document).on("click",".btn-btn-changeAll",function (e) {
var temp=table.bootstrapTable('getSelections');
var arr = [];
$.each(temp, function(key, value){
arr.push(value.id);
});
$.ajax({
type : "POST",
url : "store/changeAll",
data : {
arr : arr,
},
dataType: "json",
success : function (data) {
if (data.code === 1) {
Layer.msg('下架成功');
Layer.closeAll();
$('.btn-refresh').trigger('click')
} else {
Layer.msg('下架失败');
}
}
});
});
},
add: function () {
Controller.api.bindevent();
$("[data-toggle='addresspicker']").data("callback", function(res){
console.log(res);
$("#c-province").val(res.info.addressComponents.province);
$("#c-city").val(res.info.addressComponents.city);
$("#c-area").val(res.info.addressComponents.district);
... ...
... ... @@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
dblClickToEdit: false,
columns: [
[
{checkbox: true},
//{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'username', title: __('Username'), operate: 'LIKE'},
... ...