diff --git a/backend/modules/shop/models/ars/Delivery.php b/backend/modules/shop/models/ars/Delivery.php index 866b413..6e5db5a 100755 --- a/backend/modules/shop/models/ars/Delivery.php +++ b/backend/modules/shop/models/ars/Delivery.php @@ -85,4 +85,28 @@ class Delivery extends \yii\db\ActiveRecord ], ]; } + + /** + * @param $column + * @param null $value + * @return bool + * 获取各状态数组 + */ + public static function dropDown($column, $value = null) + { + $dropDownList = [ + 'type' => [ + self::TYPE_SHIPMENT_ALL => '全部发货', + self::TYPE_SHIPMENT_PORTION => '部分发货', + ], + ]; + + //根据具体值显示对应的值 + if ($value !== null) + return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false; + //返回关联数组,用户下拉的filter实现 + else + return array_key_exists($column, $dropDownList) ? $dropDownList[$column] : false; + } + } diff --git a/backend/modules/shop/models/searchs/DeliverySearch.php b/backend/modules/shop/models/searchs/DeliverySearch.php index f0a0804..9016666 100644 --- a/backend/modules/shop/models/searchs/DeliverySearch.php +++ b/backend/modules/shop/models/searchs/DeliverySearch.php @@ -58,7 +58,7 @@ class DeliverySearch extends Delivery ], [ 'attribute' => 'order_id', - 'width' => '10%', + 'width' => '7%', ], [ 'attribute' => 'shipping_name', @@ -70,7 +70,10 @@ class DeliverySearch extends Delivery ], [ 'attribute' => 'type', - 'width' => '7%', + 'width' => '8%', + 'value' => function ($model) { + return Delivery::dropDown('type', $model->type); + } ], [ 'attribute' => 'status', @@ -78,7 +81,7 @@ class DeliverySearch extends Delivery ], [ 'attribute' => 'decription', - 'width' => '7%', + 'width' => '15%', ], [ 'attribute' => 'created_at', diff --git a/backend/modules/shop/views/delivery/view.php b/backend/modules/shop/views/delivery/view.php index a452682..a1302e2 100644 --- a/backend/modules/shop/views/delivery/view.php +++ b/backend/modules/shop/views/delivery/view.php @@ -24,7 +24,12 @@ $this->params['breadcrumbs'][] = $this->title; 'order_id', 'shipping_name', 'shipping_id', - 'type', + [ + 'attribute' => 'type', + 'value' => function ($model) { + return \backend\modules\shop\models\ars\Delivery::dropDown('type', $model->type); + } + ], 'status', 'decription:ntext', [