You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\DetailView;
  4. use backend\modules\shop\models\ars\ExpressTemplate;
  5. /* @var $this yii\web\View */
  6. /* @var $model backend\modules\shop\models\ars\ExpressTemplate */
  7. $this->title = $model->name;
  8. $this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']];
  9. $this->params['breadcrumbs'][] = $this->title;
  10. \yii\web\YiiAsset::register($this);
  11. ?>
  12. <div class="express-template-view">
  13. <p>
  14. <?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
  15. </p>
  16. <?= DetailView::widget([
  17. 'model' => $model,
  18. 'attributes' => [
  19. 'id',
  20. 'name',
  21. [
  22. 'attribute' => 'calculation',
  23. 'value' => function ($model) {
  24. return ExpressTemplate::$calculation[$model->calculation];
  25. }
  26. ],
  27. 'basic_price',
  28. 'basic_amount',
  29. 'extra_price',
  30. 'extra_amount',
  31. 'updated_at:datetime',
  32. 'created_at:datetime',
  33. ['attribute' => 'city',
  34. 'value' => function ($model) {
  35. $array = explode(',', $model->city);
  36. $cities = [];
  37. foreach (\backend\modules\shop\models\ars\City::find()->andWhere(['in', 'city_id', $array])->all() as $city) {
  38. $cities[] = $city->name;
  39. }
  40. return implode(' // ', $cities);
  41. },
  42. ],
  43. ],
  44. ]) ?>
  45. </div>