作者 anyv
1 个管道 的构建 通过 耗费 6 秒

4

<?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(){
if($this -> request -> isPost()){
$where = [
"indent_type" => 1
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$where['order_number'] = $_POST['keyword'];
}
if(!empty($_POST['state'])){
$where['state'] = $_POST['state'];
}
$data = Db::name('indent') -> where($where) -> where("state = 2 or state = 3 or state = 5") -> paginate(12);
}else{
$data = Db::name('indent') -> where('indent_type','1') -> where("state = 2 or state = 3 or state = 5") -> paginate(12);
}
$this -> assign('data',$data);
return $this -> fetch();
}
}
\ No newline at end of file
... ...
... ... @@ -36,8 +36,13 @@ class BirdController extends HomeBaseController
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function createOrder($indent_id = null)
public function createOrder()
{
if(empty($_POST['indent_id'])){
$indent_id = null;
}else{
$indent_id = $_POST['indent_id'];
}
if(empty($indent_id)){
return "缺少必要参数";
}
... ... @@ -105,9 +110,9 @@ class BirdController extends HomeBaseController
if(!empty($result['Order']['LogisticCode'])){
$indentModel->updateData(['id'=>$indent_id],['logistic_code'=>$result['Order']['LogisticCode']]);
}
return dump(['code'=>20000,'msg'=>'SUCCESS','data'=>$result]);//返回快递单号
return json_encode(['code'=>20000,'msg'=>'SUCCESS','data'=>$result]);//返回快递单号
} else {
return dump(['code'=>40000,'msg'=>$result['Reason']]);
return json_encode(['code'=>40000,'msg'=>$result['Reason']]);
}
}
... ...
... ... @@ -44,6 +44,8 @@ return array (
'ADMIN_NAVMENU_INDEX' => '导航菜单',
'ADMIN_NAVMENU_LISTORDER' => '导航菜单排序',
'ADMIN_ORDER_INDEX' => '订单管理',
'ADMIN_ORDERSCOURIER_INDEX' => '平台订单发货',
'ADMIN_ORDERSCOURIER_ORDER_LIST' => '平台订单列表',
'ADMIN_PLATFORMORDERS_PLAT_LIST' => '平台订单',
'ADMIN_PLUGIN_DEFAULT' => '插件管理',
'ADMIN_PLUGIN_INDEX' => '插件列表',
... ...
<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">已完成</option>
<option value="2">未完成</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-bordered">
<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>
</if>
<td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
<td style="width: 171px;">
<if condition="$vo.state eq 2">
<button type="button" class="btn btn-default">物流信息</button>
<else/>
<a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>
</if>
<if condition="$vo.state eq 2">
<button type="button" class="btn btn-default" onclick="deliver_goods({$vo.id})">待发货</button>
<else/>
<button type="button" class="btn btn-default">已发货</button>
</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){
});
}
}
</script>
</body>
</html>
... ...
... ... @@ -86,7 +86,6 @@
}else{
window.location.href = "{:url('Orderpage/go_add_address',array('indet_id'=>$indent_id))}";
}
}else{
alert('保存失败!');
}
... ...
... ... @@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController
*/
public function checkWeChatUserLogin()
{
/*$user = Db::name('user')->where('id',2)->find();
cmf_update_current_user($user);*/
$user = Db::name('user')->where('id',2)->find();
cmf_update_current_user($user);
$userId = cmf_get_current_user_id();
if (empty($userId)) {
$config = [
... ...