view.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. use common\models\Goods;
  3. use slavkovrn\lightbox\LightBoxWidget;
  4. use yii\data\ActiveDataProvider;
  5. use yii\grid\GridView;
  6. use yii\helpers\Html;
  7. use yii\helpers\Url;
  8. use yii\widgets\DetailView;
  9. /* @var $this yii\web\View */
  10. /* @var $model common\models\Goods */
  11. /* @var $goodsSkuProvider ActiveDataProvider */
  12. /* @var $goodsAttrProvider ActiveDataProvider */
  13. $this->title = $model->name;
  14. $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Goods'), 'url' => ['index']];
  15. $this->params['breadcrumbs'][] = $this->title;
  16. ?>
  17. <p>
  18. <?= Html::a(Yii::t('common', '更新商品'), ['update', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
  19. <?= Html::a(Yii::t('common', '删除商品'), ['delete', 'id' => $model->id], [
  20. 'class' => 'btn btn-danger',
  21. 'data' => [
  22. 'confirm' => Yii::t('common', 'Are you sure you want to delete this item?'),
  23. 'method' => 'post',
  24. ],
  25. ]) ?>
  26. </p>
  27. <div class="box box-success">
  28. <div class="box-body">
  29. <?= DetailView::widget([
  30. 'model' => $model,
  31. 'attributes' => [
  32. 'id',
  33. 'cat.title:text:分类',
  34. 'store.name:text:商家',
  35. 'name',
  36. 'desc',
  37. 'origin_price',
  38. 'price',
  39. 'actual_sales',
  40. 'virtual_sales',
  41. 'actual_views',
  42. 'virtual_views',
  43. 'stock',
  44. [
  45. 'attribute' => 'cover',
  46. 'format' => ['image'],
  47. 'contentOptions' => ['class' => 'media-content']
  48. ],
  49. // [
  50. // 'attribute' => 'banner',
  51. // 'format' => ['images'],
  52. // 'contentOptions' => ['class' => 'media-content']
  53. // ],
  54. [
  55. 'attribute' => 'picture',
  56. 'format' => ['images'],
  57. 'contentOptions' => ['class' => 'media-content']
  58. ],
  59. 'created_at:datetime',
  60. 'updated_at:datetime',
  61. [
  62. 'attribute' => 'status',
  63. 'value' => Goods::getStatusList($model->status),
  64. ],
  65. ],
  66. ]) ?>
  67. </div>
  68. </div>
  69. <?php
  70. $js = <<<JS
  71. //layer相册
  72. layer.ready(function () {
  73. layer.photos({
  74. photos: '.media-content',
  75. shift: 5
  76. });
  77. });
  78. JS;
  79. $this->registerJs($js);
  80. ?>