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

后台修改

@@ -33,9 +33,21 @@ class Order extends Backend @@ -33,9 +33,21 @@ class Order extends Backend
33 */ 33 */
34 /** 34 /**
35 * 查看 35 * 查看
  36 + *
  37 + * @param null $ids
  38 + *
  39 + * @return string|\think\response\Json
  40 + * @throws \think\Exception
  41 + * @throws \think\db\exception\DataNotFoundException
  42 + * @throws \think\db\exception\ModelNotFoundException
  43 + * @throws \think\exception\DbException
36 */ 44 */
37 - public function index() 45 + public function index($ids = NULL)
38 { 46 {
  47 +
  48 + if($ids){
  49 + $this->assign("user_id", $ids);
  50 + }
39 //设置过滤方法 51 //设置过滤方法
40 $this->request->filter(['strip_tags']); 52 $this->request->filter(['strip_tags']);
41 if ($this->request->isAjax()) { 53 if ($this->request->isAjax()) {
@@ -44,6 +56,22 @@ class Order extends Backend @@ -44,6 +56,22 @@ class Order extends Backend
44 return $this->selectpage(); 56 return $this->selectpage();
45 } 57 }
46 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 58 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  59 + if($ids){
  60 + $total = $this->model
  61 + ->where($where)
  62 + ->where(['user_id'=>$ids])
  63 + ->with(['user','product'])
  64 + ->order($sort, $order)
  65 + ->count();
  66 +
  67 + $list = $this->model
  68 + ->where($where)
  69 + ->where(['user_id'=>$ids])
  70 + ->with(['user','product'])
  71 + ->order($sort, $order)
  72 + ->limit($offset, $limit)
  73 + ->select();
  74 + }else{
47 $total = $this->model 75 $total = $this->model
48 ->where($where) 76 ->where($where)
49 ->with(['user','product']) 77 ->with(['user','product'])
@@ -56,6 +84,8 @@ class Order extends Backend @@ -56,6 +84,8 @@ class Order extends Backend
56 ->order($sort, $order) 84 ->order($sort, $order)
57 ->limit($offset, $limit) 85 ->limit($offset, $limit)
58 ->select(); 86 ->select();
  87 + }
  88 +
59 89
60 $list = collection($list)->toArray(); 90 $list = collection($list)->toArray();
61 $result = array("total" => $total, "rows" => $list); 91 $result = array("total" => $total, "rows" => $list);
@@ -14,6 +14,7 @@ return [ @@ -14,6 +14,7 @@ return [
14 'Birthday' => '出生日期', 14 'Birthday' => '出生日期',
15 'Area' => '所在地区', 15 'Area' => '所在地区',
16 'Address' => '详细地址', 16 'Address' => '详细地址',
  17 + 'Detail' => '订单管理',
17 18
18 19
19 'Level' => '等级', 20 'Level' => '等级',
@@ -46,15 +46,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -46,15 +46,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
46 {field: 'area', title: __('Area'), operate: 'LIKE'}, 46 {field: 'area', title: __('Area'), operate: 'LIKE'},
47 {field: 'address', title: __('Address'), operate: 'LIKE'}, 47 {field: 'address', title: __('Address'), operate: 'LIKE'},
48 {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, 48 {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
49 - /* {field: 'pay_status', title: __('Status'),formatter: function (value, row, index) {  
50 - if(value === 'paid'){  
51 - return '会员';  
52 - }else if(value === 'unpaid'){  
53 - return '非会员';  
54 - }else{  
55 - return '其他'; 49 +
  50 + {
  51 + field : 'operate', title: __('Operate'), table: table, buttons: [
  52 + {
  53 + name : 'detail',
  54 + text : __('Detail'),
  55 + icon : 'fa fa-list',
  56 + classname: 'btn btn-info btn-xs btn-detail btn-dialog',
  57 + }
  58 + ],
  59 + events: Table.api.events.operate, formatter: function (value, row, index) {
  60 + var that = $.extend({}, this);
  61 + that.buttons[0].url = 'order/index?ids=' + row.id;
  62 + return Table.api.formatter.operate.call(that, value, row, index);
  63 + }
56 } 64 }
57 - },/!*, searchList: {normal: __('Normal'), hidden: __('Hidden')}*!/},*/  
58 ] 65 ]
59 ] 66 ]
60 }); 67 });