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

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

<?php
namespace app\admin\controller;
use app\admin\model\RouteModel;
use cmf\controller\AdminBaseController;
use think\Db;
class OrderscourierController extends AdminBaseController{
/**
*平台订单列表
*/
public function order_list(){
$param = $this->request->param();
$where = [
"indent_type" => 1
];
if(!empty($param['start_time']) && !empty($param['end_time'])){
$start_time = strtotime($param['start_time']);
$end_time = strtotime($param['end_time']);
$where['create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($param['keyword'])){
$where['order_number'] = ['like','%'.trim($param['keyword']).'%'];
}
if(!empty($param['state'])){
$where['state'] = $param['state'];
}
$data = Db::name('indent')->where($where)->where("state = 2 or state = 3 or state = 5")->order('create_time','DESC')->paginate(12);
$data->appends($param);
$this->assign('start_time',!empty($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',!empty($param['end_time']) ? $param['end_time'] : '');
$this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
$this->assign('state',!empty($param['state']) ? $param['state'] : '');
$this->assign('data',$data);
return $this->fetch();
}
/**
*平台订单查看
*/
public function plat_view(){
$id = $this -> request -> param();
$indent_id = $id['id'];
$data_goods = Db::name('indent_goods') -> where('indent_id',$indent_id) -> select();
$data_in = Db::name('indent') -> where('id',$indent_id) -> find();
$this -> assign('data_goods',$data_goods);
$this -> assign('data_in',$data_in);
//地址查询
$address = Db::name('address') -> where("id",$data_in['indent_address']) -> find();
if(!empty($address)){
$this -> assign('address',$address);
}else{
$this -> assign('address',null);
}
return $this -> fetch();
}
/**
* 查看物流信息
*/
public function logistics_information(){
$indent_id = $this -> request -> param();
$bird = new BirdController();
$logistics = $bird -> getOrder($indent_id['id']);
$this -> assign('logistics',$logistics['data']['traces']);
return $this -> fetch();
}
/**
* 发货
* @adminMenu(
* 'name' => '发货',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '发货',
* 'param' => ''
* )
*/
public function fahuo()
{
$id = $this->request->param('id', 0, 'intval');
if($this->request->isPost()) {
$param = $this->request->param();
$url = $param['url'];
unset($param['url']);
// 判断订单是否可发货
$info = Db::name('indent')->where('id',$param['id'])->find();
if (!$info) {
$this->error("订单不存在!");
}
if ($info['state'] != 2) {
$this->error("订单无法发货!");
}
// 修改发货状态
$param['state'] = 5;
$result = Db::name('indent')->update($param);
if ($result) {
$this->success("发货成功!",$url);
} else {
$this->error('发货失败!');
}
} else {
if ($id) {
$info = Db::name('indent')->where('id',$id)->find();
$this->assign('info',$info);
$this->assign('url',$_SERVER['HTTP_REFERER']);
return $this->fetch();
} else {
$this->error('数据传入失败!');
}
}
}
/**
* 完成
* @adminMenu(
* 'name' => '完成',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '完成',
* 'param' => ''
* )
*/
public function complete()
{
$param = $this->request->param();
// 判断订单是否可发货
$info = Db::name('indent')->where('id',$param['id'])->find();
if (!$info) {
$this->error("订单不存在!");
}
if ($info['state'] != 5) {
$this->error("订单无法完成!");
}
// 修改发货状态
$param['state'] = 3;
$result = Db::name('indent')->update($param);
if ($result) {
$this->success("操作成功!");
} else {
$this->error('操作失败!');
}
}
<?php
namespace app\admin\controller;
use app\admin\model\RouteModel;
use cmf\controller\AdminBaseController;
use think\Db;
class OrderscourierController extends AdminBaseController{
/**
*平台订单列表
*/
public function order_list(){
$param = $this->request->param();
$where = [
"indent_type" => 1
];
if(!empty($param['start_time']) && !empty($param['end_time'])){
$start_time = strtotime($param['start_time']);
$end_time = strtotime($param['end_time']);
$where['create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($param['keyword'])){
$where['order_number'] = ['like','%'.trim($param['keyword']).'%'];
}
if(!empty($param['state'])){
$where['state'] = $param['state'];
}
$data = Db::name('indent')->where($where)->where("state = 2 or state = 3 or state = 5")->order('create_time','DESC')->paginate(12);
$data->appends($param);
$list = $data->items();
foreach ($list as $k=>$v) {
$indent_goods = Db::name('indent_goods')->alias('ig')
->field('g.book_name,ig.number')
->join('__GOODS__ g','ig.goods_id = g.id')
->where('ig.indent_id',$v['id'])
->select()->toArray();
$goods = [];
foreach ($indent_goods as $kg=>$vg) {
$goods[] = $vg['book_name'].'X'.$vg['number'];
}
$list[$k]['books'] = implode(',',$goods);
}
$this->assign('start_time',!empty($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',!empty($param['end_time']) ? $param['end_time'] : '');
$this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
$this->assign('state',!empty($param['state']) ? $param['state'] : '');
$this->assign('data',$list);
$this->assign('page',$data->render());
return $this->fetch();
}
/**
*平台订单查看
*/
public function plat_view(){
$id = $this -> request -> param();
$indent_id = $id['id'];
$data_goods = Db::name('indent_goods') -> where('indent_id',$indent_id) -> select();
$data_in = Db::name('indent') -> where('id',$indent_id) -> find();
$this -> assign('data_goods',$data_goods);
$this -> assign('data_in',$data_in);
//地址查询
$address = Db::name('address') -> where("id",$data_in['indent_address']) -> find();
if(!empty($address)){
$this -> assign('address',$address);
}else{
$this -> assign('address',null);
}
return $this -> fetch();
}
/**
* 查看物流信息
*/
public function logistics_information(){
$indent_id = $this -> request -> param();
$bird = new BirdController();
$logistics = $bird -> getOrder($indent_id['id']);
$this -> assign('logistics',$logistics['data']['traces']);
return $this -> fetch();
}
/**
* 发货
* @adminMenu(
* 'name' => '发货',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '发货',
* 'param' => ''
* )
*/
public function fahuo()
{
$id = $this->request->param('id', 0, 'intval');
if($this->request->isPost()) {
$param = $this->request->param();
$url = $param['url'];
unset($param['url']);
// 判断订单是否可发货
$info = Db::name('indent')->where('id',$param['id'])->find();
if (!$info) {
$this->error("订单不存在!");
}
if ($info['state'] != 2) {
$this->error("订单无法发货!");
}
// 修改发货状态
$param['state'] = 5;
$result = Db::name('indent')->update($param);
if ($result) {
$this->success("发货成功!",$url);
} else {
$this->error('发货失败!');
}
} else {
if ($id) {
$info = Db::name('indent')->where('id',$id)->find();
$this->assign('info',$info);
$this->assign('url',$_SERVER['HTTP_REFERER']);
return $this->fetch();
} else {
$this->error('数据传入失败!');
}
}
}
/**
* 完成
* @adminMenu(
* 'name' => '完成',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '完成',
* 'param' => ''
* )
*/
public function complete()
{
$param = $this->request->param();
// 判断订单是否可发货
$info = Db::name('indent')->where('id',$param['id'])->find();
if (!$info) {
$this->error("订单不存在!");
}
if ($info['state'] != 5) {
$this->error("订单无法完成!");
}
// 修改发货状态
$param['state'] = 3;
$result = Db::name('indent')->update($param);
if ($result) {
$this->success("操作成功!");
} else {
$this->error('操作失败!');
}
}
}
\ No newline at end of file
... ...
<?php
namespace app\admin\controller;
use app\admin\model\RouteModel;
use cmf\controller\AdminBaseController;
use think\Db;
class UsersController extends AdminBaseController{
/**
* 显示用户列表
*/
public function user_list(){
$param = $this->request->param();
$where = [
'a.create_time' => ['>=', 0],
];
if(!empty($param['keyword'])){
$keyword = trim($param['keyword']);
$where['b.user_nickname'] = ['like',"%$keyword%"];
}
if(!empty($param['id'])){
$where['a.id'] = ['eq',$param['id']];
}
if(!empty($param['identity'])){
if($param['identity'] == -1){
$where['a.status'] = ['eq',0];
}else{
$where['a.status'] = ['eq',$param['identity']];
}
}
$data = Db::name('my_user') -> alias('a')
->field('a.*,b.user_nickname')
->join('user b','a.uid = b.id','LEFT')
->where($where)
->order(['a.balance'=>'DESC','a.create_time'=>'DESC'])
->paginate(12);
$data->appends($param);
$list = $data->items();
foreach ($list as $k=>$v) {
// 获取邀请人昵称
$invite_nickname = '';
if($v['pid']) {
$invite = Db::name('my_user')->alias('m')
->field('u.user_nickname')
->join('user u','m.uid = u.id')
->where('m.id',$v['pid'])
->find();
$invite_nickname = $invite['user_nickname'];
}
$list[$k]['invite_nickname'] = $invite_nickname;
// 获取提现数据
$ti_count = Db::name('money_expend')->where('uid',$v['uid'])->where('state',1)->sum('money');// 已提金额
$list[$k]['ti_count'] = $ti_count;
$list[$k]['all_count'] = Db::name('money_income')->where('uid',$v['uid'])->sum('money');
// 获取邀请人数
$invite_count = 0;
if(in_array($v['status'],[2,3])) {
$invite_count = Db::name('my_user')
->alias('a')
->field('a.*,b.user_nickname')
->join('user b','a.uid = b.id','left')
->where('status',$v['status']+1)
->where('pid',$v['id'])
->count();
}
$list[$k]['invite_count'] = $invite_count;
}
$this->assign('list',$list);
$this->assign('data',$data);
$this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
$this->assign('status',!empty($param['identity']) ? $param['identity'] : '');
$this->assign('id',!empty($param['id']) ? $param['id'] : '');
return $this->fetch();
}
/**
* 设置为业务员
*/
public function set_salesman(){
$id = $_POST['id'];
$data = Db::name('my_user') -> where('id',$id) -> update(['status'=>1]);
if($data){
return true;
}else{
return false;
}
}
/**
* 下线老师列表
*/
public function teacher_list(){
if($this -> request -> isPost()){
$where = [
'status' => 3,
'pid' => $_POST['salesman_id']
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$keyword = $_POST['keyword'];
$where['user_nickname'] = ['like',"%$keyword%"];
}
$this -> assign('salesman_id',$_POST['salesman_id']);
$data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
$data_arr = $data -> toArray();
}else{
$id = $this -> request -> param();
$this -> assign('salesman_id',$id['id']);
$data = Db::name('my_user') -> where("status = 3 and pid =".$id['id']) -> paginate(12);
$data_arr = $data -> toArray();
foreach($data_arr['data'] as $key => $val){
$data_nick = Db::name('user') -> where('id',$data[$key]['uid']) -> find();
$data_arr['data'][$key]['user_nickname'] = $data_nick['user_nickname'];
}
}
foreach ($data_arr['data'] as $key => $val){
$money_income = Db::name('money_income') -> where('uid',$val['uid']) -> select();
$m_money = 0;
foreach ($money_income as $key1 => $val1){
$m_money += $val1['money'];
}
$data_arr['data'][$key]['money'] = $m_money;
}
$this -> assign('data',$data);
$this -> assign('data_arr',$data_arr['data']);
return $this -> fetch();
}
/**
* 下线学生列表
*/
public function student_list(){
if($this -> request -> isPost()){
$teacher_id = $_POST['teacher_id'];
$where = [
'a.status' => 4,
'a.pid' => $teacher_id
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$keyword = $_POST['keyword'];
$where['b.user_nickname'] = ['like',"%$keyword%"];
}
$data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
}else{
$id = $this -> request -> param();
$teacher_id = $id['teacher_id'];
$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);
}
$this -> assign('teacher_id',$teacher_id);
$this -> assign('data',$data);
return $this -> fetch();
}
/**
* 显示余额明细页
*/
public function users_money(){
$uid = $this -> request -> param();
$data = Db::name('money_income')->where('uid',$uid['uid'])->order('create_time','DESC')->select()->toArray();
if(!empty($data)){
foreach ($data as $key => $val){
if($val['type'] == 2){
$data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
$indent_good = Db::name('indent_goods') -> where('indent_id',$val['indent_id']) -> select() -> toArray();
$indent_goods = '';
foreach ($indent_good as $key1 => $val1){
$indent_goods .= $val1['book_name'].',';
}
$data[$key]['indent_good'] = $indent_goods;
}else{
$data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
$data[$key]['indent_good'] = $val['book_name'];
}
}
}
$this -> assign('data',$data);
return $this -> fetch();
}
<?php
namespace app\admin\controller;
use app\admin\model\RouteModel;
use cmf\controller\AdminBaseController;
use think\Db;
class UsersController extends AdminBaseController{
/**
* 显示用户列表
*/
public function user_list(){
$param = $this->request->param();
$where = [
'a.create_time' => ['>=', 0],
];
if(!empty($param['keyword'])){
$keyword = trim($param['keyword']);
$where['b.user_nickname|a.phone'] = ['like',"%$keyword%"];
}
if(!empty($param['id'])){
$where['a.id'] = ['eq',$param['id']];
}
if(!empty($param['identity'])){
if($param['identity'] == -1){
$where['a.status'] = ['eq',0];
}else{
$where['a.status'] = ['eq',$param['identity']];
}
}
$data = Db::name('my_user') -> alias('a')
->field('a.*,b.user_nickname')
->join('user b','a.uid = b.id','LEFT')
->where($where)
->order(['a.balance'=>'DESC','a.create_time'=>'DESC'])
->paginate(12);
$data->appends($param);
$list = $data->items();
foreach ($list as $k=>$v) {
// 获取邀请人昵称
$invite_nickname = '';
if($v['pid']) {
$invite = Db::name('my_user')->alias('m')
->field('u.user_nickname')
->join('user u','m.uid = u.id')
->where('m.id',$v['pid'])
->find();
$invite_nickname = $invite['user_nickname'];
}
$list[$k]['invite_nickname'] = $invite_nickname;
// 获取提现数据
$ti_count = Db::name('money_expend')->where('uid',$v['uid'])->where('state',1)->sum('money');// 已提金额
$list[$k]['ti_count'] = $ti_count;
$list[$k]['all_count'] = Db::name('money_income')->where('uid',$v['uid'])->sum('money');
// 获取邀请人数
$invite_count = 0;
if(in_array($v['status'],[2,3])) {
$invite_count = Db::name('my_user')
->alias('a')
->field('a.*,b.user_nickname')
->join('user b','a.uid = b.id','left')
->where('status',$v['status']+1)
->where('pid',$v['id'])
->count();
}
$list[$k]['invite_count'] = $invite_count;
}
$this->assign('list',$list);
$this->assign('data',$data);
$this->assign('keyword',!empty($param['keyword']) ? trim($param['keyword']) : '');
$this->assign('status',!empty($param['identity']) ? $param['identity'] : '');
$this->assign('id',!empty($param['id']) ? $param['id'] : '');
return $this->fetch();
}
/**
* 设置为业务员
*/
public function set_salesman(){
$id = $_POST['id'];
$data = Db::name('my_user') -> where('id',$id) -> update(['status'=>1]);
if($data){
return true;
}else{
return false;
}
}
/**
* 下线老师列表
*/
public function teacher_list(){
if($this -> request -> isPost()){
$where = [
'status' => 3,
'pid' => $_POST['salesman_id']
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$keyword = $_POST['keyword'];
$where['user_nickname'] = ['like',"%$keyword%"];
}
$this -> assign('salesman_id',$_POST['salesman_id']);
$data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
$data_arr = $data -> toArray();
}else{
$id = $this -> request -> param();
$this -> assign('salesman_id',$id['id']);
$data = Db::name('my_user') -> where("status = 3 and pid =".$id['id']) -> paginate(12);
$data_arr = $data -> toArray();
foreach($data_arr['data'] as $key => $val){
$data_nick = Db::name('user') -> where('id',$data[$key]['uid']) -> find();
$data_arr['data'][$key]['user_nickname'] = $data_nick['user_nickname'];
}
}
foreach ($data_arr['data'] as $key => $val){
$money_income = Db::name('money_income') -> where('uid',$val['uid']) -> select();
$m_money = 0;
foreach ($money_income as $key1 => $val1){
$m_money += $val1['money'];
}
$data_arr['data'][$key]['money'] = $m_money;
}
$this -> assign('data',$data);
$this -> assign('data_arr',$data_arr['data']);
return $this -> fetch();
}
/**
* 下线学生列表
*/
public function student_list(){
if($this -> request -> isPost()){
$teacher_id = $_POST['teacher_id'];
$where = [
'a.status' => 4,
'a.pid' => $teacher_id
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$keyword = $_POST['keyword'];
$where['b.user_nickname'] = ['like',"%$keyword%"];
}
$data = Db::name('my_user') -> alias('a') -> field('a.*,b.user_nickname') -> join('user b','a.uid = b.id','left') -> where($where) -> paginate(1000000);
}else{
$id = $this -> request -> param();
$teacher_id = $id['teacher_id'];
$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);
}
$this -> assign('teacher_id',$teacher_id);
$this -> assign('data',$data);
return $this -> fetch();
}
/**
* 显示余额明细页
*/
public function users_money(){
$uid = $this -> request -> param();
$data = Db::name('money_income')->where('uid',$uid['uid'])->order('create_time','DESC')->select()->toArray();
if(!empty($data)){
foreach ($data as $key => $val){
if($val['type'] == 2){
$data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
$indent_good = Db::name('indent_goods') -> where('indent_id',$val['indent_id']) -> select() -> toArray();
$indent_goods = '';
foreach ($indent_good as $key1 => $val1){
$indent_goods .= $val1['book_name'].',';
}
$data[$key]['indent_good'] = $indent_goods;
}else{
$data[$key]['indent'] = Db::name('indent') -> where('id',$val['indent_id']) -> find();
$data[$key]['indent_good'] = $val['book_name'];
}
}
}
$this -> assign('data',$data);
return $this -> fetch();
}
}
\ No newline at end of file
... ...
<include file="public@header"/>
</head>
<body>
<style>
.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
.pagination .active{background-color: #dd1a20;color: #fff;}
.pagination .disabled{color:#aaa;}
</style>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="#">平台订单列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Orderscourier/order_list')}">
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入订单号...">
订单状态:
<select name="state" class="form-control">
<option value="">全部</option>
<option value="3" <eq name="state" value="3">selected</eq> >已完成</option>
<option value="5" <eq name="state" value="5">selected</eq> >已发货</option>
<option value="2" <eq name="state" value="2">selected</eq> >未完成</option>
</select>
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Orderscourier/order_list')}">清空</a>
</form>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th>序号</th>
<th>订单号</th>
<th>数量</th>
<th>价钱</th>
<th>订单状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<volist name="data" id="vo">
<tr class="tr{$vo.id}">
<td>{$vo.id}</td>
<td>{$vo.order_number}</td>
<td>{$vo.book_num}</td>
<td>{$vo.money}</td>
<if condition="$vo.state eq 4">
<td>待付款</td>
<elseif condition="$vo.state eq 1"/>
<td>已付款</td>
<elseif condition="$vo.state eq 2"/>
<td>未完成</td>
<elseif condition="$vo.state eq 3"/>
<td>已完成</td>
<elseif condition="$vo.state eq 5"/>
<td>已发货</td>
</if>
<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
<td style="width: 230px;" class="fahuo{$vo.id}">
<a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">查看</button></a>
<!-- <if condition="$vo.state eq 2">-->
<!-- <button type="button" class="btn btn-default">物流信息</button>-->
<!-- <else/>-->
<!-- <a href="{:url('Orderscourier/logistics_information',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>-->
<!-- </if>-->
<if condition="$vo.state eq 2">
<a href="{:url('Orderscourier/fahuo',array('id'=>$vo['id']))}"><button type="button" class="btn btn-default">发货</button></a>
<elseif condition="$vo.state eq 5">
<a class="js-ajax-delete" href="{:url('Orderscourier/complete',array('id'=>$vo['id']))}" data-msg="您确定该订单已完成吗?">
<button type="button" class="btn btn-default">完成</button>
</a>
</elseif>
</if>
</td>
</tr>
</volist>
</tbody>
</table>
<div class="pagination">
{$data->render()}
</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
/**
*待发货
*/
function deliver_goods(id){
ccc = window.confirm('确定发货?');
if(ccc){
$.post("{:url('Bird/createOrder')}",{indent_id:id},function(data){
if(data == '缺少必要参数'){
alert('缺少必要参数');
}else if(data == '未查询到该订单'){
alert('未查询到该订单');
}else if(data == '该订单不是待发货状态'){
alert('该订单不是待发货状态');
}else{
data = JSON.parse(data);
if(data.code == '20000'){
$('.daifa'+id).remove();
$('.fahuo'+id).append("<button type='button' class='btn btn-default'>已发货</button>");
alert('发货成功');
}else if(data.code == '40000'){
alert('发货失败');
}
}
});
}
}
</script>
</body>
</html>
<include file="public@header"/>
</head>
<body>
<style>
.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
.pagination .active{background-color: #dd1a20;color: #fff;}
.pagination .disabled{color:#aaa;}
</style>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="#">平台订单列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Orderscourier/order_list')}">
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入订单号...">
订单状态:
<select name="state" class="form-control">
<option value="">全部</option>
<option value="3" <eq name="state" value="3">selected</eq> >已完成</option>
<option value="5" <eq name="state" value="5">selected</eq> >已发货</option>
<option value="2" <eq name="state" value="2">selected</eq> >未完成</option>
</select>
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Orderscourier/order_list')}">清空</a>
</form>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th>序号</th>
<th>订单号</th>
<th>姓名</th>
<th>书籍</th>
<th>数量</th>
<th>价钱</th>
<th>订单状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<volist name="data" id="vo">
<tr class="tr{$vo.id}">
<td>{$vo.id}</td>
<td>{$vo.order_number}</td>
<td>{$vo.name}</td>
<td>{$vo.books}</td>
<td>{$vo.book_num}</td>
<td>{$vo.money}</td>
<if condition="$vo.state eq 4">
<td>待付款</td>
<elseif condition="$vo.state eq 1"/>
<td>已付款</td>
<elseif condition="$vo.state eq 2"/>
<td>未完成</td>
<elseif condition="$vo.state eq 3"/>
<td>已完成</td>
<elseif condition="$vo.state eq 5"/>
<td>已发货</td>
</if>
<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
<td style="width: 230px;" class="fahuo{$vo.id}">
<a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">查看</button></a>
<!-- <if condition="$vo.state eq 2">-->
<!-- <button type="button" class="btn btn-default">物流信息</button>-->
<!-- <else/>-->
<!-- <a href="{:url('Orderscourier/logistics_information',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>-->
<!-- </if>-->
<if condition="$vo.state eq 2">
<a href="{:url('Orderscourier/fahuo',array('id'=>$vo['id']))}"><button type="button" class="btn btn-default">发货</button></a>
<elseif condition="$vo.state eq 5">
<a class="js-ajax-delete" href="{:url('Orderscourier/complete',array('id'=>$vo['id']))}" data-msg="您确定该订单已完成吗?">
<button type="button" class="btn btn-default">完成</button>
</a>
</elseif>
</if>
</td>
</tr>
</volist>
</tbody>
</table>
<div class="pagination">
{$page}
</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
/**
*待发货
*/
function deliver_goods(id){
ccc = window.confirm('确定发货?');
if(ccc){
$.post("{:url('Bird/createOrder')}",{indent_id:id},function(data){
if(data == '缺少必要参数'){
alert('缺少必要参数');
}else if(data == '未查询到该订单'){
alert('未查询到该订单');
}else if(data == '该订单不是待发货状态'){
alert('该订单不是待发货状态');
}else{
data = JSON.parse(data);
if(data.code == '20000'){
$('.daifa'+id).remove();
$('.fahuo'+id).append("<button type='button' class='btn btn-default'>已发货</button>");
alert('发货成功');
}else if(data.code == '40000'){
alert('发货失败');
}
}
});
}
}
</script>
</body>
</html>
... ...
<include file="public@header"/>
</head>
<body>
<style>
.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
.pagination .active{background-color: #dd1a20;color: #fff;}
.pagination .disabled{color:#aaa;}
</style>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="#">用户列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Users/user_list')}">
<!--时间:-->
<!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->
<!--value="{$start_time|default=''}"-->
<!--style="width: 140px;" autocomplete="off">- -->
<!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->
<!--value="{$end_time|default=''}"-->
<!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->
序号:
<input type="text" class="form-control" name="id" style="width: 200px;"
value="{$id|default=''}" placeholder="请输入序号">
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入微信昵称...">
身份:
<select name="identity" class="form-control">
<option value="">全部</option>
<option value="2" <eq name="status" value="2">selected</eq> >一级业务员</option>
<option value="3" <eq name="status" value="3">selected</eq> >二级业务员</option>
<option value="4" <eq name="status" value="4">selected</eq> >学生</option>
<option value="-1" <eq name="status" value="-1">selected</eq> >自由人</option>
</select>
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Users/user_list')}">清空</a>
</form>
<table class="table table-hover table-bordered table-list">
<caption>边框表格布局</caption>
<thead>
<tr>
<th>序号</th>
<th>微信昵称</th>
<th>身份</th>
<th>手机号</th>
<th>邀请人序号</th>
<th>邀请人姓名</th>
<th>邀请人</th>
<th>邀请人数</th>
<th>历史总收入</th>
<th>已提金额</th>
<th>余额</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<volist name="list" id="val">
<tr>
<td>{$val.id}</td>
<td>{$val.user_nickname}</td>
<if condition="$val.status eq 2">
<td>一级业务员</td>
<elseif condition="$val.status eq 3"/>
<td>二级业务员</td>
<elseif condition="$val.status eq 4"/>
<td>学生</td>
<else/>
<td>自由人</td>
</if>
<td>{$val.phone}</td>
<td>{$val.pid}</td>
<td>{$val.invite_nickname}</td>
<td>{$val.inviter_phone}</td>
<td>{$val.invite_count}</td>
<td>{$val.all_count}</td>
<td>{$val.ti_count}</td>
<td>{$val.balance}</td>
<if condition="$val.status eq 2">
<td>{$val.audit_time|date="Y-m-d H:i:s",###}</td>
<else/>
<td>{$val.create_time|date="Y-m-d H:i:s",###}</td>
</if>
<td style="width:300px;">
<input type="hidden" name="" class="bianji{$val.id}">
<if condition="$val.status eq 0">
<button type="button" class="btn btn-default setup{$val.id}" onclick="set_up({$val.id})">设为业务员</button>
<elseif condition="$val.status eq 1"/>
<button type="button" class="btn btn-default">已设为业务员</button>
<elseif condition="$val.status eq 5"/>
<button type="button" class="btn btn-default">业务员审核中</button>
<elseif condition="$val.status eq 6" />
<button type="button" class="btn btn-default">审核驳回</button>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">不能设置</button>
</if>
<if condition="$val.status eq 2">
<a href="{:url('Users/teacher_list',array('id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
<elseif condition="$val.status eq 3"/>
<a href="{:url('Users/student_list',array('teacher_id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">没有下线</button>
</if>
<if condition="$val.status eq 2">
<a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
<button type="button" class="btn btn-default">余额明细</button>
</a>
<elseif condition="$val.status eq 3"/>
<a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
<button type="button" class="btn btn-default">余额明细</button>
</a>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">没有余额</button>
</if>
</td>
</tr>
</volist>
</tbody>
</table>
<div class="pagination">
{$data->render()}
</div>
</div>
<script>
/**
*设置为业务员
*/
function set_up(id){
ccc = window.confirm('是否设置为业务员?');
if(ccc){
$.post("{:url('Users/set_salesman')}",{id:id},function(data){
if(data){
$('.setup'+id).remove();
$('.bianji'+id).after("<button type='button' class='btn btn-default'>已设为业务员</button>");
}else{
alert('设置失败');
}
});
}
}
</script>
<script src="__STATIC__/js/admin.js"></script>
</body>
<include file="public@header"/>
</head>
<body>
<style>
.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
.pagination .active{background-color: #dd1a20;color: #fff;}
.pagination .disabled{color:#aaa;}
</style>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="#">用户列表</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('Users/user_list')}">
<!--时间:-->
<!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->
<!--value="{$start_time|default=''}"-->
<!--style="width: 140px;" autocomplete="off">- -->
<!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->
<!--value="{$end_time|default=''}"-->
<!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->
序号:
<input type="text" class="form-control" name="id" style="width: 200px;"
value="{$id|default=''}" placeholder="请输入序号">
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入微信昵称/手机号">
身份:
<select name="identity" class="form-control">
<option value="">全部</option>
<option value="2" <eq name="status" value="2">selected</eq> >一级业务员</option>
<option value="3" <eq name="status" value="3">selected</eq> >二级业务员</option>
<option value="4" <eq name="status" value="4">selected</eq> >学生</option>
<option value="-1" <eq name="status" value="-1">selected</eq> >自由人</option>
</select>
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('Users/user_list')}">清空</a>
</form>
<table class="table table-hover table-bordered table-list">
<caption>边框表格布局</caption>
<thead>
<tr>
<th>序号</th>
<th>微信昵称</th>
<th>身份</th>
<th>手机号</th>
<th>邀请人序号</th>
<th>邀请人姓名</th>
<th>邀请人</th>
<th>邀请人数</th>
<th>历史总收入</th>
<th>已提金额</th>
<th>余额</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<volist name="list" id="val">
<tr>
<td>{$val.id}</td>
<td>{$val.user_nickname}</td>
<if condition="$val.status eq 2">
<td>一级业务员</td>
<elseif condition="$val.status eq 3"/>
<td>二级业务员</td>
<elseif condition="$val.status eq 4"/>
<td>学生</td>
<else/>
<td>自由人</td>
</if>
<td>{$val.phone}</td>
<td>{$val.pid}</td>
<td>{$val.invite_nickname}</td>
<td>{$val.inviter_phone}</td>
<td>{$val.invite_count}</td>
<td>{$val.all_count}</td>
<td>{$val.ti_count}</td>
<td>{$val.balance}</td>
<if condition="$val.status eq 2">
<td>{$val.audit_time|date="Y-m-d H:i:s",###}</td>
<else/>
<td>{$val.create_time|date="Y-m-d H:i:s",###}</td>
</if>
<td style="width:300px;">
<input type="hidden" name="" class="bianji{$val.id}">
<if condition="$val.status eq 0">
<button type="button" class="btn btn-default setup{$val.id}" onclick="set_up({$val.id})">设为业务员</button>
<elseif condition="$val.status eq 1"/>
<button type="button" class="btn btn-default">已设为业务员</button>
<elseif condition="$val.status eq 5"/>
<button type="button" class="btn btn-default">业务员审核中</button>
<elseif condition="$val.status eq 6" />
<button type="button" class="btn btn-default">审核驳回</button>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">不能设置</button>
</if>
<if condition="$val.status eq 2">
<a href="{:url('Users/teacher_list',array('id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
<elseif condition="$val.status eq 3"/>
<a href="{:url('Users/student_list',array('teacher_id'=>$val.id))}"><button type="button" class="btn btn-default">下线名单</button></a>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">没有下线</button>
</if>
<if condition="$val.status eq 2">
<a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
<button type="button" class="btn btn-default">余额明细</button>
</a>
<elseif condition="$val.status eq 3"/>
<a href="{:url('Users/users_money',array('uid'=>$val.uid))}">
<button type="button" class="btn btn-default">余额明细</button>
</a>
<else/>
<button type="button" class="btn btn-default" style="background-color: red;">没有余额</button>
</if>
</td>
</tr>
</volist>
</tbody>
</table>
<div class="pagination">
{$data->render()}
</div>
</div>
<script>
/**
*设置为业务员
*/
function set_up(id){
ccc = window.confirm('是否设置为业务员?');
if(ccc){
$.post("{:url('Users/set_salesman')}",{id:id},function(data){
if(data){
$('.setup'+id).remove();
$('.bianji'+id).after("<button type='button' class='btn btn-default'>已设为业务员</button>");
}else{
alert('设置失败');
}
});
}
}
</script>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
\ No newline at end of file
... ...