CrystalCash.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\order\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 元石提现管理
  7. * Class CrystalCash
  8. * @package app\order\controller
  9. */
  10. class CrystalCash extends Controller
  11. {
  12. protected $table = 'CrystalOrder';
  13. /**
  14. * 充值订单
  15. * @auth true
  16. * @menu true
  17. */
  18. public function index()
  19. {
  20. $this->title = '充值订单';
  21. $this->order_status = ['待支付','已支付'];
  22. $query = $this->_query($this->table);
  23. $where = [];
  24. if($this->request->request('tel'))$where[]= ['u.phone','like','%'.$this->request->request('tel').'%'];
  25. if($this->request->request('user_name'))$where[]= ['u.name','like','%'.$this->request->request('user_name').'%'];
  26. if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.$this->request->request('order_no').'%'];
  27. if($this->request->request('order_status') > -1) $where[]= ['o.status','=',$this->request->request('order_status')];
  28. $query->alias('o')
  29. ->field('o.* , u.name as user_name ,u.phone')
  30. ->join('store_member u',' o.uid = u.id ','LEFT');
  31. if(!empty($where)) $query->where($where);
  32. $query ->order('o.id desc')->page();
  33. }
  34. /**
  35. * 订单详情
  36. * @auth true
  37. * @menu true
  38. */
  39. public function detail()
  40. {
  41. $this->title = '订单详情';
  42. $order_id = input('id');
  43. $detail = Db::table('crystal_order o')
  44. ->field('o.* , u.name as user_name ,u.phone')
  45. ->join('store_member u',' o.uid = u.id ','LEFT')
  46. ->where('o.id',$order_id)
  47. ->find();
  48. $this->assign('detail',$detail);
  49. $this->fetch('detail');
  50. }
  51. /**
  52. * 表单数据处理
  53. * @auth true
  54. * @menu true
  55. * @param array $data
  56. */
  57. protected function _form_filter(&$data)
  58. {
  59. if ($this->request->isPost() && $this->request->action() == 'deliver') {
  60. $express_company = Db::table('store_express_company')->field('id,express_title')->find($data['express_company_id']);
  61. $data['express_company_title'] = $express_company['express_title'] ? $express_company['express_title'] : '';
  62. $data['express_send_at'] = date("Y-m-d H:i:s");
  63. $data['express_state'] = 1;
  64. }
  65. }
  66. }