Browse Source

feat:修改商品后台列表字段和检索字段

antshop
linyaostalker 5 years ago
parent
commit
ba031cbe25
  1. 26
      backend/modules/goods/models/searchs/GoodsSearch.php
  2. 13
      backend/modules/goods/views/goods/_search.php

26
backend/modules/goods/models/searchs/GoodsSearch.php

@ -7,8 +7,7 @@ use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use backend\modules\goods\models\ars\Goods; use backend\modules\goods\models\ars\Goods;
use yii\bootstrap4\Html; use yii\bootstrap4\Html;
use backend\modules\goods\models\ars\Category;
use backend\modules\goods\models\ars\ShopCategory;
use backend\modules\shop\logic\ShopManager;
/** /**
* GoodsSearch represents the model behind the search form of `backend\modules\goods\models\ars\Goods`. * GoodsSearch represents the model behind the search form of `backend\modules\goods\models\ars\Goods`.
@ -55,7 +54,6 @@ class GoodsSearch extends Goods
'width' => '2%', 'width' => '2%',
'align' => 'center' 'align' => 'center'
], ],
'id',
['attribute' => 'image', ['attribute' => 'image',
'contentOptions' => [ 'contentOptions' => [
'align' => 'center', 'align' => 'center',
@ -71,18 +69,16 @@ class GoodsSearch extends Goods
], ],
'name', 'name',
[ [
'attribute' => 'cat_id',
'width' => '10%',
'attribute' => 'market_price',
'value' => function ($model) { 'value' => function ($model) {
return $model->category ? $model->category->name : '';
},
return sprintf("%1\$.2f",$model->market_price / ShopManager::proportionalConversion(ShopManager::UNIT_TYPE_MONEY));
}
], ],
[ [
'attribute' => 'shop_cat_id',
'width' => '10%',
'attribute' => 'price',
'value' => function ($model) { 'value' => function ($model) {
return $model->shopCategory ? $model->shopCategory->name : '';
},
return sprintf("%1\$.2f",$model->price / ShopManager::proportionalConversion(ShopManager::UNIT_TYPE_MONEY));
}
], ],
[ [
'attribute' => 'stock', 'attribute' => 'stock',
@ -95,7 +91,6 @@ class GoodsSearch extends Goods
} }
}, },
], ],
'price',
['attribute' => 'is_sale', ['attribute' => 'is_sale',
'width' => '5%', 'width' => '5%',
'value' => 'value' =>
@ -104,16 +99,11 @@ class GoodsSearch extends Goods
}, },
], ],
'updated_at:datetime',
'sort_order',
[ [
'class' => 'iron\grid\ActionColumn', 'class' => 'iron\grid\ActionColumn',
'align' => 'center', 'align' => 'center',
'config' => [ 'config' => [
[
'name' => 'view',
'icon' => 'list',
'title' => '详情',
],
[ [
'name' => 'update', 'name' => 'update',
'icon' => 'pencil', 'icon' => 'pencil',

13
backend/modules/goods/views/goods/_search.php

@ -19,19 +19,6 @@ use backend\modules\goods\models\ars\ShopCategory;
]); ]);
?> ?>
<div class="row"> <div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col"> <div class="col">
<?= $form->field($model, 'name', [ <?= $form->field($model, 'name', [
"template" => "{input}{error}", "template" => "{input}{error}",

Loading…
Cancel
Save