Manage.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. # 获取订单信息
  11. public function info($type = 'in', $id)
  12. {
  13. Dever::load('manage/auth.init');
  14. $info = Dever::db('scm_servicer/'.$type.'_order')->find($id);
  15. $string = '';
  16. $string = $info['order_num'];
  17. $servicer = Dever::db('scm_servicer/info')->one($info['servicer_id']);
  18. $string .= '<br />' . $servicer['name'];
  19. $store = Dever::db('scm_servicer/store')->one($info['servicer_store_id']);
  20. $string .= '.' . $store['name'];
  21. if (isset($info['supplier_id'])) {
  22. $supplier = Dever::db('scm_supplier/info')->one($info['supplier_id']);
  23. $string .= '<br />' . $supplier['name'];
  24. }
  25. $type = Dever::db('scm_servicer/'.$type.'_order_type')->one($info['type']);
  26. $string .= '<br />' . $type['name'];
  27. $string .= '<br />' . $info['info'];
  28. return $string;
  29. }
  30. # 查看详情
  31. public function show()
  32. {
  33. $type = Dever::input('type');
  34. return Dever::load('scm/lib/order')->show('scm_servicer/'.$type.'_order', 'scm_servicer/info', 'servicer_id', '配送商');
  35. }
  36. public function getStore($id)
  37. {
  38. $table = array();
  39. $table['head'] = array('仓库名称', '仓库编码', '操作');
  40. $table['body'] = array();
  41. $data = Dever::db('scm_servicer/store')->select(array('servicer_id' => $id));
  42. if ($data) {
  43. $status = Dever::db('scm_servicer/store')->config['status'];
  44. foreach ($data as $k => $v) {
  45. $status_name = '';
  46. if ($v['status'] == 2) {
  47. $status_name = '(已禁用)';
  48. }
  49. $oper = '<a class="layui-btn" href="'.Dever::url('lib/set.home?role=servicer/store&id=' . $v['id'], 'scm_product').'">库存清单</a>';
  50. $table['body'][$k][] = $v['name'] . $status_name;
  51. $table['body'][$k][] = $v['code'];
  52. $table['body'][$k][] = $oper;
  53. }
  54. }
  55. $body[''] = array
  56. (
  57. 'type' => 'table',
  58. 'content' => $table,
  59. );
  60. if ($table['body']) {
  61. return Dever::show('', $body);
  62. } else {
  63. return '暂无';
  64. }
  65. }
  66. }