作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

后台平台订单、用户列表优化

1 -<?php  
2 -namespace app\admin\controller;  
3 -  
4 -use app\admin\model\RouteModel;  
5 -use cmf\controller\AdminBaseController;  
6 -use think\Db;  
7 -class OrderscourierController extends AdminBaseController{  
8 -  
9 - /**  
10 - *平台订单列表  
11 - */  
12 - public function order_list(){  
13 - $param = $this->request->param();  
14 - $where = [  
15 - "indent_type" => 1  
16 - ];  
17 - if(!empty($param['start_time']) && !empty($param['end_time'])){  
18 - $start_time = strtotime($param['start_time']);  
19 - $end_time = strtotime($param['end_time']);  
20 - $where['create_time'] = [['>=',$start_time],['<=',$end_time]];  
21 - }  
22 - if(!empty($param['keyword'])){  
23 - $where['order_number'] = ['like','%'.trim($param['keyword']).'%'];  
24 - }  
25 - if(!empty($param['state'])){  
26 - $where['state'] = $param['state'];  
27 - }  
28 - $data = Db::name('indent')->where($where)->where("state = 2 or state = 3 or state = 5")->order('create_time','DESC')->paginate(12);  
29 - $data->appends($param);  
30 - $this->assign('start_time',!empty($param['start_time']) ? $param['start_time'] : '');  
31 - $this->assign('end_time',!empty($param['end_time']) ? $param['end_time'] : '');  
32 - $this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');  
33 - $this->assign('state',!empty($param['state']) ? $param['state'] : '');  
34 - $this->assign('data',$data);  
35 - return $this->fetch();  
36 -  
37 - }  
38 -  
39 - /**  
40 - *平台订单查看  
41 - */  
42 - public function plat_view(){  
43 -  
44 - $id = $this -> request -> param();  
45 - $indent_id = $id['id'];  
46 - $data_goods = Db::name('indent_goods') -> where('indent_id',$indent_id) -> select();  
47 - $data_in = Db::name('indent') -> where('id',$indent_id) -> find();  
48 - $this -> assign('data_goods',$data_goods);  
49 - $this -> assign('data_in',$data_in);  
50 - //地址查询  
51 - $address = Db::name('address') -> where("id",$data_in['indent_address']) -> find();  
52 - if(!empty($address)){  
53 - $this -> assign('address',$address);  
54 - }else{  
55 - $this -> assign('address',null);  
56 - }  
57 -  
58 - return $this -> fetch();  
59 -  
60 - }  
61 -  
62 - /**  
63 - * 查看物流信息  
64 - */  
65 - public function logistics_information(){  
66 -  
67 - $indent_id = $this -> request -> param();  
68 - $bird = new BirdController();  
69 - $logistics = $bird -> getOrder($indent_id['id']);  
70 - $this -> assign('logistics',$logistics['data']['traces']);  
71 - return $this -> fetch();  
72 -  
73 - }  
74 -  
75 - /**  
76 - * 发货  
77 - * @adminMenu(  
78 - * 'name' => '发货',  
79 - * 'parent' => 'index',  
80 - * 'display'=> false,  
81 - * 'hasView'=> false,  
82 - * 'order' => 10000,  
83 - * 'icon' => '',  
84 - * 'remark' => '发货',  
85 - * 'param' => ''  
86 - * )  
87 - */  
88 - public function fahuo()  
89 - {  
90 - $id = $this->request->param('id', 0, 'intval');  
91 - if($this->request->isPost()) {  
92 - $param = $this->request->param();  
93 - $url = $param['url'];  
94 - unset($param['url']);  
95 - // 判断订单是否可发货  
96 - $info = Db::name('indent')->where('id',$param['id'])->find();  
97 - if (!$info) {  
98 - $this->error("订单不存在!");  
99 - }  
100 - if ($info['state'] != 2) {  
101 - $this->error("订单无法发货!");  
102 - }  
103 - // 修改发货状态  
104 - $param['state'] = 5;  
105 - $result = Db::name('indent')->update($param);  
106 - if ($result) {  
107 - $this->success("发货成功!",$url);  
108 - } else {  
109 - $this->error('发货失败!');  
110 - }  
111 - } else {  
112 - if ($id) {  
113 - $info = Db::name('indent')->where('id',$id)->find();  
114 - $this->assign('info',$info);  
115 - $this->assign('url',$_SERVER['HTTP_REFERER']);  
116 - return $this->fetch();  
117 - } else {  
118 - $this->error('数据传入失败!');  
119 - }  
120 - }  
121 - }  
122 -  
123 -  
124 -  
125 - /**  
126 - * 完成  
127 - * @adminMenu(  
128 - * 'name' => '完成',  
129 - * 'parent' => 'index',  
130 - * 'display'=> false,  
131 - * 'hasView'=> false,  
132 - * 'order' => 10000,  
133 - * 'icon' => '',  
134 - * 'remark' => '完成',  
135 - * 'param' => ''  
136 - * )  
137 - */  
138 - public function complete()  
139 - {  
140 - $param = $this->request->param();  
141 - // 判断订单是否可发货  
142 - $info = Db::name('indent')->where('id',$param['id'])->find();  
143 - if (!$info) {  
144 - $this->error("订单不存在!");  
145 - }  
146 - if ($info['state'] != 5) {  
147 - $this->error("订单无法完成!");  
148 - }  
149 - // 修改发货状态  
150 - $param['state'] = 3;  
151 - $result = Db::name('indent')->update($param);  
152 - if ($result) {  
153 - $this->success("操作成功!");  
154 - } else {  
155 - $this->error('操作失败!');  
156 - }  
157 - }  
158 -  
159 -  
160 -  
161 -  
162 - 1 +<?php
  2 +namespace app\admin\controller;
  3 +
  4 +use app\admin\model\RouteModel;
  5 +use cmf\controller\AdminBaseController;
  6 +use think\Db;
  7 +class OrderscourierController extends AdminBaseController{
  8 +
  9 + /**
  10 + *平台订单列表
  11 + */
  12 + public function order_list(){
  13 + $param = $this->request->param();
  14 + $where = [
  15 + "indent_type" => 1
  16 + ];
  17 + if(!empty($param['start_time']) && !empty($param['end_time'])){
  18 + $start_time = strtotime($param['start_time']);
  19 + $end_time = strtotime($param['end_time']);
  20 + $where['create_time'] = [['>=',$start_time],['<=',$end_time]];
  21 + }
  22 + if(!empty($param['keyword'])){
  23 + $where['order_number'] = ['like','%'.trim($param['keyword']).'%'];
  24 + }
  25 + if(!empty($param['state'])){
  26 + $where['state'] = $param['state'];
  27 + }
  28 + $data = Db::name('indent')->where($where)->where("state = 2 or state = 3 or state = 5")->order('create_time','DESC')->paginate(12);
  29 + $data->appends($param);
  30 + $list = $data->items();
  31 + foreach ($list as $k=>$v) {
  32 + $indent_goods = Db::name('indent_goods')->alias('ig')
  33 + ->field('g.book_name,ig.number')
  34 + ->join('__GOODS__ g','ig.goods_id = g.id')
  35 + ->where('ig.indent_id',$v['id'])
  36 + ->select()->toArray();
  37 + $goods = [];
  38 + foreach ($indent_goods as $kg=>$vg) {
  39 + $goods[] = $vg['book_name'].'X'.$vg['number'];
  40 + }
  41 + $list[$k]['books'] = implode(',',$goods);
  42 + }
  43 + $this->assign('start_time',!empty($param['start_time']) ? $param['start_time'] : '');
  44 + $this->assign('end_time',!empty($param['end_time']) ? $param['end_time'] : '');
  45 + $this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
  46 + $this->assign('state',!empty($param['state']) ? $param['state'] : '');
  47 + $this->assign('data',$list);
  48 + $this->assign('page',$data->render());
  49 + return $this->fetch();
  50 +
  51 + }
  52 +
  53 + /**
  54 + *平台订单查看
  55 + */
  56 + public function plat_view(){
  57 +
  58 + $id = $this -> request -> param();
  59 + $indent_id = $id['id'];
  60 + $data_goods = Db::name('indent_goods') -> where('indent_id',$indent_id) -> select();
  61 + $data_in = Db::name('indent') -> where('id',$indent_id) -> find();
  62 + $this -> assign('data_goods',$data_goods);
  63 + $this -> assign('data_in',$data_in);
  64 + //地址查询
  65 + $address = Db::name('address') -> where("id",$data_in['indent_address']) -> find();
  66 + if(!empty($address)){
  67 + $this -> assign('address',$address);
  68 + }else{
  69 + $this -> assign('address',null);
  70 + }
  71 +
  72 + return $this -> fetch();
  73 +
  74 + }
  75 +
  76 + /**
  77 + * 查看物流信息
  78 + */
  79 + public function logistics_information(){
  80 +
  81 + $indent_id = $this -> request -> param();
  82 + $bird = new BirdController();
  83 + $logistics = $bird -> getOrder($indent_id['id']);
  84 + $this -> assign('logistics',$logistics['data']['traces']);
  85 + return $this -> fetch();
  86 +
  87 + }
  88 +
  89 + /**
  90 + * 发货
  91 + * @adminMenu(
  92 + * 'name' => '发货',
  93 + * 'parent' => 'index',
  94 + * 'display'=> false,
  95 + * 'hasView'=> false,
  96 + * 'order' => 10000,
  97 + * 'icon' => '',
  98 + * 'remark' => '发货',
  99 + * 'param' => ''
  100 + * )
  101 + */
  102 + public function fahuo()
  103 + {
  104 + $id = $this->request->param('id', 0, 'intval');
  105 + if($this->request->isPost()) {
  106 + $param = $this->request->param();
  107 + $url = $param['url'];
  108 + unset($param['url']);
  109 + // 判断订单是否可发货
  110 + $info = Db::name('indent')->where('id',$param['id'])->find();
  111 + if (!$info) {
  112 + $this->error("订单不存在!");
  113 + }
  114 + if ($info['state'] != 2) {
  115 + $this->error("订单无法发货!");
  116 + }
  117 + // 修改发货状态
  118 + $param['state'] = 5;
  119 + $result = Db::name('indent')->update($param);
  120 + if ($result) {
  121 + $this->success("发货成功!",$url);
  122 + } else {
  123 + $this->error('发货失败!');
  124 + }
  125 + } else {
  126 + if ($id) {
  127 + $info = Db::name('indent')->where('id',$id)->find();
  128 + $this->assign('info',$info);
  129 + $this->assign('url',$_SERVER['HTTP_REFERER']);
  130 + return $this->fetch();
  131 + } else {
  132 + $this->error('数据传入失败!');
  133 + }
  134 + }
  135 + }
  136 +
  137 +
  138 +
  139 + /**
  140 + * 完成
  141 + * @adminMenu(
  142 + * 'name' => '完成',
  143 + * 'parent' => 'index',
  144 + * 'display'=> false,
  145 + * 'hasView'=> false,
  146 + * 'order' => 10000,
  147 + * 'icon' => '',
  148 + * 'remark' => '完成',
  149 + * 'param' => ''
  150 + * )
  151 + */
  152 + public function complete()
  153 + {
  154 + $param = $this->request->param();
  155 + // 判断订单是否可发货
  156 + $info = Db::name('indent')->where('id',$param['id'])->find();
  157 + if (!$info) {
  158 + $this->error("订单不存在!");
  159 + }
  160 + if ($info['state'] != 5) {
  161 + $this->error("订单无法完成!");
  162 + }
  163 + // 修改发货状态
  164 + $param['state'] = 3;
  165 + $result = Db::name('indent')->update($param);
  166 + if ($result) {
  167 + $this->success("操作成功!");
  168 + } else {
  169 + $this->error('操作失败!');
  170 + }
  171 + }
  172 +
  173 +
  174 +
  175 +
  176 +
163 } 177 }
1 -<?php  
2 -namespace app\admin\controller;  
3 -  
4 -use app\admin\model\RouteModel;  
5 -use cmf\controller\AdminBaseController;  
6 -use think\Db;  
7 -class UsersController extends AdminBaseController{  
8 -  
9 - /**  
10 - * 显示用户列表  
11 - */  
12 - public function user_list(){  
13 - $param = $this->request->param();  
14 - $where = [  
15 - 'a.create_time' => ['>=', 0],  
16 - ];  
17 - if(!empty($param['keyword'])){  
18 - $keyword = trim($param['keyword']);  
19 - $where['b.user_nickname'] = ['like',"%$keyword%"];  
20 - }  
21 - if(!empty($param['id'])){  
22 - $where['a.id'] = ['eq',$param['id']];  
23 - }  
24 - if(!empty($param['identity'])){  
25 - if($param['identity'] == -1){  
26 - $where['a.status'] = ['eq',0];  
27 - }else{  
28 - $where['a.status'] = ['eq',$param['identity']];  
29 - }  
30 - }  
31 - $data = Db::name('my_user') -> alias('a')  
32 - ->field('a.*,b.user_nickname')  
33 - ->join('user b','a.uid = b.id','LEFT')  
34 - ->where($where)  
35 - ->order(['a.balance'=>'DESC','a.create_time'=>'DESC'])  
36 - ->paginate(12);  
37 - $data->appends($param);  
38 - $list = $data->items();  
39 - foreach ($list as $k=>$v) {  
40 - // 获取邀请人昵称  
41 - $invite_nickname = '';  
42 - if($v['pid']) {  
43 - $invite = Db::name('my_user')->alias('m')  
44 - ->field('u.user_nickname')  
45 - ->join('user u','m.uid = u.id')  
46 - ->where('m.id',$v['pid'])  
47 - ->find();  
48 - $invite_nickname = $invite['user_nickname'];  
49 - }  
50 - $list[$k]['invite_nickname'] = $invite_nickname;  
51 - // 获取提现数据  
52 - $ti_count = Db::name('money_expend')->where('uid',$v['uid'])->where('state',1)->sum('money');// 已提金额  
53 - $list[$k]['ti_count'] = $ti_count;  
54 - $list[$k]['all_count'] = Db::name('money_income')->where('uid',$v['uid'])->sum('money');  
55 - // 获取邀请人数  
56 - $invite_count = 0;  
57 - if(in_array($v['status'],[2,3])) {  
58 - $invite_count = Db::name('my_user')  
59 - ->alias('a')  
60 - ->field('a.*,b.user_nickname')  
61 - ->join('user b','a.uid = b.id','left')  
62 - ->where('status',$v['status']+1)  
63 - ->where('pid',$v['id'])  
64 - ->count();  
65 - }  
66 - $list[$k]['invite_count'] = $invite_count;  
67 - }  
68 - $this->assign('list',$list);  
69 - $this->assign('data',$data);  
70 - $this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');  
71 - $this->assign('status',!empty($param['identity']) ? $param['identity'] : '');  
72 - $this->assign('id',!empty($param['id']) ? $param['id'] : '');  
73 - return $this->fetch();  
74 -  
75 - }  
76 -  
77 - /**  
78 - * 设置为业务员  
79 - */  
80 - public function set_salesman(){  
81 -  
82 - $id = $_POST['id'];  
83 - $data = Db::name('my_user') -> where('id',$id) -> update(['status'=>1]);  
84 - if($data){  
85 - return true;  
86 - }else{  
87 - return false;  
88 - }  
89 -  
90 - }  
91 -  
92 - /**  
93 - * 下线老师列表  
94 - */  
95 - public function teacher_list(){  
96 -  
97 - if($this -> request -> isPost()){  
98 - $where = [  
99 - 'status' => 3,  
100 - 'pid' => $_POST['salesman_id']  
101 - ];  
102 - if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){  
103 - $start_time = strtotime($_POST['start_time']);  
104 - $end_time = strtotime($_POST['end_time']);  
105 - $where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];  
106 - }  
107 - if(!empty($_POST['keyword'])){  
108 - $keyword = $_POST['keyword'];  
109 - $where['user_nickname'] = ['like',"%$keyword%"];  
110 - }  
111 - $this -> assign('salesman_id',$_POST['salesman_id']);  
112 - $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);  
113 - $data_arr = $data -> toArray();  
114 - }else{  
115 - $id = $this -> request -> param();  
116 - $this -> assign('salesman_id',$id['id']);  
117 - $data = Db::name('my_user') -> where("status = 3 and pid =".$id['id']) -> paginate(12);  
118 - $data_arr = $data -> toArray();  
119 - foreach($data_arr['data'] as $key => $val){  
120 - $data_nick = Db::name('user') -> where('id',$data[$key]['uid']) -> find();  
121 - $data_arr['data'][$key]['user_nickname'] = $data_nick['user_nickname'];  
122 - }  
123 - }  
124 -  
125 - foreach ($data_arr['data'] as $key => $val){  
126 - $money_income = Db::name('money_income') -> where('uid',$val['uid']) -> select();  
127 - $m_money = 0;  
128 - foreach ($money_income as $key1 => $val1){  
129 - $m_money += $val1['money'];  
130 - }  
131 - $data_arr['data'][$key]['money'] = $m_money;  
132 - }  
133 -  
134 - $this -> assign('data',$data);  
135 - $this -> assign('data_arr',$data_arr['data']);  
136 - return $this -> fetch();  
137 -  
138 - }  
139 -  
140 - /**  
141 - * 下线学生列表  
142 - */  
143 - public function student_list(){  
144 -  
145 - if($this -> request -> isPost()){  
146 - $teacher_id = $_POST['teacher_id'];  
147 - $where = [  
148 - 'a.status' => 4,  
149 - 'a.pid' => $teacher_id  
150 - ];  
151 - if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){  
152 - $start_time = strtotime($_POST['start_time']);  
153 - $end_time = strtotime($_POST['end_time']);  
154 - $where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];  
155 - }  
156 - if(!empty($_POST['keyword'])){  
157 - $keyword = $_POST['keyword'];  
158 - $where['b.user_nickname'] = ['like',"%$keyword%"];  
159 - }  
160 - $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);  
161 - }else{  
162 - $id = $this -> request -> param();  
163 - $teacher_id = $id['teacher_id'];  
164 - $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where("a.status = 4 and a.pid =".$teacher_id) -> paginate(12);  
165 - }  
166 - $this -> assign('teacher_id',$teacher_id);  
167 - $this -> assign('data',$data);  
168 - return $this -> fetch();  
169 -  
170 - }  
171 -  
172 -  
173 - /**  
174 - * 显示余额明细页  
175 - */  
176 - public function users_money(){  
177 -  
178 - $uid = $this -> request -> param();  
179 - $data = Db::name('money_income')->where('uid',$uid['uid'])->order('create_time','DESC')->select()->toArray();  
180 - if(!empty($data)){  
181 - foreach ($data as $key => $val){  
182 - if($val['type'] == 2){  
183 - $data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();  
184 - $indent_good = Db::name('indent_goods') -> where('indent_id',$val['indent_id']) -> select() -> toArray();  
185 - $indent_goods = '';  
186 - foreach ($indent_good as $key1 => $val1){  
187 - $indent_goods .= $val1['book_name'].',';  
188 - }  
189 - $data[$key]['indent_good'] = $indent_goods;  
190 - }else{  
191 - $data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();  
192 - $data[$key]['indent_good'] = $val['book_name'];  
193 - }  
194 - }  
195 - }  
196 - $this -> assign('data',$data);  
197 - return $this -> fetch();  
198 -  
199 - }  
200 - 1 +<?php
  2 +namespace app\admin\controller;
  3 +
  4 +use app\admin\model\RouteModel;
  5 +use cmf\controller\AdminBaseController;
  6 +use think\Db;
  7 +class UsersController extends AdminBaseController{
  8 +
  9 + /**
  10 + * 显示用户列表
  11 + */
  12 + public function user_list(){
  13 + $param = $this->request->param();
  14 + $where = [
  15 + 'a.create_time' => ['>=', 0],
  16 + ];
  17 + if(!empty($param['keyword'])){
  18 + $keyword = trim($param['keyword']);
  19 + $where['b.user_nickname|a.phone'] = ['like',"%$keyword%"];
  20 + }
  21 + if(!empty($param['id'])){
  22 + $where['a.id'] = ['eq',$param['id']];
  23 + }
  24 + if(!empty($param['identity'])){
  25 + if($param['identity'] == -1){
  26 + $where['a.status'] = ['eq',0];
  27 + }else{
  28 + $where['a.status'] = ['eq',$param['identity']];
  29 + }
  30 + }
  31 + $data = Db::name('my_user') -> alias('a')
  32 + ->field('a.*,b.user_nickname')
  33 + ->join('user b','a.uid = b.id','LEFT')
  34 + ->where($where)
  35 + ->order(['a.balance'=>'DESC','a.create_time'=>'DESC'])
  36 + ->paginate(12);
  37 + $data->appends($param);
  38 + $list = $data->items();
  39 + foreach ($list as $k=>$v) {
  40 + // 获取邀请人昵称
  41 + $invite_nickname = '';
  42 + if($v['pid']) {
  43 + $invite = Db::name('my_user')->alias('m')
  44 + ->field('u.user_nickname')
  45 + ->join('user u','m.uid = u.id')
  46 + ->where('m.id',$v['pid'])
  47 + ->find();
  48 + $invite_nickname = $invite['user_nickname'];
  49 + }
  50 + $list[$k]['invite_nickname'] = $invite_nickname;
  51 + // 获取提现数据
  52 + $ti_count = Db::name('money_expend')->where('uid',$v['uid'])->where('state',1)->sum('money');// 已提金额
  53 + $list[$k]['ti_count'] = $ti_count;
  54 + $list[$k]['all_count'] = Db::name('money_income')->where('uid',$v['uid'])->sum('money');
  55 + // 获取邀请人数
  56 + $invite_count = 0;
  57 + if(in_array($v['status'],[2,3])) {
  58 + $invite_count = Db::name('my_user')
  59 + ->alias('a')
  60 + ->field('a.*,b.user_nickname')
  61 + ->join('user b','a.uid = b.id','left')
  62 + ->where('status',$v['status']+1)
  63 + ->where('pid',$v['id'])
  64 + ->count();
  65 + }
  66 + $list[$k]['invite_count'] = $invite_count;
  67 + }
  68 + $this->assign('list',$list);
  69 + $this->assign('data',$data);
  70 + $this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
  71 + $this->assign('status',!empty($param['identity']) ? $param['identity'] : '');
  72 + $this->assign('id',!empty($param['id']) ? $param['id'] : '');
  73 + return $this->fetch();
  74 +
  75 + }
  76 +
  77 + /**
  78 + * 设置为业务员
  79 + */
  80 + public function set_salesman(){
  81 +
  82 + $id = $_POST['id'];
  83 + $data = Db::name('my_user') -> where('id',$id) -> update(['status'=>1]);
  84 + if($data){
  85 + return true;
  86 + }else{
  87 + return false;
  88 + }
  89 +
  90 + }
  91 +
  92 + /**
  93 + * 下线老师列表
  94 + */
  95 + public function teacher_list(){
  96 +
  97 + if($this -> request -> isPost()){
  98 + $where = [
  99 + 'status' => 3,
  100 + 'pid' => $_POST['salesman_id']
  101 + ];
  102 + if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
  103 + $start_time = strtotime($_POST['start_time']);
  104 + $end_time = strtotime($_POST['end_time']);
  105 + $where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
  106 + }
  107 + if(!empty($_POST['keyword'])){
  108 + $keyword = $_POST['keyword'];
  109 + $where['user_nickname'] = ['like',"%$keyword%"];
  110 + }
  111 + $this -> assign('salesman_id',$_POST['salesman_id']);
  112 + $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
  113 + $data_arr = $data -> toArray();
  114 + }else{
  115 + $id = $this -> request -> param();
  116 + $this -> assign('salesman_id',$id['id']);
  117 + $data = Db::name('my_user') -> where("status = 3 and pid =".$id['id']) -> paginate(12);
  118 + $data_arr = $data -> toArray();
  119 + foreach($data_arr['data'] as $key => $val){
  120 + $data_nick = Db::name('user') -> where('id',$data[$key]['uid']) -> find();
  121 + $data_arr['data'][$key]['user_nickname'] = $data_nick['user_nickname'];
  122 + }
  123 + }
  124 +
  125 + foreach ($data_arr['data'] as $key => $val){
  126 + $money_income = Db::name('money_income') -> where('uid',$val['uid']) -> select();
  127 + $m_money = 0;
  128 + foreach ($money_income as $key1 => $val1){
  129 + $m_money += $val1['money'];
  130 + }
  131 + $data_arr['data'][$key]['money'] = $m_money;
  132 + }
  133 +
  134 + $this -> assign('data',$data);
  135 + $this -> assign('data_arr',$data_arr['data']);
  136 + return $this -> fetch();
  137 +
  138 + }
  139 +
  140 + /**
  141 + * 下线学生列表
  142 + */
  143 + public function student_list(){
  144 +
  145 + if($this -> request -> isPost()){
  146 + $teacher_id = $_POST['teacher_id'];
  147 + $where = [
  148 + 'a.status' => 4,
  149 + 'a.pid' => $teacher_id
  150 + ];
  151 + if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
  152 + $start_time = strtotime($_POST['start_time']);
  153 + $end_time = strtotime($_POST['end_time']);
  154 + $where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
  155 + }
  156 + if(!empty($_POST['keyword'])){
  157 + $keyword = $_POST['keyword'];
  158 + $where['b.user_nickname'] = ['like',"%$keyword%"];
  159 + }
  160 + $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
  161 + }else{
  162 + $id = $this -> request -> param();
  163 + $teacher_id = $id['teacher_id'];
  164 + $data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where("a.status = 4 and a.pid =".$teacher_id) -> paginate(12);
  165 + }
  166 + $this -> assign('teacher_id',$teacher_id);
  167 + $this -> assign('data',$data);
  168 + return $this -> fetch();
  169 +
  170 + }
  171 +
  172 +
  173 + /**
  174 + * 显示余额明细页
  175 + */
  176 + public function users_money(){
  177 +
  178 + $uid = $this -> request -> param();
  179 + $data = Db::name('money_income')->where('uid',$uid['uid'])->order('create_time','DESC')->select()->toArray();
  180 + if(!empty($data)){
  181 + foreach ($data as $key => $val){
  182 + if($val['type'] == 2){
  183 + $data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
  184 + $indent_good = Db::name('indent_goods') -> where('indent_id',$val['indent_id']) -> select() -> toArray();
  185 + $indent_goods = '';
  186 + foreach ($indent_good as $key1 => $val1){
  187 + $indent_goods .= $val1['book_name'].',';
  188 + }
  189 + $data[$key]['indent_good'] = $indent_goods;
  190 + }else{
  191 + $data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
  192 + $data[$key]['indent_good'] = $val['book_name'];
  193 + }
  194 + }
  195 + }
  196 + $this -> assign('data',$data);
  197 + return $this -> fetch();
  198 +
  199 + }
  200 +
201 } 201 }
1 -<include file="public@header"/>  
2 -</head>  
3 -<body>  
4 -<style>  
5 - .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}  
6 - .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}  
7 - .pagination .active{background-color: #dd1a20;color: #fff;}  
8 - .pagination .disabled{color:#aaa;}  
9 -</style>  
10 -<div class="wrap js-check-wrap">  
11 - <ul class="nav nav-tabs">  
12 - <li class="active"><a href="#">平台订单列表</a></li>  
13 - </ul>  
14 - <form class="well form-inline margin-top-20" method="post" action="{:url('Orderscourier/order_list')}">  
15 - 时间:  
16 - <input type="text" class="form-control js-bootstrap-datetime" name="start_time"  
17 - value="{$start_time|default=''}"  
18 - style="width: 140px;" autocomplete="off">-  
19 - <input type="text" class="form-control js-bootstrap-datetime" name="end_time"  
20 - value="{$end_time|default=''}"  
21 - style="width: 140px;" autocomplete="off"> &nbsp;  
22 - 关键字:  
23 - <input type="text" class="form-control" name="keyword" style="width: 200px;"  
24 - value="{$keyword|default=''}" placeholder="请输入订单号...">  
25 - 订单状态:  
26 - <select name="state" class="form-control">  
27 - <option value="">全部</option>  
28 - <option value="3" <eq name="state" value="3">selected</eq> >已完成</option>  
29 - <option value="5" <eq name="state" value="5">selected</eq> >已发货</option>  
30 - <option value="2" <eq name="state" value="2">selected</eq> >未完成</option>  
31 - </select>  
32 - <input type="submit" class="btn btn-primary" value="搜索"/>  
33 - <a class="btn btn-danger" href="{:url('Orderscourier/order_list')}">清空</a>  
34 - </form>  
35 - <table class="table table-hover table-bordered table-list">  
36 - <thead>  
37 - <tr>  
38 - <th>序号</th>  
39 - <th>订单号</th>  
40 - <th>数量</th>  
41 - <th>价钱</th>  
42 - <th>订单状态</th>  
43 - <th>创建时间</th>  
44 - <th>操作</th>  
45 - </tr>  
46 - </thead>  
47 - <tbody>  
48 - <volist name="data" id="vo">  
49 - <tr class="tr{$vo.id}">  
50 - <td>{$vo.id}</td>  
51 - <td>{$vo.order_number}</td>  
52 - <td>{$vo.book_num}</td>  
53 - <td>{$vo.money}</td>  
54 - <if condition="$vo.state eq 4">  
55 - <td>待付款</td>  
56 - <elseif condition="$vo.state eq 1"/>  
57 - <td>已付款</td>  
58 - <elseif condition="$vo.state eq 2"/>  
59 - <td>未完成</td>  
60 - <elseif condition="$vo.state eq 3"/>  
61 - <td>已完成</td>  
62 - <elseif condition="$vo.state eq 5"/>  
63 - <td>已发货</td>  
64 - </if>  
65 - <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>  
66 - <td style="width: 230px;" class="fahuo{$vo.id}">  
67 - <a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">查看</button></a>  
68 -<!-- <if condition="$vo.state eq 2">-->  
69 -<!-- <button type="button" class="btn btn-default">物流信息</button>-->  
70 -<!-- <else/>-->  
71 -<!-- <a href="{:url('Orderscourier/logistics_information',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>-->  
72 -<!-- </if>-->  
73 -  
74 - <if condition="$vo.state eq 2">  
75 - <a href="{:url('Orderscourier/fahuo',array('id'=>$vo['id']))}"><button type="button" class="btn btn-default">发货</button></a>  
76 - <elseif condition="$vo.state eq 5">  
77 - <a class="js-ajax-delete" href="{:url('Orderscourier/complete',array('id'=>$vo['id']))}" data-msg="您确定该订单已完成吗?">  
78 - <button type="button" class="btn btn-default">完成</button>  
79 - </a>  
80 - </elseif>  
81 - </if>  
82 -  
83 - </td>  
84 - </tr>  
85 - </volist>  
86 - </tbody>  
87 - </table>  
88 - <div class="pagination">  
89 - {$data->render()}  
90 - </div>  
91 -</div>  
92 -<script src="__STATIC__/js/admin.js"></script>  
93 -<script>  
94 - /**  
95 - *待发货  
96 - */  
97 - function deliver_goods(id){  
98 - ccc = window.confirm('确定发货?');  
99 - if(ccc){  
100 - $.post("{:url('Bird/createOrder')}",{indent_id:id},function(data){  
101 - if(data == '缺少必要参数'){  
102 - alert('缺少必要参数');  
103 - }else if(data == '未查询到该订单'){  
104 - alert('未查询到该订单');  
105 - }else if(data == '该订单不是待发货状态'){  
106 - alert('该订单不是待发货状态');  
107 - }else{  
108 - data = JSON.parse(data);  
109 - if(data.code == '20000'){  
110 - $('.daifa'+id).remove();  
111 - $('.fahuo'+id).append("<button type='button' class='btn btn-default'>已发货</button>");  
112 - alert('发货成功');  
113 - }else if(data.code == '40000'){  
114 - alert('发货失败');  
115 - }  
116 - }  
117 - });  
118 - }  
119 - }  
120 -</script>  
121 -</body>  
122 -</html> 1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<style>
  5 + .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
  6 + .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
  7 + .pagination .active{background-color: #dd1a20;color: #fff;}
  8 + .pagination .disabled{color:#aaa;}
  9 +</style>
  10 +<div class="wrap js-check-wrap">
  11 + <ul class="nav nav-tabs">
  12 + <li class="active"><a href="#">平台订单列表</a></li>
  13 + </ul>
  14 + <form class="well form-inline margin-top-20" method="post" action="{:url('Orderscourier/order_list')}">
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off"> &nbsp;
  22 + 关键字:
  23 + <input type="text" class="form-control" name="keyword" style="width: 200px;"
  24 + value="{$keyword|default=''}" placeholder="请输入订单号...">
  25 + 订单状态:
  26 + <select name="state" class="form-control">
  27 + <option value="">全部</option>
  28 + <option value="3" <eq name="state" value="3">selected</eq> >已完成</option>
  29 + <option value="5" <eq name="state" value="5">selected</eq> >已发货</option>
  30 + <option value="2" <eq name="state" value="2">selected</eq> >未完成</option>
  31 + </select>
  32 + <input type="submit" class="btn btn-primary" value="搜索"/>
  33 + <a class="btn btn-danger" href="{:url('Orderscourier/order_list')}">清空</a>
  34 + </form>
  35 + <table class="table table-hover table-bordered table-list">
  36 + <thead>
  37 + <tr>
  38 + <th>序号</th>
  39 + <th>订单号</th>
  40 + <th>姓名</th>
  41 + <th>书籍</th>
  42 + <th>数量</th>
  43 + <th>价钱</th>
  44 + <th>订单状态</th>
  45 + <th>创建时间</th>
  46 + <th>操作</th>
  47 + </tr>
  48 + </thead>
  49 + <tbody>
  50 + <volist name="data" id="vo">
  51 + <tr class="tr{$vo.id}">
  52 + <td>{$vo.id}</td>
  53 + <td>{$vo.order_number}</td>
  54 + <td>{$vo.name}</td>
  55 + <td>{$vo.books}</td>
  56 + <td>{$vo.book_num}</td>
  57 + <td>{$vo.money}</td>
  58 + <if condition="$vo.state eq 4">
  59 + <td>待付款</td>
  60 + <elseif condition="$vo.state eq 1"/>
  61 + <td>已付款</td>
  62 + <elseif condition="$vo.state eq 2"/>
  63 + <td>未完成</td>
  64 + <elseif condition="$vo.state eq 3"/>
  65 + <td>已完成</td>
  66 + <elseif condition="$vo.state eq 5"/>
  67 + <td>已发货</td>
  68 + </if>
  69 + <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
  70 + <td style="width: 230px;" class="fahuo{$vo.id}">
  71 + <a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">查看</button></a>
  72 +<!-- <if condition="$vo.state eq 2">-->
  73 +<!-- <button type="button" class="btn btn-default">物流信息</button>-->
  74 +<!-- <else/>-->
  75 +<!-- <a href="{:url('Orderscourier/logistics_information',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>-->
  76 +<!-- </if>-->
  77 +
  78 + <if condition="$vo.state eq 2">
  79 + <a href="{:url('Orderscourier/fahuo',array('id'=>$vo['id']))}"><button type="button" class="btn btn-default">发货</button></a>
  80 + <elseif condition="$vo.state eq 5">
  81 + <a class="js-ajax-delete" href="{:url('Orderscourier/complete',array('id'=>$vo['id']))}" data-msg="您确定该订单已完成吗?">
  82 + <button type="button" class="btn btn-default">完成</button>
  83 + </a>
  84 + </elseif>
  85 + </if>
  86 +
  87 + </td>
  88 + </tr>
  89 + </volist>
  90 + </tbody>
  91 + </table>
  92 + <div class="pagination">
  93 + {$page}
  94 + </div>
  95 +</div>
  96 +<script src="__STATIC__/js/admin.js"></script>
  97 +<script>
  98 + /**
  99 + *待发货
  100 + */
  101 + function deliver_goods(id){
  102 + ccc = window.confirm('确定发货?');
  103 + if(ccc){
  104 + $.post("{:url('Bird/createOrder')}",{indent_id:id},function(data){
  105 + if(data == '缺少必要参数'){
  106 + alert('缺少必要参数');
  107 + }else if(data == '未查询到该订单'){
  108 + alert('未查询到该订单');
  109 + }else if(data == '该订单不是待发货状态'){
  110 + alert('该订单不是待发货状态');
  111 + }else{
  112 + data = JSON.parse(data);
  113 + if(data.code == '20000'){
  114 + $('.daifa'+id).remove();
  115 + $('.fahuo'+id).append("<button type='button' class='btn btn-default'>已发货</button>");
  116 + alert('发货成功');
  117 + }else if(data.code == '40000'){
  118 + alert('发货失败');
  119 + }
  120 + }
  121 + });
  122 + }
  123 + }
  124 +</script>
  125 +</body>
  126 +</html>
1 -<include file="public@header"/>  
2 -</head>  
3 -<body>  
4 -<style>  
5 - .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}  
6 - .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}  
7 - .pagination .active{background-color: #dd1a20;color: #fff;}  
8 - .pagination .disabled{color:#aaa;}  
9 -</style>  
10 -<div class="wrap js-check-wrap">  
11 - <ul class="nav nav-tabs">  
12 - <li class="active"><a href="#">用户列表</a></li>  
13 - </ul>  
14 - <form class="well form-inline margin-top-20" method="post" action="{:url('Users/user_list')}">  
15 - <!--时间:-->  
16 - <!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->  
17 - <!--value="{$start_time|default=''}"-->  
18 - <!--style="width: 140px;" autocomplete="off">- -->  
19 - <!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->  
20 - <!--value="{$end_time|default=''}"-->  
21 - <!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->  
22 - 序号:  
23 - <input type="text" class="form-control" name="id" style="width: 200px;"  
24 - value="{$id|default=''}" placeholder="请输入序号">  
25 - 关键字:  
26 - <input type="text" class="form-control" name="keyword" style="width: 200px;"  
27 - value="{$keyword|default=''}" placeholder="请输入微信昵称...">  
28 - 身份:  
29 - <select name="identity" class="form-control">  
30 - <option value="">全部</option>  
31 - <option value="2" <eq name="status" value="2">selected</eq> >一级业务员</option>  
32 - <option value="3" <eq name="status" value="3">selected</eq> >二级业务员</option>  
33 - <option value="4" <eq name="status" value="4">selected</eq> >学生</option>  
34 - <option value="-1" <eq name="status" value="-1">selected</eq> >自由人</option>  
35 - </select>  
36 - <input type="submit" class="btn btn-primary" value="搜索"/>  
37 - <a class="btn btn-danger" href="{:url('Users/user_list')}">清空</a>  
38 - </form>  
39 - <table class="table table-hover table-bordered table-list">  
40 - <caption>边框表格布局</caption>  
41 - <thead>  
42 - <tr>  
43 - <th>序号</th>  
44 - <th>微信昵称</th>  
45 - <th>身份</th>  
46 - <th>手机号</th>  
47 - <th>邀请人序号</th>  
48 - <th>邀请人姓名</th>  
49 - <th>邀请人</th>  
50 - <th>邀请人数</th>  
51 - <th>历史总收入</th>  
52 - <th>已提金额</th>  
53 - <th>余额</th>  
54 - <th>创建时间</th>  
55 - <th>操作</th>  
56 - </tr>  
57 - </thead>  
58 - <tbody>  
59 - <volist name="list" id="val">  
60 - <tr>  
61 - <td>{$val.id}</td>  
62 - <td>{$val.user_nickname}</td>  
63 - <if condition="$val.status eq 2">  
64 - <td>一级业务员</td>  
65 - <elseif condition="$val.status eq 3"/>  
66 - <td>二级业务员</td>  
67 - <elseif condition="$val.status eq 4"/>  
68 - <td>学生</td>  
69 - <else/>  
70 - <td>自由人</td>  
71 - </if>  
72 - <td>{$val.phone}</td>  
73 - <td>{$val.pid}</td>  
74 - <td>{$val.invite_nickname}</td>  
75 - <td>{$val.inviter_phone}</td>  
76 - <td>{$val.invite_count}</td>  
77 - <td>{$val.all_count}</td>  
78 - <td>{$val.ti_count}</td>  
79 - <td>{$val.balance}</td>  
80 - <if condition="$val.status eq 2">  
81 - <td>{$val.audit_time|date="Y-m-d H:i:s",###}</td>  
82 - <else/>  
83 - <td>{$val.create_time|date="Y-m-d H:i:s",###}</td>  
84 - </if>  
85 -  
86 - <td style="width:300px;">  
87 - <input type="hidden" name="" class="bianji{$val.id}">  
88 - <if condition="$val.status eq 0">  
89 - <button type="button" class="btn btn-default setup{$val.id}" onclick="set_up({$val.id})">设为业务员</button>  
90 - <elseif condition="$val.status eq 1"/>  
91 - <button type="button" class="btn btn-default">已设为业务员</button>  
92 - <elseif condition="$val.status eq 5"/>  
93 - <button type="button" class="btn btn-default">业务员审核中</button>  
94 - <elseif condition="$val.status eq 6" />  
95 - <button type="button" class="btn btn-default">审核驳回</button>  
96 - <else/>  
97 - <button type="button" class="btn btn-default" style="background-color: red;">不能设置</button>  
98 - </if>  
99 - <if condition="$val.status eq 2">  
100 - <a href="{:url('Users/teacher_list',array('id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>  
101 - <elseif condition="$val.status eq 3"/>  
102 - <a href="{:url('Users/student_list',array('teacher_id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>  
103 - <else/>  
104 - <button type="button" class="btn btn-default" style="background-color: red;">没有下线</button>  
105 - </if>  
106 - <if condition="$val.status eq 2">  
107 - <a href="{:url('Users/users_money',array('uid'=>$val.uid))}">  
108 - <button type="button" class="btn btn-default">余额明细</button>  
109 - </a>  
110 - <elseif condition="$val.status eq 3"/>  
111 - <a href="{:url('Users/users_money',array('uid'=>$val.uid))}">  
112 - <button type="button" class="btn btn-default">余额明细</button>  
113 - </a>  
114 - <else/>  
115 - <button type="button" class="btn btn-default" style="background-color: red;">没有余额</button>  
116 - </if>  
117 -  
118 - </td>  
119 - </tr>  
120 - </volist>  
121 - </tbody>  
122 - </table>  
123 - <div class="pagination">  
124 - {$data->render()}  
125 - </div>  
126 -</div>  
127 -<script>  
128 - /**  
129 - *设置为业务员  
130 - */  
131 - function set_up(id){  
132 - ccc = window.confirm('是否设置为业务员?');  
133 - if(ccc){  
134 - $.post("{:url('Users/set_salesman')}",{id:id},function(data){  
135 - if(data){  
136 - $('.setup'+id).remove();  
137 - $('.bianji'+id).after("<button type='button' class='btn btn-default'>已设为业务员</button>");  
138 - }else{  
139 - alert('设置失败');  
140 - }  
141 - });  
142 - }  
143 - }  
144 -</script>  
145 -<script src="__STATIC__/js/admin.js"></script>  
146 -</body> 1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<style>
  5 + .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
  6 + .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
  7 + .pagination .active{background-color: #dd1a20;color: #fff;}
  8 + .pagination .disabled{color:#aaa;}
  9 +</style>
  10 +<div class="wrap js-check-wrap">
  11 + <ul class="nav nav-tabs">
  12 + <li class="active"><a href="#">用户列表</a></li>
  13 + </ul>
  14 + <form class="well form-inline margin-top-20" method="post" action="{:url('Users/user_list')}">
  15 + <!--时间:-->
  16 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->
  17 + <!--value="{$start_time|default=''}"-->
  18 + <!--style="width: 140px;" autocomplete="off">- -->
  19 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->
  20 + <!--value="{$end_time|default=''}"-->
  21 + <!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->
  22 + 序号:
  23 + <input type="text" class="form-control" name="id" style="width: 200px;"
  24 + value="{$id|default=''}" placeholder="请输入序号">
  25 + 关键字:
  26 + <input type="text" class="form-control" name="keyword" style="width: 200px;"
  27 + value="{$keyword|default=''}" placeholder="请输入微信昵称/手机号">
  28 + 身份:
  29 + <select name="identity" class="form-control">
  30 + <option value="">全部</option>
  31 + <option value="2" <eq name="status" value="2">selected</eq> >一级业务员</option>
  32 + <option value="3" <eq name="status" value="3">selected</eq> >二级业务员</option>
  33 + <option value="4" <eq name="status" value="4">selected</eq> >学生</option>
  34 + <option value="-1" <eq name="status" value="-1">selected</eq> >自由人</option>
  35 + </select>
  36 + <input type="submit" class="btn btn-primary" value="搜索"/>
  37 + <a class="btn btn-danger" href="{:url('Users/user_list')}">清空</a>
  38 + </form>
  39 + <table class="table table-hover table-bordered table-list">
  40 + <caption>边框表格布局</caption>
  41 + <thead>
  42 + <tr>
  43 + <th>序号</th>
  44 + <th>微信昵称</th>
  45 + <th>身份</th>
  46 + <th>手机号</th>
  47 + <th>邀请人序号</th>
  48 + <th>邀请人姓名</th>
  49 + <th>邀请人</th>
  50 + <th>邀请人数</th>
  51 + <th>历史总收入</th>
  52 + <th>已提金额</th>
  53 + <th>余额</th>
  54 + <th>创建时间</th>
  55 + <th>操作</th>
  56 + </tr>
  57 + </thead>
  58 + <tbody>
  59 + <volist name="list" id="val">
  60 + <tr>
  61 + <td>{$val.id}</td>
  62 + <td>{$val.user_nickname}</td>
  63 + <if condition="$val.status eq 2">
  64 + <td>一级业务员</td>
  65 + <elseif condition="$val.status eq 3"/>
  66 + <td>二级业务员</td>
  67 + <elseif condition="$val.status eq 4"/>
  68 + <td>学生</td>
  69 + <else/>
  70 + <td>自由人</td>
  71 + </if>
  72 + <td>{$val.phone}</td>
  73 + <td>{$val.pid}</td>
  74 + <td>{$val.invite_nickname}</td>
  75 + <td>{$val.inviter_phone}</td>
  76 + <td>{$val.invite_count}</td>
  77 + <td>{$val.all_count}</td>
  78 + <td>{$val.ti_count}</td>
  79 + <td>{$val.balance}</td>
  80 + <if condition="$val.status eq 2">
  81 + <td>{$val.audit_time|date="Y-m-d H:i:s",###}</td>
  82 + <else/>
  83 + <td>{$val.create_time|date="Y-m-d H:i:s",###}</td>
  84 + </if>
  85 +
  86 + <td style="width:300px;">
  87 + <input type="hidden" name="" class="bianji{$val.id}">
  88 + <if condition="$val.status eq 0">
  89 + <button type="button" class="btn btn-default setup{$val.id}" onclick="set_up({$val.id})">设为业务员</button>
  90 + <elseif condition="$val.status eq 1"/>
  91 + <button type="button" class="btn btn-default">已设为业务员</button>
  92 + <elseif condition="$val.status eq 5"/>
  93 + <button type="button" class="btn btn-default">业务员审核中</button>
  94 + <elseif condition="$val.status eq 6" />
  95 + <button type="button" class="btn btn-default">审核驳回</button>
  96 + <else/>
  97 + <button type="button" class="btn btn-default" style="background-color: red;">不能设置</button>
  98 + </if>
  99 + <if condition="$val.status eq 2">
  100 + <a href="{:url('Users/teacher_list',array('id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
  101 + <elseif condition="$val.status eq 3"/>
  102 + <a href="{:url('Users/student_list',array('teacher_id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
  103 + <else/>
  104 + <button type="button" class="btn btn-default" style="background-color: red;">没有下线</button>
  105 + </if>
  106 + <if condition="$val.status eq 2">
  107 + <a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
  108 + <button type="button" class="btn btn-default">余额明细</button>
  109 + </a>
  110 + <elseif condition="$val.status eq 3"/>
  111 + <a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
  112 + <button type="button" class="btn btn-default">余额明细</button>
  113 + </a>
  114 + <else/>
  115 + <button type="button" class="btn btn-default" style="background-color: red;">没有余额</button>
  116 + </if>
  117 +
  118 + </td>
  119 + </tr>
  120 + </volist>
  121 + </tbody>
  122 + </table>
  123 + <div class="pagination">
  124 + {$data->render()}
  125 + </div>
  126 +</div>
  127 +<script>
  128 + /**
  129 + *设置为业务员
  130 + */
  131 + function set_up(id){
  132 + ccc = window.confirm('是否设置为业务员?');
  133 + if(ccc){
  134 + $.post("{:url('Users/set_salesman')}",{id:id},function(data){
  135 + if(data){
  136 + $('.setup'+id).remove();
  137 + $('.bianji'+id).after("<button type='button' class='btn btn-default'>已设为业务员</button>");
  138 + }else{
  139 + alert('设置失败');
  140 + }
  141 + });
  142 + }
  143 + }
  144 +</script>
  145 +<script src="__STATIC__/js/admin.js"></script>
  146 +</body>
147 </html> 147 </html>