作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

XIAOPAN

@@ -32,8 +32,9 @@ class AdminOrderController extends AdminBaseController{ @@ -32,8 +32,9 @@ class AdminOrderController extends AdminBaseController{
32 public function index(){ 32 public function index(){
33 $param=$this->request->param(); 33 $param=$this->request->param();
34 $where=array(); 34 $where=array();
  35 + $where['a.state']=['in',[2,3]];
35 if (!empty($param['order_no'])){ 36 if (!empty($param['order_no'])){
36 - $where['order_no']=['like','%'.$param['order_no'].'%']; 37 + $where['a.order_no']=['like','%'.$param['order_no'].'%'];
37 } 38 }
38 if (!empty($param['mobile'])){ 39 if (!empty($param['mobile'])){
39 $where['u.mobile']=['like','%'.$param['mobile'].'%']; 40 $where['u.mobile']=['like','%'.$param['mobile'].'%'];
@@ -41,20 +42,23 @@ class AdminOrderController extends AdminBaseController{ @@ -41,20 +42,23 @@ class AdminOrderController extends AdminBaseController{
41 if (!empty($param['users_id'])){ 42 if (!empty($param['users_id'])){
42 $where['u.id']=$param['users_id']; 43 $where['u.id']=$param['users_id'];
43 } 44 }
44 - $where['state']=['in',[2,3]]; 45 + if (!empty($param['state'])){
  46 + $where['a.state']=$param['state'];
  47 + }
45 $Order=new OrderModel(); 48 $Order=new OrderModel();
46 $data=$Order->alias('a') 49 $data=$Order->alias('a')
47 ->join('users u','a.users_id=u.id') 50 ->join('users u','a.users_id=u.id')
48 // ->field('a.*,b.serial_number,b.hospital') 51 // ->field('a.*,b.serial_number,b.hospital')
49 // ->join('equipment b','a.eq_name=b.name') 52 // ->join('equipment b','a.eq_name=b.name')
50 ->where($where) 53 ->where($where)
51 - ->order('end_time','desc') 54 + ->order('a.end_time','desc')
52 ->paginate(10); 55 ->paginate(10);
53 $this->assign('data',$data); 56 $this->assign('data',$data);
54 $this->assign('hospital', isset($param['hospital']) ? $param['hospital'] : ''); 57 $this->assign('hospital', isset($param['hospital']) ? $param['hospital'] : '');
55 $this->assign('order_no', isset($param['order_no']) ? $param['order_no'] : ''); 58 $this->assign('order_no', isset($param['order_no']) ? $param['order_no'] : '');
56 $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : ''); 59 $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
57 $this->assign('users_id', isset($param['users_id']) ? $param['users_id'] : ''); 60 $this->assign('users_id', isset($param['users_id']) ? $param['users_id'] : '');
  61 + $this->assign('state', isset($param['state']) ? $param['state'] : '');
58 $this->assign('start_number', isset($param['start_number']) ? $param['start_number'] : ''); 62 $this->assign('start_number', isset($param['start_number']) ? $param['start_number'] : '');
59 $this->assign('end_number', isset($param['end_number']) ? $param['end_number'] : ''); 63 $this->assign('end_number', isset($param['end_number']) ? $param['end_number'] : '');
60 return $this->fetch(); 64 return $this->fetch();
@@ -15,6 +15,12 @@ @@ -15,6 +15,12 @@
15 用户ID: 15 用户ID:
16 <input type="text" class="form-control" name="users_id" style="width: 200px;" 16 <input type="text" class="form-control" name="users_id" style="width: 200px;"
17 value="{$users_id|default=''}" placeholder="请输入用户id..."> 17 value="{$users_id|default=''}" placeholder="请输入用户id...">
  18 + 支付状态:
  19 + <select type="text" class="form-control" name="state" style="width: 200px;">
  20 + <option value="">全部</option>
  21 + <option value="2" <eq name="state" value="2">selected</eq>>待支付</option>
  22 + <option value="3" <eq name="state" value="3">selected</eq>>已支付</option>
  23 + </select>
18 <input type="submit" class="btn btn-primary" value="搜索"/> 24 <input type="submit" class="btn btn-primary" value="搜索"/>
19 <a class="btn btn-danger" href="{:url('AdminOrder/index')}">清空</a> 25 <a class="btn btn-danger" href="{:url('AdminOrder/index')}">清空</a>
20 </form> 26 </form>