Commit 23d610ae7a7d6f8d92ee505ca68c4b60dcb49f50

Authored by teemitop
1 parent b24d3a6d

获取预定订单

@@ -574,4 +574,84 @@ class Seller extends Common @@ -574,4 +574,84 @@ class Seller extends Common
574 $this->assign ( 'title','商家话机在线设备列表'); 574 $this->assign ( 'title','商家话机在线设备列表');
575 return $this->fetch(); 575 return $this->fetch();
576 } 576 }
  577 +
  578 + /**
  579 + * 从商家维度统计:订单、短信等情况
  580 + */
  581 + public function GetReserveList(){
  582 + if(Request::isAjax()){
  583 + $data = Request::except('file');
  584 + $key= input('post.key') ? input('post.key') : "";
  585 + $nokey= input('post.nokey') ? input('post.nokey') : "";
  586 +
  587 + $sellername = $data['key'] ? $data['key'] : ''; //商家名称
  588 + $id = $data['nokey'] ? $data['nokey'] : ''; //订单ID
  589 +
  590 + $time = $data['time'] ? explode(' - ', $data['time']) : '';
  591 +
  592 + $stime = $time ? strtotime(date($time[0],time())) : strtotime(date('Y-m-d 00:00:00',time()));
  593 + $etime = $time ? strtotime(date($time[1],time())) : strtotime(date('Y-m-d 23:59:59',time()));
  594 +
  595 + $data['status'] = $data['status'] ? $data['status'] : 2;
  596 + $data['channel'] = $data['channel'] ? $data['channel'] : 1;
  597 +
  598 + $parame = '&offset='.$data["page"].'&limit='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&id='.$id.'&status='.@$data['status'];
  599 +
  600 + //获取运营人员列表
  601 + $list= file_get_contents(UNDER_LINE.'App.Customer.GetReserveList'.$parame);
  602 + $array = json_decode($list,TRUE);
  603 +
  604 + $new_array = array();
  605 + foreach ($array['data']['list'] as $key => $value) {
  606 + switch ($value['status']) {
  607 + case 0:
  608 + $array['data']['list'][$key]['sta'] = '待确认';
  609 + break;
  610 + case 1:
  611 + $array['data']['list'][$key]['sta'] = '已定座';
  612 + break;
  613 + case 2:
  614 + $array['data']['list'][$key]['sta'] = '到店';
  615 + break;
  616 + case 3:
  617 + $array['data']['list'][$key]['sta'] = '离店';
  618 + break;
  619 + case 4:
  620 + $array['data']['list'][$key]['sta'] = '已取消';
  621 + break;
  622 + case 5:
  623 + $array['data']['list'][$key]['sta'] = '已分配';
  624 + break;
  625 + case 6:
  626 + $array['data']['list'][$key]['sta'] = '拒单';
  627 + break;
  628 + default:
  629 + # code...
  630 + break;
  631 + }
  632 + switch ($value['sex']) {
  633 + case 1:
  634 + $array['data']['list'][$key]['rname'] = $value['rname'].'先生'.'('.$value['phone'].')';
  635 + break;
  636 + case 2:
  637 + $array['data']['list'][$key]['rname'] = $value['rname'].'女士'.'('.$value['phone'].')';
  638 + break;
  639 + case 3:
  640 + $array['data']['list'][$key]['rname'] = $value['rname'].'公司'.'('.$value['phone'].')';
  641 + break;
  642 + default:
  643 + # code...
  644 + break;
  645 + }
  646 + }
  647 + return $result = [
  648 + 'code'=>0,'msg'=>'获取成功!',
  649 + 'data'=>$array['data']['list'],
  650 + 'count'=>$array['data']['total'],
  651 + 'rel'=>1
  652 + ];
  653 + }
  654 + $this->assign ( 'title','C端预定订单管理');
  655 + return $this->fetch();
  656 + }
577 } 657 }
  1 +{include file="common/head"/}
  2 +<div class="admin-main layui-anim layui-anim-upbit">
  3 + <fieldset class="layui-elem-field layui-field-title">
  4 + <legend>{:$title}</legend>
  5 + </fieldset>
  6 + <div class="demoTable">
  7 + 订单编号:
  8 + <div class="layui-input-inline">
  9 + <input class="layui-input" name="nokey" id="nokey" placeholder="{:lang('pleaseEnter')}订单编号" autocomplete="off">
  10 + </div>
  11 + 商家:
  12 + <div class="layui-input-inline">
  13 + <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
  14 + </div>
  15 + 日期范围:
  16 + <div class="layui-input-inline" >
  17 + <input type="text" style = "width:300px"; class="layui-input" id="time" placeholder="默认为当天的统计情况">
  18 + </div>
  19 + 商家来源:
  20 + <div class="layui-input-inline layui-form">
  21 + <div class="layui-input-8">
  22 + <select name="class" id="channel" lay-filter="myselect">
  23 + <option value="-1">全部</option>
  24 + <option value="1" selected="true">合作</option>
  25 + <option value="2">推广</option>
  26 + <option value="3">测试</option>
  27 + </select>
  28 + </div>
  29 + </div>
  30 + 订单状态:
  31 + <div class="layui-input-inline layui-form">
  32 + <div class="layui-input-8">
  33 + <select name="class" id="status" lay-filter="myselect">
  34 + <option value="1">待处理</option>
  35 + <option value="2" selected="true">超时5分钟未处理</option>
  36 + <option value="3">已拒绝</option>
  37 + <option value="4">已安排</option>
  38 + <option value="5">已取消</option>
  39 + </select>
  40 + </div>
  41 + </div>
  42 + <button class="layui-btn" id="search" data-type="reload">查询统计</button>
  43 + </div>
  44 + <table class="layui-table" id="list" lay-filter="list">
  45 + </table>
  46 +</div>
  47 +<script type="text/html" id="toolbarDemo">
  48 + <span>订单总数:<i id="count">X</i>单</span>
  49 + <span>未处理订单总数:<i id="untreated">Y</i>单</span>
  50 + <span>超时订单总数:<i id="overtime">Z</i>单</span>
  51 +</script>
  52 +
  53 +<script type="text/html" id="action">
  54 + {{#if(d.status==0){}}
  55 + <a class="layui-btn layui-btn-xs">拒绝订单</a>
  56 + <a class="layui-btn layui-btn-xs">安排包间</a>
  57 + {{#} else if(d.status==5) {}} 
  58 + <a class="layui-btn layui-btn-xs">取消订单</a>
  59 + {{#} else {}} 
  60 + 暂无操作
  61 + {{#}}}
  62 +</script>
  63 +{include file="common/foot"/}
  64 +<script>
  65 + layui.use(['table','form','laydate'], function() {
  66 + var table = layui.table,laydate = layui.laydate,$ = layui.jquery;
  67 + console.log(layui);
  68 + var tableIn = table.render({
  69 + elem: '#list',
  70 + url: '{:url("GetReserveList")}',
  71 + method: 'post',
  72 + title: 'C端预定订单管理',
  73 + page:true,
  74 + sort:true,
  75 + toolbar: '#toolbarDemo',
  76 + cols: [[
  77 + {field: 'id', title: '订单编号',width:100, fixed: true},
  78 + {field: 'sellername', title: '所属商家'},
  79 + {field: 'seller_tel', title: '商家电话'},
  80 + {field: 'ddate', title: '到店时间'},
  81 + {field: 'pnum', title: '就餐人数'},
  82 + {field: 'rname', title: '客户信息'},
  83 + {field: 'cusdem', title: '备注'},
  84 + {field: 'cdate',title: '下单时间'},
  85 + {field: 'sta',title: '状态'},
  86 + {align: 'center', width:260,title: '操作', toolbar: '#action'}
  87 + ]],
  88 + done: function(res, curr, count){
  89 + $('#count').html(res.countReserve);
  90 + $('#untreated').html(res.countSms);
  91 + $('#overtime').html(res.inviteeCount);
  92 + }
  93 + ,id: 'testReload'
  94 + ,page: true
  95 + ,limit:15
  96 + });
  97 +
  98 + //日期时间范围
  99 + laydate.render({
  100 + elem: '#time'
  101 + ,type: 'datetime'
  102 + ,range: true
  103 + });
  104 +
  105 + //搜索
  106 + $('#search').on('click', function() {
  107 + //关键字
  108 + var nokey = $('#nokey').val();
  109 + //关键字
  110 + var key = $('#key').val();
  111 + //选中的商家ID
  112 + /*var checkStatus = table.checkStatus('testReload'); //test即为参数id设定的值
  113 + var a = [];
  114 + $(checkStatus.data).each(function(i,o){
  115 + a.push(o.id);
  116 + });
  117 + console.log(a);*/
  118 +
  119 + var time = $('#time').val();
  120 + console.log(time);
  121 + //商家来源
  122 + var channel = $('#channel').val();
  123 + console.log(channel);
  124 + //筛选条件
  125 + var status = $('#status').val();
  126 + console.log(status);
  127 + //传参
  128 + tableIn.reload({ page: {page: 1},where: {nokey: nokey,key: key,status: status,time: time,channel: channel}});
  129 + });
  130 +
  131 + var $ = layui.$, active = {
  132 + reload: function(){
  133 + var nokey = $('#nokey');
  134 + var key = $('#key');
  135 + //执行重载
  136 + table.reload('testReload', {
  137 + page: {
  138 + curr: 1 //重新从第 1 页开始
  139 + }
  140 + ,where: {
  141 + key: {
  142 + id: key.val(),
  143 + no: nokey.val()
  144 + }
  145 + }
  146 + });
  147 + }
  148 + };
  149 + })
  150 +</script>