Manage.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace Scm_servicer\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. public function __construct()
  7. {
  8. Dever::load('manage/auth.init');
  9. }
  10. public function getStore($id)
  11. {
  12. $table = array();
  13. $table['head'] = array('仓库名称', '仓库编码', '操作');
  14. $table['body'] = array();
  15. $data = Dever::db('scm_servicer/store')->select(array('servicer_id' => $id));
  16. if ($data) {
  17. $status = Dever::db('scm_servicer/store')->config['status'];
  18. foreach ($data as $k => $v) {
  19. $status_name = '';
  20. if ($v['status'] == 2) {
  21. $status_name = '(已禁用)';
  22. }
  23. $oper = '<a class="layui-btn" href="'.Dever::url('lib/set.home?role=servicer/store&id=' . $v['id'], 'scm_product').'">仓库明细</a>';
  24. $table['body'][$k][] = $v['name'] . $status_name;
  25. $table['body'][$k][] = $v['code'];
  26. $table['body'][$k][] = $oper;
  27. }
  28. }
  29. $body[''] = array
  30. (
  31. 'type' => 'table',
  32. 'content' => $table,
  33. );
  34. if ($table['body']) {
  35. return Dever::show('', $body);
  36. } else {
  37. return '暂无';
  38. }
  39. }
  40. public function getGoods($id)
  41. {
  42. $table = array();
  43. $table['head'] = array('名称', '单价', '数量', '状态');
  44. $table['body'] = array();
  45. $data = Dever::db('scm_servicer/in_order_goods')->select(array('order_id' => $id));
  46. if ($data) {
  47. $status = Dever::db('scm_servicer/in_order_goods')->config['status'];
  48. foreach ($data as $k => $v) {
  49. $status_name = Dever::status($status, $v['status']);
  50. $table['body'][$k][] = $v['goods'];
  51. $table['body'][$k][] = $v['cash'];
  52. $table['body'][$k][] = $v['num'];
  53. $table['body'][$k][] = $status_name;
  54. }
  55. }
  56. $body[''] = array
  57. (
  58. 'type' => 'table',
  59. 'content' => $table,
  60. );
  61. if ($table['body']) {
  62. return Dever::show('', $body);
  63. } else {
  64. return '暂无';
  65. }
  66. }
  67. }