Order.php 27 KB

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