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.
 
 
 

113 lines
3.5 KiB

<?php
use antgoods\models\ars\Goods;
use yii\bootstrap4\Html;
use yii\widgets\DetailView;
use common\models\ars\File;
/* @var $this yii\web\View */
/* @var $model antgoods\models\ars\Goods */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="goods-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'sn',
[
'attribute' => 'cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->category ? $model->category->name : '';
},
],
[
'attribute' => 'shop_cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->shopCategory ? $model->shopCategory->name : '';
},
],
[
'attribute' => 'brand_id',
'width' => '10%',
'value' => function ($model) {
return $model->brand ? $model->brand->name : '';
},
],
'code',
[
'attribute' => 'supplier_id',
'width' => '10%',
'value' => function ($model) {
return $model->supplier ? $model->supplier->name : '';
},
],
'weight',
'length',
'width',
'height',
'diameter',
'unit',
[
'attribute' => 'stock',
'width' => '5%',
'value' => function ($model) {
if ($model->stock == -1) {
return '未开启';
} else {
return $model->stock;
}
},
],
'market_price',
'price',
'brief',
['attribute' => 'image',
'format' => 'raw',
'value' => function ($model) {
return $model->image ?
Html::img(['/'.$model->imageFile->path], ['style' => 'width:80px'])
: '<div class="table_not_setting">未设置</div>';
}
],
[
'label' => '详情图',
'format' => 'raw',
'value' => function ($model) {
$image = '';
$imgs = File::findAll(['own_id' => $model->id, 'own_type' => File::OWN_TYPE_GOODS_DETAILS, 'is_delete' => File::IS_DELETE_NO]);
foreach ($imgs as $img) {
$image .= Html::img(['/'.$img->path], ['style' => 'width:150px']);
}
return $image;
}
],
['attribute' => 'is_sale',
'width' => '5%',
'value' =>
function ($model) {
return $model->is_sale ? Goods::$isSale[$model->is_sale] : '未设置';
},
],
'sort_order',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>