Browse Source

修改前端商品分类详情页面筛选字段显示问题,修改品牌管理列表和供应商列表字段样式

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
b58a8d65af
  1. 6
      vendor/antgoods/goods/src/models/ars/ShopCategory.php
  2. 13
      vendor/antgoods/goods/src/models/searchs/BrandSearch.php
  3. 13
      vendor/antgoods/goods/src/models/searchs/SupplierSearch.php
  4. 26
      vendor/antgoods/goods/src/views/shop-category/view.php

6
vendor/antgoods/goods/src/models/ars/ShopCategory.php

@ -4,6 +4,7 @@ namespace antgoods\goods\models\ars;
use Yii; use Yii;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use common\models\ars\File;
/** /**
* This is the model class for table "antgoods_shop_category". * This is the model class for table "antgoods_shop_category".
@ -113,4 +114,9 @@ class ShopCategory extends \yii\db\ActiveRecord
{ {
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
} }
public function getIconFile()
{
return $this->hasOne(File::className(), ['id' => 'icon']);
}
} }

13
vendor/antgoods/goods/src/models/searchs/BrandSearch.php

@ -57,6 +57,19 @@ class BrandSearch extends Brand
[ [
'class' => 'iron\grid\ActionColumn', 'class' => 'iron\grid\ActionColumn',
'align' => 'center', 'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
], ],
]; ];
} }

13
vendor/antgoods/goods/src/models/searchs/SupplierSearch.php

@ -63,6 +63,19 @@ class SupplierSearch extends Supplier
[ [
'class' => 'iron\grid\ActionColumn', 'class' => 'iron\grid\ActionColumn',
'align' => 'center', 'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
], ],
]; ];
} }

26
vendor/antgoods/goods/src/views/shop-category/view.php

@ -3,6 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
use antgoods\goods\models\ars\ShopCategory; use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\ars\Attribute;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\ShopCategory */ /* @var $model antgoods\goods\models\ars\ShopCategory */
@ -11,6 +12,15 @@ $this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this); \yii\web\YiiAsset::register($this);
$filter_attr_arr = explode(',', $model->filter_attr);
$attr_str = '';
foreach ($filter_attr_arr as $filter_attr_id) {
$attr = Attribute::findOne($filter_attr_id);
if ($attr) {
$attr_str = $attr_str . ',' . $attr->name;
}
}
$attr_str = substr($attr_str, 1);
?> ?>
<div class="shop-category-view"> <div class="shop-category-view">
@ -26,14 +36,24 @@ $this->params['breadcrumbs'][] = $this->title;
'keywords', 'keywords',
'desc', 'desc',
'sort_order', 'sort_order',
'icon',
'filter_attr:ntext',
['attribute' => 'icon',
'width'=>'10%',
'format' => 'raw',
'value' => function ($model) {
return $model->iconFile ?
\yii\bootstrap4\Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px'])
: '未设置';
}
],
['attribute' => 'filter_attr',
'value' => $attr_str
],
['attribute' => 'is_show', ['attribute' => 'is_show',
'width' => '5%', 'width' => '5%',
'value' => 'value' =>
function ($model) { function ($model) {
return $model->is_show == ShopCategory::IS_SHOW_HIDE ? '隐藏' : '显示'; return $model->is_show == ShopCategory::IS_SHOW_HIDE ? '隐藏' : '显示';
}, },
], ],
'created_at:datetime', 'created_at:datetime',

Loading…
Cancel
Save