From 773719d5b230a4c9d54e3a658cbb8f0dc9847d7f Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Fri, 6 Dec 2019 19:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=BF=90=E8=B4=B9=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E8=A7=86=E5=9B=BE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/ExpressTemplateController.php | 24 +++++++++ .../express-template/express_area_view.php | 51 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 backend/modules/shop/views/express-template/express_area_view.php diff --git a/backend/modules/shop/controllers/ExpressTemplateController.php b/backend/modules/shop/controllers/ExpressTemplateController.php index 488385f..6f29c2b 100755 --- a/backend/modules/shop/controllers/ExpressTemplateController.php +++ b/backend/modules/shop/controllers/ExpressTemplateController.php @@ -332,6 +332,15 @@ class ExpressTemplateController extends Controller $cityIds = array_keys(Yii::$app->request->post('area')); $data['city'] = implode(',', $cityIds); $model->load($data, ''); + $model->basic_price *= 100; + $model->extra_price *= 100; + if ($expressTemplateModel->calculation_type == ExpressTemplate::CALCULATION_TYPE_WEIGHT) { + $model->basic_count *= 10; + $model->extra_count *= 10; + } else { + $model->basic_count *= 1; + $model->extra_count *= 1; + } $model->save(); return $this->redirect('express-area-list?id='.$model->express_template); } @@ -364,4 +373,19 @@ class ExpressTemplateController extends Controller 'model' => $model, 'data' => $data, 'cities' => explode(',', $model->city), 'expressTemplateModel' => $expressTemplateModel ]); } + + /** + * @param $id + * @return string + * 运费区域模板区域查看方法 + */ + public function actionExpressAreaView($id) + { + $expressTemplateId = Yii::$app->request->get('expressTemplateId'); + $expressTemplateModel = ExpressTemplate::findOne($expressTemplateId); + return $this->render('express_area_view', [ + 'model' => ExpressArea::findOne($id), + 'expressTemplateModel' => $expressTemplateModel + ]); + } } diff --git a/backend/modules/shop/views/express-template/express_area_view.php b/backend/modules/shop/views/express-template/express_area_view.php new file mode 100755 index 0000000..f2d6f8a --- /dev/null +++ b/backend/modules/shop/views/express-template/express_area_view.php @@ -0,0 +1,51 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-success']) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + [ + 'attribute' => 'calculation_type', + 'value' => function ($model) { + return ExpressTemplate::$calculationType[$model->calculation_type]; + } + ], + 'basic_price', + 'basic_count', + 'extra_price', + 'extra_count', + 'updated_at:datetime', + 'created_at:datetime', + ['attribute' => 'city', + 'value' => function ($model) { + $array = explode(',', $model->city); + $cities = []; + foreach (\backend\modules\shop\models\ars\City::find()->andWhere(['in', 'city_id', $array])->all() as $city) { + $cities[] = $city->name; + } + return implode(' // ', $cities); + }, + ], + ], + ]) ?> + +