InvoiceController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace addons\TinyShop\merchant\modules\order\controllers;
  3. use common\enums\AuditStatusEnum;
  4. use Yii;
  5. use addons\TinyShop\common\models\order\Invoice;
  6. use common\traits\MerchantCurd;
  7. use common\enums\StatusEnum;
  8. use common\models\base\SearchModel;
  9. use addons\TinyShop\merchant\controllers\BaseController;
  10. /**
  11. * Class InvoiceController
  12. * @package addons\TinyShop\merchant\modules\order\controllers
  13. * @author jianyan74 <751393839@qq.com>
  14. */
  15. class InvoiceController extends BaseController
  16. {
  17. use MerchantCurd;
  18. /**
  19. * @var string
  20. */
  21. public $modelClass = Invoice::class;
  22. /**
  23. * 首页
  24. *
  25. * @return string
  26. * @throws \yii\web\NotFoundHttpException
  27. */
  28. public function actionIndex()
  29. {
  30. $auditStatus = Yii::$app->request->get('audit_status', AuditStatusEnum::DISABLED);
  31. $searchModel = new SearchModel([
  32. 'model' => $this->modelClass,
  33. 'scenario' => 'default',
  34. 'partialMatchAttributes' => ['order_sn'], // 模糊查询
  35. 'defaultOrder' => [
  36. 'id' => SORT_DESC,
  37. ],
  38. 'pageSize' => $this->pageSize,
  39. ]);
  40. $dataProvider = $searchModel
  41. ->search(Yii::$app->request->queryParams);
  42. $dataProvider->query
  43. ->andWhere(['>=', 'status', StatusEnum::DISABLED])
  44. ->andWhere(['audit_status' => $auditStatus])
  45. ->andFilterWhere(['merchant_id' => $this->getMerchantId()])
  46. ->with(['order']);
  47. return $this->render($this->action->id, [
  48. 'dataProvider' => $dataProvider,
  49. 'searchModel' => $searchModel,
  50. 'auditStatus' => $auditStatus,
  51. ]);
  52. }
  53. }
粤ICP备19079148号