diff --git a/backend/modules/shop/views/express-template/express_area_view.php b/backend/modules/shop/views/express-template/express_area_view.php index f2d6f8a..31d353e 100755 --- a/backend/modules/shop/views/express-template/express_area_view.php +++ b/backend/modules/shop/views/express-template/express_area_view.php @@ -1,5 +1,8 @@ title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; +$this->title = $model->id; +$this->params['breadcrumbs'][] = ['label' => '运费模板', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => '运费区域模板:'.$expressTemplateModel->name, 'url' => ['express-area-list?id='.$expressTemplateModel->id]]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); ?>

- 'btn btn-success']) ?> + id], ['class' => 'btn btn-success']) ?>

$model, 'attributes' => [ 'id', - 'name', [ - 'attribute' => 'calculation_type', + 'attribute' => 'basic_count', + 'label' => ExpressArea::$formList[$expressTemplateModel->calculation_type]['basic_count'], 'value' => function ($model) { - return ExpressTemplate::$calculationType[$model->calculation_type]; + $expressTemplateModel = ExpressTemplate::findOne($model->express_template); + if ($expressTemplateModel->calculation_type == ExpressTemplate::CALCULATION_TYPE_WEIGHT) { + return $model->basic_count /= 10; + } else { + return $model->basic_count; + } + } + ], + [ + 'attribute' => 'basic_price', + 'label' => ExpressArea::$formList[$expressTemplateModel->calculation_type]['basic_price'], + 'value' => function ($model) { + return $model->basic_price /= 100; + } + ], + [ + 'attribute' => 'extra_count', + 'label' => ExpressArea::$formList[$expressTemplateModel->calculation_type]['extra_count'], + 'value' => function ($model) { + $expressTemplateModel = ExpressTemplate::findOne($model->express_template); + if ($expressTemplateModel->calculation_type == ExpressTemplate::CALCULATION_TYPE_WEIGHT) { + return $model->extra_count /= 10; + } else { + return $model->extra_count; + } + } + ], + [ + 'attribute' => 'extra_price', + 'label' => ExpressArea::$formList[$expressTemplateModel->calculation_type]['extra_price'], + 'value' => function ($model) { + return $model->extra_price /= 100; } ], - 'basic_price', - 'basic_count', - 'extra_price', - 'extra_count', 'updated_at:datetime', 'created_at:datetime', ['attribute' => 'city', 'value' => function ($model) { - $array = explode(',', $model->city); + $expressAreas = ExpressArea::findOne($model->id); + $expressAresCityIdArr = explode(',', $expressAreas->city); $cities = []; - foreach (\backend\modules\shop\models\ars\City::find()->andWhere(['in', 'city_id', $array])->all() as $city) { - $cities[] = $city->name; + $provinces = Province::find()->cache(0)->all(); + foreach ($provinces as $k => $v) { + $cityId = City::find() + ->select(['city_id']) + ->where(['province_id' => $v->province_id]) + ->column(); + if (empty(array_diff($cityId, $expressAresCityIdArr))) { + $cities[] = $v->name; + }else{ + foreach (\backend\modules\shop\models\ars\City::find()->andWhere(['in', 'city_id', array_diff($cityId, array_diff($cityId, $expressAresCityIdArr))])->all() as $city) { + $cities[] = $city->name; + } + } } - return implode(' // ', $cities); + return implode(' , ', $cities); }, ], ],