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.

64 lines
1.8 KiB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\DetailView;
  4. use antgoods\models\ars\ShopCategory;
  5. use antgoods\models\ars\Attribute;
  6. /* @var $this yii\web\View */
  7. /* @var $model antgoods\models\ars\ShopCategory */
  8. $this->title = $model->name;
  9. $this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']];
  10. $this->params['breadcrumbs'][] = $this->title;
  11. \yii\web\YiiAsset::register($this);
  12. $filter_attr_arr = explode(',', $model->filter_attr);
  13. $attr_str = '';
  14. foreach ($filter_attr_arr as $filter_attr_id) {
  15. $attr = Attribute::findOne($filter_attr_id);
  16. if ($attr) {
  17. $attr_str = $attr_str . ',' . $attr->name;
  18. }
  19. }
  20. $attr_str = substr($attr_str, 1);
  21. ?>
  22. <div class="shop-category-view">
  23. <p>
  24. <?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
  25. </p>
  26. <?= DetailView::widget([
  27. 'model' => $model,
  28. 'attributes' => [
  29. 'id',
  30. 'name',
  31. 'keywords',
  32. 'desc',
  33. 'sort_order',
  34. ['attribute' => 'icon',
  35. 'width'=>'10%',
  36. 'format' => 'raw',
  37. 'value' => function ($model) {
  38. return $model->iconFile ?
  39. \yii\bootstrap4\Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px'])
  40. : '未设置';
  41. }
  42. ],
  43. ['attribute' => 'filter_attr',
  44. 'value' => $attr_str
  45. ],
  46. ['attribute' => 'is_show',
  47. 'width' => '5%',
  48. 'value' =>
  49. function ($model) {
  50. return $model->is_show == ShopCategory::IS_SHOW_HIDE ? '隐藏' : '显示';
  51. },
  52. ],
  53. 'created_at:datetime',
  54. 'updated_at:datetime',
  55. ],
  56. ]) ?>
  57. </div>