From 22fdde5a14141aaea674d78fad4bd7e9b47bfaec Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Mon, 2 Dec 2019 19:58:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BATakingSite=E8=A1=A8=E7=9A=84c?= =?UTF-8?q?url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/TakingSiteController.php | 149 +++++++++++++++++++ backend/views/layouts/sidebar.php | 6 +- backend/views/taking-site/_form.php | 34 +++++ backend/views/taking-site/_search.php | 49 ++++++ backend/views/taking-site/create.php | 18 +++ backend/views/taking-site/index.php | 28 ++++ backend/views/taking-site/update.php | 19 +++ backend/views/taking-site/view.php | 35 +++++ common/models/searchs/TakingSiteSearch.php | 149 +++++++++++++++++++ 9 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 backend/controllers/TakingSiteController.php create mode 100644 backend/views/taking-site/_form.php create mode 100644 backend/views/taking-site/_search.php create mode 100644 backend/views/taking-site/create.php create mode 100644 backend/views/taking-site/index.php create mode 100644 backend/views/taking-site/update.php create mode 100644 backend/views/taking-site/view.php create mode 100644 common/models/searchs/TakingSiteSearch.php diff --git a/backend/controllers/TakingSiteController.php b/backend/controllers/TakingSiteController.php new file mode 100644 index 0000000..01ef5d7 --- /dev/null +++ b/backend/controllers/TakingSiteController.php @@ -0,0 +1,149 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all TakingSite models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new TakingSiteSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'columns' => $searchModel->columns() + ]); + } + + /** + * Displays a single TakingSite model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new TakingSite model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new TakingSite(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing TakingSite model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect('index'); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing TakingSite model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the TakingSite model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return TakingSite the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = TakingSite::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + /** + * @author iron + * 文件导出 + */ + public function actionExport() + { + $searchModel = new TakingSiteSearch(); + $params = Yii::$app->request->queryParams; + if ($params['page-type'] == 'all') { + $dataProvider = $searchModel->allData($params); + } else { + $dataProvider = $searchModel->search($params); + } + \iron\widget\Excel::export([ + 'models' => $dataProvider->getModels(), + 'format' => 'Xlsx', + 'asAttachment' => true, + 'fileName' =>'Taking Sites'. "-" .date('Y-m-d H/i/s', time()), + 'columns' => $searchModel->columns() + ]); + } +} diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php index 93ec000..d2215e9 100755 --- a/backend/views/layouts/sidebar.php +++ b/backend/views/layouts/sidebar.php @@ -20,7 +20,7 @@ use iron\widgets\Menu; ['label' => '基础配置', 'url' => ['config/index', 'tag' => 'new']], ] ], - ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [ + ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-box', 'items' => [ ['label' => '后台商品分类', 'url' => ['/antgoods/category/index']], ['label' => '规格管理', 'url' => ['/antgoods/attribute/index']], ['label' => '前端商品分类', 'url' => ['/antgoods/shop-category/index']], @@ -31,6 +31,10 @@ use iron\widgets\Menu; ], ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ ['label' => '订单列表', 'url' => ['/order/index', 'tag' => 'new']], + ], + ], + ['label' => '配送服务', 'url' => '#', 'icon' => 'far fa-shipping-fast', 'items' => [ + ['label' => '上门自提', 'url' => ['/taking-site/index']], ] ], diff --git a/backend/views/taking-site/_form.php b/backend/views/taking-site/_form.php new file mode 100644 index 0000000..c115e02 --- /dev/null +++ b/backend/views/taking-site/_form.php @@ -0,0 +1,34 @@ + + +
+ = Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?> +
+ + = DetailView::widget([ + 'model' => $model, + 'attributes' => [ + 'id', + 'name', + 'province', + 'city', + 'area', + 'address:ntext', + 'is_default', + 'updated_at', + 'created_at', + ], + ]) ?> + +