'起始日期', 'date_to' => '结束日期', ]); } public function search($queryParams) { $query = self::find()->select(['a.*', 'b.supplier_name'])->joinWith('baseSupplier b')->from('order_invoice_info a'); $query->andFilterWhere(['<>', 'a.Status', '1']); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => false, 'pagination' => [ 'pageSize' => 20, ] ]); $this->load($queryParams); if (!empty($this->InvoiceType)) { $query->andFilterWhere(['InvoiceType' => $this->InvoiceType]); } if (!empty($this->date_from) && !empty($this->date_to)) { $query->andFilterWhere(['between', 'a.CreateTime', $this->date_from, $this->date_to]); } if (!empty($this->PostType)) { $query->andFilterWhere(['PostType' => $this->PostType]); } if (!empty($this->Status)) { $query->andFilterWhere(['a.Status' => $this->Status]); } if (!empty($this->ChannelId)) { $query->andFilterWhere(['a.ChannelId' => $this->ChannelId]); } if (!empty(trim($this->search_key))) { $query->andFilterWhere(['or', ['like', 'a.OrderID', trim($this->search_key)], ['like', 'a.ReceiverName', trim($this->search_key)], ['like', 'a.ReceiverMobile', trim($this->search_key)], ['like', 'a.InvoiceTitle', trim($this->search_key)]]); } $query -> orderBy(['a.Status' => SORT_ASC,'a.UpdateTime' => SORT_DESC]); return $dataProvider; } }