AdminOrderController.php
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Created by PhpStorm.
* User: ruidiudiu
* Date: 2018/11/23
* Time: 11:58
*/
namespace app\portal\controller;
use app\portal\model\EquipmentModel;
use app\portal\model\OrderModel;
use cmf\controller\AdminBaseController;
use EasyWeChat\Payment\Order;
use think\Db;
/**
* Class AdminOrderController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'订单统计',
* 'action' =>'index',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 1,
* 'icon' =>'th',
* 'remark' =>'订单统计'
* )
*/
class AdminOrderController extends AdminBaseController{
public function index(){
$param=$this->request->param();
$where=array();
$where['a.state']=['in',[2,3]];
if (!empty($param['order_no'])){
$where['a.order_no']=['like','%'.$param['order_no'].'%'];
}
if (!empty($param['mobile'])){
$where['u.mobile']=['like','%'.$param['mobile'].'%'];
}
if (!empty($param['users_id'])){
$where['u.id']=$param['users_id'];
}
if (!empty($param['state'])){
$where['a.state']=$param['state'];
}
$Order=new OrderModel();
$data=$Order->alias('a')
->join('users u','a.users_id=u.id')
// ->field('a.*,b.serial_number,b.hospital')
// ->join('equipment b','a.eq_name=b.name')
->where($where)
->order('a.end_time','desc')
->paginate(10);
$this->assign('data',$data);
$this->assign('hospital', isset($param['hospital']) ? $param['hospital'] : '');
$this->assign('order_no', isset($param['order_no']) ? $param['order_no'] : '');
$this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
$this->assign('users_id', isset($param['users_id']) ? $param['users_id'] : '');
$this->assign('state', isset($param['state']) ? $param['state'] : '');
$this->assign('start_number', isset($param['start_number']) ? $param['start_number'] : '');
$this->assign('end_number', isset($param['end_number']) ? $param['end_number'] : '');
return $this->fetch();
}
//更改订单状态
public function endOrder(){
$param=$this->request->param();
Db::name('order')
->where('id',$param['id'])
->update(['state'=>3]);
$this->success('完成订单成功');
}
}