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

后台修改

... ... @@ -33,9 +33,21 @@ class Order extends Backend
*/
/**
* 查看
*
* @param null $ids
*
* @return string|\think\response\Json
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
public function index($ids = NULL)
{
if($ids){
$this->assign("user_id", $ids);
}
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
... ... @@ -44,6 +56,22 @@ class Order extends Backend
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
if($ids){
$total = $this->model
->where($where)
->where(['user_id'=>$ids])
->with(['user','product'])
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where(['user_id'=>$ids])
->with(['user','product'])
->order($sort, $order)
->limit($offset, $limit)
->select();
}else{
$total = $this->model
->where($where)
->with(['user','product'])
... ... @@ -56,6 +84,8 @@ class Order extends Backend
->order($sort, $order)
->limit($offset, $limit)
->select();
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
... ...
... ... @@ -14,6 +14,7 @@ return [
'Birthday' => '出生日期',
'Area' => '所在地区',
'Address' => '详细地址',
'Detail' => '订单管理',
'Level' => '等级',
... ...
... ... @@ -46,15 +46,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'area', title: __('Area'), operate: 'LIKE'},
{field: 'address', title: __('Address'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
/* {field: 'pay_status', title: __('Status'),formatter: function (value, row, index) {
if(value === 'paid'){
return '会员';
}else if(value === 'unpaid'){
return '非会员';
}else{
return '其他';
{
field : 'operate', title: __('Operate'), table: table, buttons: [
{
name : 'detail',
text : __('Detail'),
icon : 'fa fa-list',
classname: 'btn btn-info btn-xs btn-detail btn-dialog',
}
],
events: Table.api.events.operate, formatter: function (value, row, index) {
var that = $.extend({}, this);
that.buttons[0].url = 'order/index?ids=' + row.id;
return Table.api.formatter.operate.call(that, value, row, index);
}
}
},/!*, searchList: {normal: __('Normal'), hidden: __('Hidden')}*!/},*/
]
]
});
... ...