Browse Source

feat: 优化订单显示

wechat_public_accounts
travis 5 years ago
parent
commit
14c09ea63c
  1. 29
      backend/modules/shop/models/ars/Order.php
  2. 37
      backend/modules/shop/models/searchs/OrderSearch.php
  3. 15
      backend/modules/shop/views/delivery/view.php
  4. 2
      backend/modules/shop/views/order/shipping_info.php
  5. 12
      backend/modules/shop/views/order/table_consignee_info.php
  6. 44
      backend/modules/shop/views/order/view.php

29
backend/modules/shop/models/ars/Order.php

@ -167,20 +167,29 @@ class Order extends \yii\db\ActiveRecord
*/ */
public static function dropDown($column, $value = null) public static function dropDown($column, $value = null)
{ {
$data[0] = '无需配送';
$dropDownList = [ $dropDownList = [
'pay_type' => [
'0' => '未支付',
'1' => '微信支付',
'2' => '余额支付',
'3' => '积分兑换',
],
'shipping_type' => [ 'shipping_type' => [
'0' => '虚拟货物',
'1' => '自提',
'2' => '快递物流',
self::SHIPPING_TYPE_VIRTUAL_GOODS => '虚拟货物',
self::SHIPPING_TYPE_PICKED_UP => '自提',
self::SHIPPING_TYPE_EXPRESS => '快递物流',
],
'type' => [
self::TYPE_SHOPPING => '普通购物订单',
], ],
'status' => [
self::STATUS_UNCONFIRMED => '待确认',
self::STATUS_NONPAYMENT => '待支付',
self::STATUS_CANCEL => '已取消',
self::STATUS_PAYMENT_TO_BE_CONFIRMED => '支付待确认',
self::STATUS_APPLY_REFUND => '申请退款',
self::STATUS_REFUND => '已退款',
self::STATUS_TO_BE_SHIPPING => '待发货',
self::STATUS_SHIPMENT_ALL => '全部发货',
self::STATUS_SHIPMENT_PORTION => '部分发货',
self::STATUS_FINISH => '已完成',
]
]; ];
//根据具体值显示对应的值 //根据具体值显示对应的值
if ($value !== null) if ($value !== null)
return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false; return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false;

37
backend/modules/shop/models/searchs/OrderSearch.php

@ -59,7 +59,7 @@ class OrderSearch extends Order
], ],
[ [
'attribute' => 'user_id', 'attribute' => 'user_id',
'width' => '7%',
'width' => '5%',
// 'value' => function ($model) { // 'value' => function ($model) {
// return base64_decode($model->user->nickname); // return base64_decode($model->user->nickname);
// } // }
@ -68,21 +68,21 @@ class OrderSearch extends Order
'attribute' => 'order_sn', 'attribute' => 'order_sn',
'width' => '8%', 'width' => '8%',
], ],
[
'attribute' => 'invoice_id',
'width' => '8%',
],
[
'attribute' => 'status',
'width' => '5%',
],
// [
// 'attribute' => 'invoice_id',
// 'width' => '8%',
// ],
[ [
'attribute' => 'type', 'attribute' => 'type',
'width' => '5%', 'width' => '5%',
'value' => function ($model) {
return !empty($model->type) ? Order::dropDown('type', $model->type) : '';
}
], ],
[ [
'label' => '订单信息', 'label' => '订单信息',
'format' => 'raw', 'format' => 'raw',
'width' => '7%',
'value' => function ($model) { 'value' => function ($model) {
return Yii::$app->controller->renderPartial('order_info', ['model' => $model]); return Yii::$app->controller->renderPartial('order_info', ['model' => $model]);
}, },
@ -90,6 +90,7 @@ class OrderSearch extends Order
[ [
'label' => '物流信息', 'label' => '物流信息',
'format' => 'raw', 'format' => 'raw',
'width' => '20%',
'value' => function ($model) { 'value' => function ($model) {
return Yii::$app->controller->renderPartial('shipping_info', ['model' => $model]); return Yii::$app->controller->renderPartial('shipping_info', ['model' => $model]);
}, },
@ -97,22 +98,26 @@ class OrderSearch extends Order
[ [
'label' => '收货信息', 'label' => '收货信息',
'format' => 'raw', 'format' => 'raw',
'width' => '17%',
'value' => function ($model) { 'value' => function ($model) {
return Yii::$app->controller->renderPartial('table_consignee_info', ['model' => $model]); return Yii::$app->controller->renderPartial('table_consignee_info', ['model' => $model]);
}, },
], ],
[ [
'attribute' => 'remarks',
'width' => '8%',
],
[
'attribute' => 'updated_at',
'width' => '8%',
'attribute' => 'status',
'width' => '5%',
'value' => function ($model) { 'value' => function ($model) {
return date('Y-m-d H:i:s', $model->updated_at);
return Order::dropDown('status', $model->status);
} }
], ],
// [ // [
// 'attribute' => 'updated_at',
// 'width' => '8%',
// 'value' => function ($model) {
// return date('Y-m-d H:i:s', $model->updated_at);
// }
// ],
// [
// 'attribute' => 'created_at', // 'attribute' => 'created_at',
// 'value' => function ($model) { // 'value' => function ($model) {
// return date('Y-m-d H:i:s', $model->created_at); // return date('Y-m-d H:i:s', $model->created_at);

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

@ -25,11 +25,20 @@ $this->params['breadcrumbs'][] = $this->title;
'shipping_name', 'shipping_name',
'shipping_id', 'shipping_id',
'type', 'type',
'goods:ntext',
'status', 'status',
'decription:ntext', 'decription:ntext',
'updated_at',
'created_at',
[
'attribute' => 'created_at',
'value' => function ($model) {
return date('Y-m-d H:i:s', $model->created_at);
}
],
[
'attribute' => 'updated_at',
'value' => function ($model) {
return date('Y-m-d H:i:s', $model->updated_at);
}
],
], ],
]) ?> ]) ?>

2
backend/modules/shop/views/order/shipping_info.php

@ -13,7 +13,7 @@
<table class="info"> <table class="info">
<tr> <tr>
<td>物流类型:</td> <td>物流类型:</td>
<td><?= $model->shipping_type ? Order::dropDown('shipping_type', $model->shipping_type) : '无' ?></td>
<td><?= isset($model->shipping_type) ? Order::dropDown('shipping_type', $model->shipping_type) : '无' ?></td>
</tr> </tr>
<tr> <tr>
<td>商品金额:</td> <td>商品金额:</td>

12
backend/modules/shop/views/order/table_consignee_info.php

@ -12,6 +12,18 @@
<td>联系人:</td> <td>联系人:</td>
<td><?= $model->consignee ?></td> <td><?= $model->consignee ?></td>
</tr> </tr>
<tr>
<td>省份:</td>
<td><?= $model->province ? $model->provinceId->name : ''?></td>
</tr>
<tr>
<td>城市:</td>
<td><?= $model->city ? $model->cityId->name : ''?></td>
</tr>
<tr>
<td>县区:</td>
<td><?= $model->area ? $model->areaId->name : ''?></td>
</tr>
<tr> <tr>
<td>地址:</td> <td>地址:</td>
<td><?= $model->shipping_amount ?></td> <td><?= $model->shipping_amount ?></td>

44
backend/modules/shop/views/order/view.php

@ -2,6 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
use backend\modules\shop\models\ars\Order;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model backend\models\ars\Order */ /* @var $model backend\models\ars\Order */
@ -24,12 +25,28 @@ $this->params['breadcrumbs'][] = $this->title;
'user_id', 'user_id',
'order_sn', 'order_sn',
'invoice_id', 'invoice_id',
'status',
'type',
[
'attribute' => 'status',
'value' => function ($model) {
return Order::dropDown('status', $model->status);
}
],
[
'attribute' => 'type',
'value' => function ($model) {
return Order::dropDown('type', $model->type);
}
],
'goods_count', 'goods_count',
'goods_amount', 'goods_amount',
'shipping_amount', 'shipping_amount',
'shipping_type',
[
'attribute' => 'shipping_type',
'width' => '7%',
'value' => function ($model) {
return Order::dropDown('shipping_type', $model->shipping_type);
}
],
'consignee', 'consignee',
'phone', 'phone',
'province', 'province',
@ -37,15 +54,30 @@ $this->params['breadcrumbs'][] = $this->title;
'area', 'area',
'taking_site', 'taking_site',
'pay_type', 'pay_type',
'pay_at',
[
'attribute' => 'pay_at',
'value' => function ($model) {
return date('Y-m-d H:i:s', $model->pay_at);
}
],
'payment_sn', 'payment_sn',
'payment_amount', 'payment_amount',
'receivables', 'receivables',
'remarks', 'remarks',
'discount_amount', 'discount_amount',
'discount_description:ntext', 'discount_description:ntext',
'updated_at',
'created_at',
[
'attribute' => 'created_at',
'value' => function ($model) {
return date('Y-m-d H:i:s', $model->updated_at);
}
],
[
'attribute' => 'updated_at',
'value' => function ($model) {
return date('Y-m-d H:i:s', $model->created_at);
}
],
], ],
]) ?> ]) ?>

Loading…
Cancel
Save