From 14c09ea63cfb1f7dde7c65b5cea5c6ce6464ed16 Mon Sep 17 00:00:00 2001 From: travis <310243791@qq.com> Date: Fri, 6 Dec 2019 19:10:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/modules/shop/models/ars/Order.php | 29 +++++++----- .../shop/models/searchs/OrderSearch.php | 37 +++++++++------- backend/modules/shop/views/delivery/view.php | 15 +++++-- .../shop/views/order/shipping_info.php | 2 +- .../shop/views/order/table_consignee_info.php | 12 +++++ backend/modules/shop/views/order/view.php | 44 ++++++++++++++++--- 6 files changed, 103 insertions(+), 36 deletions(-) diff --git a/backend/modules/shop/models/ars/Order.php b/backend/modules/shop/models/ars/Order.php index b76dc66..3e155ff 100755 --- a/backend/modules/shop/models/ars/Order.php +++ b/backend/modules/shop/models/ars/Order.php @@ -167,20 +167,29 @@ class Order extends \yii\db\ActiveRecord */ public static function dropDown($column, $value = null) { - $data[0] = '无需配送'; $dropDownList = [ - 'pay_type' => [ - '0' => '未支付', - '1' => '微信支付', - '2' => '余额支付', - '3' => '积分兑换', - ], '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) return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false; diff --git a/backend/modules/shop/models/searchs/OrderSearch.php b/backend/modules/shop/models/searchs/OrderSearch.php index 18c491b..df76d57 100755 --- a/backend/modules/shop/models/searchs/OrderSearch.php +++ b/backend/modules/shop/models/searchs/OrderSearch.php @@ -59,7 +59,7 @@ class OrderSearch extends Order ], [ 'attribute' => 'user_id', - 'width' => '7%', + 'width' => '5%', // 'value' => function ($model) { // return base64_decode($model->user->nickname); // } @@ -68,21 +68,21 @@ class OrderSearch extends Order 'attribute' => 'order_sn', 'width' => '8%', ], - [ - 'attribute' => 'invoice_id', - 'width' => '8%', - ], - [ - 'attribute' => 'status', - 'width' => '5%', - ], +// [ +// 'attribute' => 'invoice_id', +// 'width' => '8%', +// ], [ 'attribute' => 'type', 'width' => '5%', + 'value' => function ($model) { + return !empty($model->type) ? Order::dropDown('type', $model->type) : ''; + } ], [ 'label' => '订单信息', 'format' => 'raw', + 'width' => '7%', 'value' => function ($model) { return Yii::$app->controller->renderPartial('order_info', ['model' => $model]); }, @@ -90,6 +90,7 @@ class OrderSearch extends Order [ 'label' => '物流信息', 'format' => 'raw', + 'width' => '20%', 'value' => function ($model) { return Yii::$app->controller->renderPartial('shipping_info', ['model' => $model]); }, @@ -97,22 +98,26 @@ class OrderSearch extends Order [ 'label' => '收货信息', 'format' => 'raw', + 'width' => '17%', 'value' => function ($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) { - 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', // 'value' => function ($model) { // return date('Y-m-d H:i:s', $model->created_at); diff --git a/backend/modules/shop/views/delivery/view.php b/backend/modules/shop/views/delivery/view.php index 9cca8c1..a452682 100644 --- a/backend/modules/shop/views/delivery/view.php +++ b/backend/modules/shop/views/delivery/view.php @@ -25,11 +25,20 @@ $this->params['breadcrumbs'][] = $this->title; 'shipping_name', 'shipping_id', 'type', - 'goods:ntext', 'status', '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); + } + ], ], ]) ?> diff --git a/backend/modules/shop/views/order/shipping_info.php b/backend/modules/shop/views/order/shipping_info.php index 5349d92..7894197 100644 --- a/backend/modules/shop/views/order/shipping_info.php +++ b/backend/modules/shop/views/order/shipping_info.php @@ -13,7 +13,7 @@ - + diff --git a/backend/modules/shop/views/order/table_consignee_info.php b/backend/modules/shop/views/order/table_consignee_info.php index 5dfb8af..a6617d9 100644 --- a/backend/modules/shop/views/order/table_consignee_info.php +++ b/backend/modules/shop/views/order/table_consignee_info.php @@ -12,6 +12,18 @@ + + + + + + + + + + + + diff --git a/backend/modules/shop/views/order/view.php b/backend/modules/shop/views/order/view.php index 04e42f5..cd275c8 100755 --- a/backend/modules/shop/views/order/view.php +++ b/backend/modules/shop/views/order/view.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\widgets\DetailView; +use backend\modules\shop\models\ars\Order; /* @var $this yii\web\View */ /* @var $model backend\models\ars\Order */ @@ -24,12 +25,28 @@ $this->params['breadcrumbs'][] = $this->title; 'user_id', 'order_sn', '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_amount', 'shipping_amount', - 'shipping_type', + [ + 'attribute' => 'shipping_type', + 'width' => '7%', + 'value' => function ($model) { + return Order::dropDown('shipping_type', $model->shipping_type); + } + ], 'consignee', 'phone', 'province', @@ -37,15 +54,30 @@ $this->params['breadcrumbs'][] = $this->title; 'area', 'taking_site', 'pay_type', - 'pay_at', + [ + 'attribute' => 'pay_at', + 'value' => function ($model) { + return date('Y-m-d H:i:s', $model->pay_at); + } + ], 'payment_sn', 'payment_amount', 'receivables', 'remarks', 'discount_amount', '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); + } + ], ], ]) ?>
物流类型:shipping_type ? Order::dropDown('shipping_type', $model->shipping_type) : '无' ?>shipping_type) ? Order::dropDown('shipping_type', $model->shipping_type) : '无' ?>
商品金额:联系人: consignee ?>
省份:province ? $model->provinceId->name : ''?>
城市:city ? $model->cityId->name : ''?>
县区:area ? $model->areaId->name : ''?>
地址: shipping_amount ?>