title = '预约管理'; $query = $this->_query($this->table); $this->order_status = [0=>'预约中',1=>'已完成',9=>'已取消']; $where = []; $where[] = ['o.is_deleted','=',0]; if($this->request->request('phone'))$where[]= ['u.phone','like','%'.$this->request->request('phone').'%']; if($this->request->request('user_name'))$where[]= ['u.name','like','%'.$this->request->request('user_name').'%']; if($this->request->request('order_no')) $where[]= ['o.order_no','like','%'.$this->request->request('order_no').'%']; if($this->request->request('code')) $where[]= ['o.code','like','%'.$this->request->request('code').'%']; if($this->request->request('order_status',-1) >= 0) $where[]= ['o.status','=',$this->request->request('order_status')]; $query->alias('o') ->field('o.* , u.name u_name ,u.phone u_phone,u.headimg,g.name goods_name,g.cover goods_cover,m.goods_spec') ->join('store_member u',' o.user_id = u.id ','LEFT') ->join('store_goods g',' o.goods_id = g.id ','LEFT') ->join('store_goods_item m','o.spec_id = m.id ','LEFT'); if(!empty($where)) $query->where($where); $query ->order('o.id desc')->page(); } /** * 订单完成 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function complete() { if($this->request->isPost()) { $check_status = \app\common\model\WashOrder::where('id',input('post.id'))->value('status'); if($check_status != 0) $this->error('订单状态有误'); } $this->_save($this->table, ['status' => 1]); } /** * 订单详情 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function detail() { $this->title = '订单详情'; $this->_form($this->table); } /** * 删除 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function remove() { $this->_save($this->table, ['is_deleted' => '1']); } /** * 表单数据处理 * @auth true * @menu true * @param array $data */ protected function _form_filter(&$data) { } }