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

4

  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 +
  14 + if($this -> request -> isPost()){
  15 + $where = [
  16 + "indent_type" => 1
  17 + ];
  18 + if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
  19 + $start_time = strtotime($_POST['start_time']);
  20 + $end_time = strtotime($_POST['end_time']);
  21 + $where['create_time'] = [['>=',$start_time],['<=',$end_time]];
  22 + }
  23 + if(!empty($_POST['keyword'])){
  24 + $where['order_number'] = $_POST['keyword'];
  25 + }
  26 + if(!empty($_POST['state'])){
  27 + $where['state'] = $_POST['state'];
  28 + }
  29 + $data = Db::name('indent') -> where($where) -> where("state = 2 or state = 3 or state = 5") -> paginate(12);
  30 + }else{
  31 + $data = Db::name('indent') -> where('indent_type','1') -> where("state = 2 or state = 3 or state = 5") -> paginate(12);
  32 + }
  33 + $this -> assign('data',$data);
  34 + return $this -> fetch();
  35 +
  36 + }
  37 +
  38 +
  39 +
  40 +
  41 +
  42 +
  43 +
  44 +
  45 +
  46 +
  47 +}
@@ -36,8 +36,13 @@ class BirdController extends HomeBaseController @@ -36,8 +36,13 @@ class BirdController extends HomeBaseController
36 * @throws \think\db\exception\ModelNotFoundException 36 * @throws \think\db\exception\ModelNotFoundException
37 * @throws \think\exception\DbException 37 * @throws \think\exception\DbException
38 */ 38 */
39 - public function createOrder($indent_id = null) 39 + public function createOrder()
40 { 40 {
  41 + if(empty($_POST['indent_id'])){
  42 + $indent_id = null;
  43 + }else{
  44 + $indent_id = $_POST['indent_id'];
  45 + }
41 if(empty($indent_id)){ 46 if(empty($indent_id)){
42 return "缺少必要参数"; 47 return "缺少必要参数";
43 } 48 }
@@ -105,9 +110,9 @@ class BirdController extends HomeBaseController @@ -105,9 +110,9 @@ class BirdController extends HomeBaseController
105 if(!empty($result['Order']['LogisticCode'])){ 110 if(!empty($result['Order']['LogisticCode'])){
106 $indentModel->updateData(['id'=>$indent_id],['logistic_code'=>$result['Order']['LogisticCode']]); 111 $indentModel->updateData(['id'=>$indent_id],['logistic_code'=>$result['Order']['LogisticCode']]);
107 } 112 }
108 - return dump(['code'=>20000,'msg'=>'SUCCESS','data'=>$result]);//返回快递单号 113 + return json_encode(['code'=>20000,'msg'=>'SUCCESS','data'=>$result]);//返回快递单号
109 } else { 114 } else {
110 - return dump(['code'=>40000,'msg'=>$result['Reason']]); 115 + return json_encode(['code'=>40000,'msg'=>$result['Reason']]);
111 } 116 }
112 } 117 }
113 118
@@ -44,6 +44,8 @@ return array ( @@ -44,6 +44,8 @@ return array (
44 'ADMIN_NAVMENU_INDEX' => '导航菜单', 44 'ADMIN_NAVMENU_INDEX' => '导航菜单',
45 'ADMIN_NAVMENU_LISTORDER' => '导航菜单排序', 45 'ADMIN_NAVMENU_LISTORDER' => '导航菜单排序',
46 'ADMIN_ORDER_INDEX' => '订单管理', 46 'ADMIN_ORDER_INDEX' => '订单管理',
  47 + 'ADMIN_ORDERSCOURIER_INDEX' => '平台订单发货',
  48 + 'ADMIN_ORDERSCOURIER_ORDER_LIST' => '平台订单列表',
47 'ADMIN_PLATFORMORDERS_PLAT_LIST' => '平台订单', 49 'ADMIN_PLATFORMORDERS_PLAT_LIST' => '平台订单',
48 'ADMIN_PLUGIN_DEFAULT' => '插件管理', 50 'ADMIN_PLUGIN_DEFAULT' => '插件管理',
49 'ADMIN_PLUGIN_INDEX' => '插件列表', 51 'ADMIN_PLUGIN_INDEX' => '插件列表',
  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">已完成</option>
  29 + <option value="2">未完成</option>
  30 + </select>
  31 + <input type="submit" class="btn btn-primary" value="搜索"/>
  32 + <a class="btn btn-danger" href="{:url('Orderscourier/order_list')}">清空</a>
  33 + </form>
  34 + <table class="table table-bordered">
  35 + <thead>
  36 + <tr>
  37 + <th>序号</th>
  38 + <th>订单号</th>
  39 + <th>数量</th>
  40 + <th>价钱</th>
  41 + <th>订单状态</th>
  42 + <th>创建时间</th>
  43 + <th>操作</th>
  44 + </tr>
  45 + </thead>
  46 + <tbody>
  47 + <volist name="data" id="vo">
  48 + <tr class="tr{$vo.id}">
  49 + <td>{$vo.id}</td>
  50 + <td>{$vo.order_number}</td>
  51 + <td>{$vo.book_num}</td>
  52 + <td>{$vo.money}</td>
  53 + <if condition="$vo.state eq 4">
  54 + <td>待付款</td>
  55 + <elseif condition="$vo.state eq 1"/>
  56 + <td>已付款</td>
  57 + <elseif condition="$vo.state eq 2"/>
  58 + <td>未完成</td>
  59 + <elseif condition="$vo.state eq 3"/>
  60 + <td>已完成</td>
  61 + </if>
  62 + <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
  63 + <td style="width: 171px;">
  64 + <if condition="$vo.state eq 2">
  65 + <button type="button" class="btn btn-default">物流信息</button>
  66 + <else/>
  67 + <a href="{:url('Platformorders/plat_view',array('id'=>$vo.id))}"><button type="button" class="btn btn-default">物流信息</button></a>
  68 + </if>
  69 +
  70 + <if condition="$vo.state eq 2">
  71 + <button type="button" class="btn btn-default" onclick="deliver_goods({$vo.id})">待发货</button>
  72 + <else/>
  73 + <button type="button" class="btn btn-default">已发货</button>
  74 + </if>
  75 +
  76 + </td>
  77 + </tr>
  78 + </volist>
  79 + </tbody>
  80 + </table>
  81 + <div class="pagination">
  82 + {$data->render()}
  83 + </div>
  84 +</div>
  85 +<script src="__STATIC__/js/admin.js"></script>
  86 +<script>
  87 + /**
  88 + *待发货
  89 + */
  90 + function deliver_goods(id){
  91 + ccc = window.confirm('确定发货?');
  92 + if(ccc){
  93 + $.post("{:url('Bird/createOrder')}",{indent_id:id},function(data){
  94 +
  95 + });
  96 + }
  97 + }
  98 +</script>
  99 +</body>
  100 +</html>
@@ -86,7 +86,6 @@ @@ -86,7 +86,6 @@
86 }else{ 86 }else{
87 window.location.href = "{:url('Orderpage/go_add_address',array('indet_id'=>$indent_id))}"; 87 window.location.href = "{:url('Orderpage/go_add_address',array('indet_id'=>$indent_id))}";
88 } 88 }
89 -  
90 }else{ 89 }else{
91 alert('保存失败!'); 90 alert('保存失败!');
92 } 91 }
@@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController @@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController
204 */ 204 */
205 public function checkWeChatUserLogin() 205 public function checkWeChatUserLogin()
206 { 206 {
207 - /*$user = Db::name('user')->where('id',2)->find();  
208 - cmf_update_current_user($user);*/ 207 + $user = Db::name('user')->where('id',2)->find();
  208 + cmf_update_current_user($user);
209 $userId = cmf_get_current_user_id(); 209 $userId = cmf_get_current_user_id();
210 if (empty($userId)) { 210 if (empty($userId)) {
211 $config = [ 211 $config = [