LevelOrder.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\order\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 会员订单管理
  7. * Class LevelOrder
  8. * @package app\order\controller
  9. */
  10. class LevelOrder extends Controller
  11. {
  12. protected $table = 'LevelOrder';
  13. /**
  14. * 订单列表
  15. * @auth true
  16. * @menu true
  17. * @throws \think\Exception
  18. * @throws \think\db\exception\DataNotFoundException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. * @throws \think\exception\DbException
  21. * @throws \think\exception\PDOExceptio
  22. */
  23. public function index()
  24. {
  25. $this->title = '订单管理';
  26. $query = $this->_query($this->table);
  27. $where = [];
  28. $where[] = ['o.is_deleted','=',0];
  29. $where[] = ['o.cancel_state','=',0];
  30. $where[] = ['o.pay_state','=',1];
  31. if($this->request->request('tel'))$where[]= ['u.phone','like','%'.$this->request->request('tel').'%'];
  32. if($this->request->request('user_name'))$where[]= ['u.name','like','%'.$this->request->request('user_name').'%'];
  33. if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.$this->request->request('order_no').'%'];
  34. $query->alias('o')
  35. ->field('o.* , u.name u_name ,u.phone u_phone,l.name level_name')
  36. ->join('store_member u',' o.user_id = u.id ','LEFT')
  37. ->leftJoin('user_level l',' o.level_id = l.id ');
  38. if(!empty($where)) $query->where($where);
  39. $query ->order('o.id desc')->page();
  40. }
  41. /**
  42. * 表单数据处理
  43. * @auth true
  44. * @menu true
  45. * @param array $data
  46. */
  47. protected function _form_filter(&$data)
  48. {
  49. }
  50. /**
  51. * 删除
  52. * @auth true
  53. * @menu true
  54. * @throws \think\Exception
  55. * @throws \think\db\exception\DataNotFoundException
  56. * @throws \think\db\exception\ModelNotFoundException
  57. * @throws \think\exception\DbException
  58. * @throws \think\exception\PDOException
  59. */
  60. public function remove()
  61. {
  62. $this->_save($this->table, ['is_deleted' =>1]);
  63. }
  64. }