Browse Source

feat: 优化发货列表显示

wechat_public_accounts
travis 5 years ago
parent
commit
41996eb93d
  1. 24
      backend/modules/shop/models/ars/Delivery.php
  2. 9
      backend/modules/shop/models/searchs/DeliverySearch.php
  3. 7
      backend/modules/shop/views/delivery/view.php

24
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;
}
} }

9
backend/modules/shop/models/searchs/DeliverySearch.php

@ -58,7 +58,7 @@ class DeliverySearch extends Delivery
], ],
[ [
'attribute' => 'order_id', 'attribute' => 'order_id',
'width' => '10%',
'width' => '7%',
], ],
[ [
'attribute' => 'shipping_name', 'attribute' => 'shipping_name',
@ -70,7 +70,10 @@ class DeliverySearch extends Delivery
], ],
[ [
'attribute' => 'type', 'attribute' => 'type',
'width' => '7%',
'width' => '8%',
'value' => function ($model) {
return Delivery::dropDown('type', $model->type);
}
], ],
[ [
'attribute' => 'status', 'attribute' => 'status',
@ -78,7 +81,7 @@ class DeliverySearch extends Delivery
], ],
[ [
'attribute' => 'decription', 'attribute' => 'decription',
'width' => '7%',
'width' => '15%',
], ],
[ [
'attribute' => 'created_at', 'attribute' => 'created_at',

7
backend/modules/shop/views/delivery/view.php

@ -24,7 +24,12 @@ $this->params['breadcrumbs'][] = $this->title;
'order_id', 'order_id',
'shipping_name', 'shipping_name',
'shipping_id', 'shipping_id',
'type',
[
'attribute' => 'type',
'value' => function ($model) {
return \backend\modules\shop\models\ars\Delivery::dropDown('type', $model->type);
}
],
'status', 'status',
'decription:ntext', 'decription:ntext',
[ [

Loading…
Cancel
Save