Order.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <?php
  2. namespace app\api\controller\screen;
  3. use app\hander\HelpHander;
  4. use app\api\controller\screen\Index;
  5. use think\Db;
  6. use think\helper\Time;
  7. class Order extends Index
  8. {
  9. // 工单数据分析 今日工单完成率(报修,保洁,隐患,运送)
  10. public function finishRate(){
  11. $lists = [
  12. ['id' => 1, 'name' => '报修', 'finish' => 0, 'total' => 0, 'bl' => 0],
  13. ['id' => 2, 'name' => '保洁', 'finish' => 0, 'total' => 0, 'bl' => 0],
  14. ['id' => 3, 'name' => '运送', 'finish' => 0, 'total' => 0, 'bl' => 0],
  15. ['id' => 4, 'name' => '应急', 'finish' => 0, 'total' => 0, 'bl' => 0]
  16. ];
  17. $curTime = date('Ymd');
  18. $total = 0;
  19. $finish = 0;
  20. foreach ($lists as $k=>$v){
  21. $t = Db::name('orders')
  22. ->where('del',0)
  23. ->where('work_type_mode',$v['id'])
  24. ->where('create_yyyymmdd',$curTime)
  25. ->where('org_id',$this->orgId)
  26. ->count();
  27. $f = Db::name('orders')
  28. ->where('del',0)
  29. ->where('work_type_mode',$v['id'])
  30. ->where('order_mode','in',[5,6])
  31. ->where('create_yyyymmdd',$curTime)
  32. ->where('org_id',$this->orgId)
  33. ->count();
  34. $total += $t;
  35. $finish += $f;
  36. $lists[$k]['finish'] = $f;
  37. $lists[$k]['total'] = $t;
  38. $lists[$k]['bl'] = $t>0?round($f/$t,2)*100:0;
  39. }
  40. $bl = $total > 0?(round($finish/$total,3)*100):0;
  41. $data = [
  42. 'bl' => $bl.'%',
  43. 'list' => $lists
  44. ];
  45. HelpHander::success($data);
  46. }
  47. // 任务数据统计
  48. public function orderCount(){
  49. $mode = input('mode/d',1);
  50. $type = input('type/d',1);
  51. if(!in_array($type,[1,2,3])||!in_array($mode,[1,2,3,4])){
  52. HelpHander::error('参数错误');
  53. }
  54. $date = [];
  55. $curDay = date('Y-m-d');
  56. if($type == 1){ // 日统计
  57. $date[] = '03';
  58. $date[] = '06';
  59. $date[] = '09';
  60. $date[] = '12';
  61. $date[] = '15';
  62. $date[] = '18';
  63. $date[] = '21';
  64. $date[] = '24';
  65. }else if($type == 2){ // 周统计
  66. $ms = Time::week();
  67. $start = $ms[0];
  68. $end = $ms[1] + 1;
  69. $date[] = date('Y-m-d',$start);
  70. $i = 1;
  71. while (($start + $i*24*60*60) < $end){
  72. $date[] = date('Y-m-d',$start + $i*24*60*60);
  73. $i++;
  74. }
  75. }else{ // 月统计
  76. $ms = Time::month();
  77. $start = $ms[0];
  78. $end = $ms[1] + 1;
  79. $i = 1;
  80. while (($start + $i*24*60*60) < $end){
  81. $date[] = date('Y-m-d',$start + $i*24*60*60);
  82. $i++;
  83. }
  84. }
  85. $d1 = [];
  86. $d2 = [];
  87. $d = [];
  88. foreach ($date as $k=>$v){
  89. $map = [];
  90. $map[] = ['org_id','=',$this->orgId];
  91. $map[] = ['work_type_mode','=',$mode];
  92. $map[] = ['del','=',0];
  93. if($type == 1){ // 日统计
  94. if($k == 0){
  95. $s = $curDay.' 00:00:00';
  96. }else{
  97. $s = $curDay.' '.$date[$k-1].':00:00';
  98. }
  99. $e = $curDay.' '.$v.':00:00';
  100. $map[] = ['create_time','egt',$s];
  101. $map[] = ['create_time','lt',$e];
  102. $d[] = (int)$v;
  103. }else{
  104. $map[] = ['create_yyyymmdd','=',date('Ymd',strtotime($v))];
  105. $d[] = date('m-d',strtotime($v));
  106. }
  107. $order = Db::name('orders')->where($map)->count();
  108. $todo = Db::name('todo')->where($map)->count();
  109. $d1[] = $todo;
  110. $d2[] = $order;
  111. }
  112. HelpHander::success(['d'=>$d,'d1'=>$d1,'d2'=>$d2]);
  113. }
  114. // 热点科室排名
  115. public function hotDep(){
  116. $type = input('type/d',1);
  117. if(!in_array($type,[1,2])){
  118. HelpHander::error('参数错误');
  119. }
  120. if($type == 1){ // 运送
  121. $map[] = ['work_type_mode','=',3];
  122. $map[] = ['org_id','=',$this->orgId];
  123. $map[] = ['del','=',0];
  124. $lists = Db::name('orders')
  125. ->where($map)
  126. ->where('dep_id','<>',0)
  127. ->field('count(*) as count,dep_id')
  128. ->group('dep_id')
  129. ->distinct(true)
  130. ->order('count desc')
  131. ->limit(10)
  132. ->select();
  133. }else{ // 陪护
  134. $map[] = ['org_id','=',$this->orgId];
  135. $lists = Db::name('ph_orders')
  136. ->where($map)
  137. ->field('count(*) as count,dep_id')
  138. ->group('dep_id')
  139. ->distinct(true)
  140. ->order('count desc')
  141. ->limit(10)
  142. ->select();
  143. }
  144. $data = [];
  145. $host = config("app.app_host");
  146. foreach ($lists as $k=>$v){
  147. if($k == 0){
  148. $top = '<img src="'.$host.'/img/org-top1.png" width="35" style="margin-top:5px">';
  149. }else if($k == 1){
  150. $top = '<img src="'.$host.'/img/org-top2.png" width="35" style="margin-top:5px">';
  151. }else if($k == 2){
  152. $top = '<img src="'.$host.'/img/org-top3.png" width="35" style="margin-top:5px">';
  153. }else{
  154. $top = 'TOP'.($k+1);
  155. }
  156. $depName = Db::name('dep')->where('id',$v['dep_id'])->value('title');
  157. $data[] = [$top,$depName?$depName:''];
  158. }
  159. HelpHander::success($data);
  160. }
  161. // 耗材使用排名
  162. public function hotMate(){
  163. $map[] = ['tm.org_id','=',$this->orgId];
  164. $lists = Db::name('todo_mate_item')
  165. ->alias('tmi')
  166. ->join('todo_mate tm','tm.id = tmi.todo_mate_id')
  167. ->where($map)
  168. ->field('sum(total) as total,items_id')
  169. ->group('items_id')
  170. ->distinct(true)
  171. ->order('total desc')
  172. ->limit(10)
  173. ->select();
  174. $data = [];
  175. $host = config("app.app_host");
  176. foreach ($lists as $k=>$v){
  177. if($k == 0){
  178. $top = '<img src="'.$host.'/img/org-top1.png" width="35" style="margin-top:5px">';
  179. }else if($k == 1){
  180. $top = '<img src="'.$host.'/img/org-top2.png" width="35" style="margin-top:5px">';
  181. }else if($k == 2){
  182. $top = '<img src="'.$host.'/img/org-top3.png" width="35" style="margin-top:5px">';
  183. }else{
  184. $top = 'TOP'.($k+1);
  185. }
  186. $name = Db::name('mate_goods')->where('id',$v['items_id'])->value('title');
  187. $data[] = [$top,$name?$name:''];
  188. }
  189. HelpHander::success($data);
  190. }
  191. //任务数据总览
  192. public function taskList(){
  193. $mode = input('mode/d',1);
  194. if(!in_array($mode,[1,2,3,4,5])){
  195. HelpHander::error('参数错误');
  196. }
  197. $data = [];
  198. // $header = ['状态', '类型', '始发地', '目的地', '需求时间', '执行人', '派工时间', '接收时间'];
  199. $header = ['类型', '始发地', '目的地', '需求时间','派工时间', '接收时间','状态', '执行人'];
  200. if($mode == 5){
  201. $header = ['状态', '订单号', '类型', '护工', '下单时间'];
  202. $lists = Db::name('ph_orders')
  203. ->where('org_id',$this->orgId)
  204. ->where('status','in',[1,2])
  205. ->order('id desc')
  206. ->field('id,sn,cate_id,status,create_time')
  207. ->limit(20)
  208. ->select();
  209. foreach ($lists as $k=>$v){
  210. $cate = Db::name('cate')->where('id',$v['cate_id'])->value('title');
  211. $stxt = '新订单';
  212. $users = '';
  213. if($v['status'] == 2){
  214. $stxt = '服务中';
  215. $unames = Db::name('ph_todo')
  216. ->alias('t')
  217. ->join('worker w','t.worker_id = w.id')
  218. ->join('user u','u.id = w.user_id')
  219. ->where('t.order_id',$v['id'])
  220. ->where('t.status',1)
  221. ->column('real_name');
  222. $users = $unames?implode(',',$unames):'';
  223. }
  224. $data[] = [$stxt,$v['sn'],$cate,$users,$v['create_time']];
  225. }
  226. }else{
  227. if($mode == 1){
  228. $header = ['下单时间', '科室', '报修事项', '内容', '状态'];
  229. }else if($mode == 2||$mode == 4){
  230. $header = [ '下单时间', '科室', '内容','状态'];
  231. }
  232. $lists = Db::name('orders')
  233. ->where('org_id',$this->orgId)
  234. ->where('order_mode','in',[1,4])
  235. ->where('work_type_mode',$mode)
  236. ->where('del',0)
  237. ->order('id desc')
  238. ->limit(20)
  239. ->field('id,order_mode,create_time,send_time,content,dep_id')
  240. ->select();
  241. foreach ($lists as $k=>$v){
  242. $dep = Db::name('dep')->where('id',$v['dep_id'])->value('title');
  243. $status = Db::name('order_mode')->where('id',$v['order_mode'])->value('out_content');
  244. if($mode == 1){ // 报修
  245. $type = Db::name('order_repair')
  246. ->alias('or')
  247. ->leftJoin('order_type ot','ot.id = or.type_id')
  248. ->where('or.order_id',$v['id'])
  249. ->value('title');
  250. $data[] = [$v['create_time'],$dep,$type?$type:'',$v['content'],$status];
  251. }else if($mode == 3){ //运送
  252. $convey = Db::name('order_convey')
  253. ->alias('oc')
  254. ->join('convey_cate cc','cc.id = oc.type')
  255. ->where('oc.order_id',$v['id'])
  256. ->field('oc.*,cc.title as cate_title')
  257. ->find();
  258. $start = Db::name('address')->where('id',$convey['start'])->value('title');
  259. $end = Db::name('address')->where('id',$convey['end'])->value('title');
  260. $todos = Db::name('todo')
  261. ->alias('t')
  262. ->join('user u','u.id = t.to_user_id')
  263. ->where('t.order_id',$v['id'])
  264. ->where('t.del',0)
  265. ->where('t.todo_mode','in',[1,2,3])
  266. ->field('t.confirm_time,u.real_name')
  267. ->select();
  268. $todos = $todos?$todos:[];
  269. $unames = [];
  270. $confirm = '';
  271. foreach ($todos as $tk=>$tv){
  272. $unames[] = $tv['real_name'];
  273. if(!$confirm){
  274. $confirm = $tv['confirm_time'];
  275. }
  276. }
  277. $un = $unames?implode(',',$unames):'';
  278. $send = $v['send_time']?date('H:i',strtotime($v['send_time'])):'';
  279. $xq = date('H:i',strtotime($convey['xq_time']));
  280. $confirm = $confirm?date('H:i',strtotime($confirm)):'';
  281. $data[] = [$convey['cate_title'],$start,$end,$xq,$send,$confirm,$status,$un];
  282. }else{ // 保洁,应急
  283. $data[] = [$v['create_time'],$dep,$v['content'],$status];
  284. }
  285. }
  286. }
  287. HelpHander::success(['data'=>$data,'header'=>$header]);
  288. }
  289. // 任务数据统计
  290. public function orderCountDate(){
  291. $type = input('type/d',1);
  292. if(!in_array($type,[1,2,3])){
  293. HelpHander::error('参数错误');
  294. }
  295. $y = [];
  296. $curDay = date('Y-m-d');
  297. $month = [];
  298. if($type == 1){ // 年统计
  299. $date = [];
  300. for ($i=11;$i>=0;$i--){
  301. $month[11-$i] = date('Ym',strtotime('-'.$i.'month'));
  302. $y[] = date('m',strtotime('-'.$i.'month'));
  303. }
  304. }else if($type == 2){ // 月统计
  305. $ms = Time::month();
  306. $start = $ms[0];
  307. $end = $ms[1] + 1;
  308. $i = 1;
  309. while (($start + $i*24*60*60) < $end){
  310. $date[] = date('Y-m-d',$start + $i*24*60*60);
  311. $i++;
  312. }
  313. }else{ // 日统计
  314. $date[] = '03';
  315. $date[] = '06';
  316. $date[] = '09';
  317. $date[] = '12';
  318. $date[] = '15';
  319. $date[] = '18';
  320. $date[] = '21';
  321. $date[] = '24';
  322. }
  323. $d1 = [];
  324. $d2 = [];
  325. $d = [];
  326. if($type != 1 ){
  327. foreach ($date as $k=>$v){
  328. $map = [];
  329. $map[] = ['org_id','=',$this->orgId];
  330. $map[] = ['del','=',0];
  331. if($type == 3){ // 日统计
  332. if($k == 0){
  333. $s = $curDay.' 00:00:00';
  334. }else{
  335. $s = $curDay.' '.$date[$k-1].':00:00';
  336. }
  337. $e = $curDay.' '.$v.':00:00';
  338. $map[] = ['create_time','egt',$s];
  339. $map[] = ['create_time','lt',$e];
  340. $d[] = (int)$v;
  341. }else if($type == 2){
  342. $map[] = ['create_yyyymmdd','=',date('Ymd',strtotime($v))];
  343. $d[] = date('m-d',strtotime($v));
  344. }
  345. $order = Db::name('orders')->where($map)->count();
  346. $todo = Db::name('todo')->where($map)->count();
  347. $d1[] = $todo;
  348. $d2[] = $order;
  349. }
  350. }else{
  351. foreach ($month as $k=>$v){
  352. $map = [];
  353. $map[] = ['org_id','=',$this->orgId];
  354. $map[] = ['del','=',0];
  355. $map[] = ['create_yyyymm','=',$v];
  356. $order = Db::name('orders')->where($map)->count();
  357. $todo = Db::name('todo')->where($map)->count();
  358. $d1[] = $todo;
  359. $d2[] = $order;
  360. }
  361. foreach ($y as $k=>$v){
  362. if($v < 10){
  363. $n = substr($v,1,1);
  364. }else{
  365. $n = $v;
  366. }
  367. $y[$k] = $n;
  368. }
  369. $d = $y;
  370. }
  371. HelpHander::success(['d'=>$d,'d1'=>$d1,'d2'=>$d2]);
  372. }
  373. //任务数据总览
  374. public function taskList2(){
  375. $mode = input('mode/d',1);
  376. if(!in_array($mode,[1,2,3,4,5])){
  377. HelpHander::error('参数错误');
  378. }
  379. $data = [];
  380. $header = ['状态', '类型', '始发地', '目的地', '需求时间', '执行人', '派工时间', '接收时间'];
  381. if($mode == 5){
  382. $header = ['状态', '订单号', '类型', '护工', '下单时间'];
  383. $lists = Db::name('ph_orders')
  384. ->where('org_id',$this->orgId)
  385. // ->where('status','in',[1,2])
  386. ->order('id desc')
  387. ->field('id,sn,cate_id,status,create_time')
  388. ->limit(30)
  389. ->select();
  390. foreach ($lists as $k=>$v){
  391. $cate = Db::name('cate')->where('id',$v['cate_id'])->value('title');
  392. $stxt = '新订单';
  393. $users = '';
  394. // if($v['status'] == 2){
  395. // $stxt = '服务中';
  396. // $unames = Db::name('ph_todo')
  397. // ->alias('t')
  398. // ->join('worker w','t.worker_id = w.id')
  399. // ->join('user u','u.id = w.user_id')
  400. // ->where('t.order_id',$v['id'])
  401. // ->where('t.status',1)
  402. // ->column('real_name');
  403. // $users = $unames?implode(',',$unames):'';
  404. // }
  405. $unames = Db::name('ph_todo')
  406. ->alias('t')
  407. ->join('worker w','t.worker_id = w.id')
  408. ->join('user u','u.id = w.user_id')
  409. ->where('t.order_id',$v['id'])
  410. // ->where('t.status',1)
  411. ->column('real_name');
  412. $users = $unames?implode(',',$unames):'';
  413. $data[$k]['status'] = $v['status'];
  414. $data[$k]['sn'] = $v['sn'];
  415. $data[$k]['cate'] = $cate;
  416. $data[$k]['users'] = $users;
  417. $data[$k]['create_time'] = $v['create_time'];
  418. // $data[] = [$stxt,$v['sn'],$cate,$users,$v['create_time']];
  419. }
  420. }else{
  421. if($mode == 1){
  422. $header = ['状态', '科室', '报修事项', '内容', '下单时间'];
  423. }else if($mode == 2||$mode == 4){
  424. $header = ['状态', '科室', '内容', '下单时间'];
  425. }
  426. $lists = Db::name('orders')
  427. ->where('org_id',$this->orgId)
  428. // ->where('order_mode','in',[1,4])
  429. ->where('work_type_mode',$mode)
  430. ->where('del',0)
  431. ->order('id desc')
  432. ->limit(30)
  433. ->field('id,order_mode,create_time,send_time,content,dep_id')
  434. ->select();
  435. foreach ($lists as $k=>$v){
  436. $dep = Db::name('dep')->where('id',$v['dep_id'])->value('title');
  437. if($mode == 1){ // 报修
  438. $type = Db::name('order_repair')
  439. ->alias('or')
  440. ->leftJoin('order_type ot','ot.id = or.type_id')
  441. ->where('or.order_id',$v['id'])
  442. ->value('title');
  443. $data[$k]['order_mode'] = $v['order_mode'];
  444. $data[$k]['dep'] = $dep;
  445. $data[$k]['type'] = $type?$type:'';
  446. $data[$k]['content'] = $v['content'];
  447. $data[$k]['create_time'] = $v['create_time'];
  448. // $data[] = [$status,$dep,$type?$type:'',$v['content'],$v['create_time']];
  449. }else if($mode == 3){ //运送
  450. $convey = Db::name('order_convey')
  451. ->alias('oc')
  452. ->join('convey_cate cc','cc.id = oc.type')
  453. ->where('oc.order_id',$v['id'])
  454. ->field('oc.*,cc.title as cate_title')
  455. ->find();
  456. $start = Db::name('address')->where('id',$convey['start'])->value('title');
  457. $end = Db::name('address')->where('id',$convey['end'])->value('title');
  458. $todos = Db::name('todo')
  459. ->alias('t')
  460. ->join('user u','u.id = t.to_user_id')
  461. ->where('t.order_id',$v['id'])
  462. ->where('t.del',0)
  463. ->where('t.todo_mode','in',[1,2,3])
  464. ->field('t.confirm_time,u.real_name')
  465. ->select();
  466. $todos = $todos?$todos:[];
  467. $unames = [];
  468. $confirm = '';
  469. foreach ($todos as $tk=>$tv){
  470. $unames[] = $tv['real_name'];
  471. if(!$confirm){
  472. $confirm = $tv['confirm_time'];
  473. }
  474. }
  475. $un = $unames?implode(',',$unames):'';
  476. $send = $v['send_time']?date('H:i',strtotime($v['send_time'])):'';
  477. $xq = date('H:i',strtotime($convey['xq_time']));
  478. $confirm = $confirm?date('H:i',strtotime($confirm)):'';
  479. $data[$k]['order_mode'] = $v['order_mode'];
  480. $data[$k]['cate_title'] = $convey['cate_title'];
  481. $data[$k]['start'] = $start;
  482. $data[$k]['end'] = $end;
  483. $data[$k]['xq'] = $xq;
  484. $data[$k]['un'] = $un;
  485. $data[$k]['send'] = $send;
  486. $data[$k]['confirm'] = $confirm;
  487. // $data[] = [$status,$convey['cate_title'],$start,$end,$xq,$un,$send,$confirm];
  488. }else{ // 保洁,应急
  489. // $data[] = [$status,$dep,$v['content'],$v['create_time']];
  490. $data[$k]['order_mode'] = $v['order_mode'];
  491. $data[$k]['dep'] = $dep;
  492. $data[$k]['content'] = $v['content'];
  493. $data[$k]['create_time'] = $v['create_time'];
  494. }
  495. }
  496. }
  497. $slist = [];
  498. if($mode == 5){
  499. foreach ($data as $k=>$v){
  500. if($v['status'] == 0){
  501. $slist[$k][] = '<span style="color:#FFDA0A;">新订单</span>';
  502. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['sn'].'</span>';
  503. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['cate'].'</span>';
  504. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['users'].'</span>';
  505. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['create_time'].'</span>';
  506. }else if($v['status'] == 1){
  507. $slist[$k][] = '<span style="color:#0FC2DD;">进行中</span>';
  508. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['sn'].'</span>';
  509. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['cate'].'</span>';
  510. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['users'].'</span>';
  511. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['create_time'].'</span>';
  512. }else{
  513. $status = '';
  514. if($v['status'] == 2){
  515. $status = '已完成';
  516. }elseif($v['status'] == 3){
  517. $status = '已作废';
  518. }elseif($v['status'] == 4){
  519. $status = '已结算';
  520. }
  521. $slist[$k][] = $status;
  522. $slist[$k][] = $v['sn'];
  523. $slist[$k][] = $v['cate'];
  524. $slist[$k][] = $v['users'];
  525. $slist[$k][] = $v['create_time'];
  526. }
  527. }
  528. }elseif ($mode == 1){
  529. foreach ($data as $k=>$v){
  530. $status = Db::name('order_mode')->where('id',$v['order_mode'])->value('out_content');
  531. if($v['order_mode'] == 1){
  532. $slist[$k][] = '<span style="color:#FFDA0A;">新订单</span>';
  533. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['dep'].'</span>';
  534. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['type'].'</span>';
  535. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['content'].'</span>';
  536. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['create_time'].'</span>';
  537. }else if($v['order_mode'] == 4){
  538. $slist[$k][] = '<span style="color:#0FC2DD;">进行中</span>';
  539. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['dep'].'</span>';
  540. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['type'].'</span>';
  541. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['content'].'</span>';
  542. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['create_time'].'</span>';
  543. }else{
  544. $slist[$k][] = $status;
  545. $slist[$k][] = $v['dep'];
  546. $slist[$k][] = $v['type'];
  547. $slist[$k][] = $v['content'];
  548. $slist[$k][] = $v['create_time'];
  549. }
  550. }
  551. }elseif ($mode == 2 || $mode == 4){
  552. foreach ($data as $k=>$v){
  553. $status = Db::name('order_mode')->where('id',$v['order_mode'])->value('out_content');
  554. if($v['order_mode'] == 1){
  555. $slist[$k][] = '<span style="color:#FFDA0A;">新订单</span>';
  556. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['dep'].'</span>';
  557. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['content'].'</span>';
  558. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['create_time'].'</span>';
  559. }else if($v['order_mode'] == 4){
  560. $slist[$k][] = '<span style="color:#0FC2DD;">进行中</span>';
  561. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['dep'].'</span>';
  562. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['content'].'</span>';
  563. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['create_time'].'</span>';
  564. }else{
  565. $slist[$k][] = $status;
  566. $slist[$k][] = $v['dep'];
  567. $slist[$k][] = $v['content'];
  568. $slist[$k][] = $v['create_time'];
  569. }
  570. }
  571. }elseif ($mode == 3){
  572. foreach ($data as $k=>$v){
  573. $status = Db::name('order_mode')->where('id',$v['order_mode'])->value('out_content');
  574. if($v['order_mode'] == 1){
  575. $slist[$k][] = '<span style="color:#FFDA0A;">新订单</span>';
  576. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['cate_title'].'</span>';
  577. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['start'].'</span>';
  578. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['end'].'</span>';
  579. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['xq'].'</span>';
  580. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['un'].'</span>';
  581. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['send'].'</span>';
  582. $slist[$k][] = '<span style="color:#FFDA0A;">'.$v['confirm'].'</span>';
  583. }else if($v['order_mode'] == 4){
  584. $slist[$k][] = '<span style="color:#0FC2DD;">进行中</span>';
  585. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['cate_title'].'</span>';
  586. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['start'].'</span>';
  587. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['end'].'</span>';
  588. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['xq'].'</span>';
  589. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['un'].'</span>';
  590. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['send'].'</span>';
  591. $slist[$k][] = '<span style="color:#0FC2DD;">'.$v['confirm'].'</span>';
  592. }else{
  593. $slist[$k][] = $status;
  594. $slist[$k][] = $v['cate_title'];
  595. $slist[$k][] = $v['start'];
  596. $slist[$k][] = $v['end'];
  597. $slist[$k][] = $v['xq'];
  598. $slist[$k][] = $v['un'];
  599. $slist[$k][] = $v['send'];
  600. $slist[$k][] = $v['confirm'];
  601. }
  602. }
  603. }
  604. HelpHander::success(['data'=>$slist,'header'=>$header]);
  605. }
  606. }