From 9b6d341ba2687f32ccc1b5fbc7acaa570ca53e9c Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 29 Aug 2022 16:41:16 +0800 Subject: [PATCH] order information languages --- beike/Models/OrderHistory.php | 7 +++ beike/Services/StateMachineService.php | 2 +- .../admin/views/pages/orders/form.blade.php | 54 +++++++++---------- resources/lang/en/order.php | 20 +++++++ resources/lang/zh_cn/order.php | 20 +++++++ 5 files changed, 75 insertions(+), 28 deletions(-) diff --git a/beike/Models/OrderHistory.php b/beike/Models/OrderHistory.php index b4c794b7..ceb907b0 100644 --- a/beike/Models/OrderHistory.php +++ b/beike/Models/OrderHistory.php @@ -16,4 +16,11 @@ class OrderHistory extends Base protected $fillable = [ 'order_id', 'status', 'notify', 'comment' ]; + + protected $appends = ['status_format']; + + public function getStatusFormatAttribute() + { + return trans("order.{$this->status}"); + } } diff --git a/beike/Services/StateMachineService.php b/beike/Services/StateMachineService.php index c87474bf..7cb3df4f 100644 --- a/beike/Services/StateMachineService.php +++ b/beike/Services/StateMachineService.php @@ -131,7 +131,7 @@ class StateMachineService foreach ($nextStatusCodes as $status) { $result[] = [ 'status' => $status, - 'name' => trans($status) + 'name' => trans("order.{$status}") ]; } return $result; diff --git a/resources/beike/admin/views/pages/orders/form.blade.php b/resources/beike/admin/views/pages/orders/form.blade.php index 4e8eb5e4..1249d007 100644 --- a/resources/beike/admin/views/pages/orders/form.blade.php +++ b/resources/beike/admin/views/pages/orders/form.blade.php @@ -1,25 +1,25 @@ @extends('admin::layouts.master') -@section('title', '订单详情') +@section('title', __('admin/common.order')) @section('content')
-
订单详情
+
{{ __('admin/common.order') }}
- + - + - + @@ -29,15 +29,15 @@
订单编号:{{ __('order.number') }}: {{ $order->number }}
付款方式:{{ __('order.payment_method') }}: {{ $order->payment_method_name }}
总计:{{ __('order.total') }}: {{ $order->total_format }}
- + - + - + @@ -48,13 +48,13 @@
-
地址信息
+
{{ __('order.address_info') }}
客户姓名:{{ __('order.customer_name') }}: {{ $order->customer_name }}
生成日期:{{ __('order.created_at') }}: {{ $order->created_at }}
修改日期:{{ __('order.updated_at') }}: {{ $order->updated_at }}
- - + + @@ -81,14 +81,14 @@ @can('orders_update_status')
-
订单状态
+
{{ __('order.order_status') }}
- + {{ $order->status_format }} - - + + --}} - + - 更新状态 + {{ __('order.submit_status') }}
@@ -113,16 +113,16 @@ @endcan
-
商品信息
+
{{ __('order.product_info') }}
订单地址账单地址{{ __('order.shipping_address') }}{{ __('order.payment_address') }}
- - - - + + + + @@ -153,20 +153,20 @@
-
订单操作日志
+
{{ __('order.action_history') }}
ID商品价格数量sku{{ __('order.product_name') }}{{ __('order.product_price') }}{{ __('order.product_quantity') }}{{ __('order.product_sku') }}
- - - + + + @foreach ($order->orderHistories as $orderHistory) - + diff --git a/resources/lang/en/order.php b/resources/lang/en/order.php index b17df740..681c83c0 100644 --- a/resources/lang/en/order.php +++ b/resources/lang/en/order.php @@ -22,6 +22,26 @@ return [ 'status_format' => 'Status', 'total' => 'Total', + 'address_info' => 'Address Information', + 'shipping_address' => 'Shipping Address', + 'payment_address' => 'Payment Address', + 'order_status' => 'Order Status', + 'current_status' => 'Current', + 'change_to_status' => 'Change To', + 'comment' => 'Comment', + 'submit_status' => 'Submit', + + 'product_info' => 'Product Information', + 'product_name' => 'Product Name', + 'product_price' => 'Unit Price', + 'product_quantity' => 'Quantity', + 'product_sku' => 'SKU', + + 'action_history' => 'Action History', + 'history_status' => 'Status', + 'history_comment' => 'Comment', + 'history_created_at' => 'Created At', + 'unpaid' => 'Unpaid', 'paid' => 'Paid', 'shipped' => 'Shipped', diff --git a/resources/lang/zh_cn/order.php b/resources/lang/zh_cn/order.php index aed4c45c..a851bd81 100644 --- a/resources/lang/zh_cn/order.php +++ b/resources/lang/zh_cn/order.php @@ -22,6 +22,26 @@ return [ 'status_format' => '状态', 'total' => '订单总额', + 'address_info' => '地址信息', + 'shipping_address' => '配送地址', + 'payment_address' => '账单地址', + 'order_status' => '订单状态', + 'current_status' => '当前状态', + 'change_to_status' => '修改状态', + 'comment' => '备注信息', + 'submit_status' => '更新状态', + + 'product_info' => '商品信息', + 'product_name' => '名称', + 'product_price' => '价格', + 'product_quantity' => '数量', + 'product_sku' => 'SKU', + + 'action_history' => '操作日志', + 'history_status' => '状态', + 'history_comment' => '备注', + 'history_created_at' => '更新日期', + 'unpaid' => '待支付', 'paid' => '已支付', 'shipped' => '已发货',
状态备注更新时间{{ __('order.history_status') }}{{ __('order.history_comment') }}{{ __('order.history_created_at') }}
{{ $orderHistory->status }}{{ $orderHistory->status_format }} {{ $orderHistory->comment }} {{ $orderHistory->created_at }}