diff --git a/beike/Shop/Http/Controllers/OrderController.php b/beike/Shop/Http/Controllers/OrderController.php new file mode 100644 index 00000000..432693f1 --- /dev/null +++ b/beike/Shop/Http/Controllers/OrderController.php @@ -0,0 +1,31 @@ + + * @created 2023-06-06 10:47:27 + * @modified 2023-06-06 10:47:27 + */ + +namespace Beike\Shop\Http\Controllers; + +use Beike\Models\Order; +use Illuminate\Http\Request; + +class OrderController extends Controller +{ + public function show(Request $request, int $number) + { + $email = trim($request->get('email')); + if (empty($email)) { + return null; + } + + $order = Order::query()->where('number', $number)->where('email', $email)->firstOrFail(); + $data = hook_filter('order.show.data', ['order' => $order, 'html_items' => []]); + + return view('order_info', $data); + } +} \ No newline at end of file diff --git a/beike/Shop/Routes/shop.php b/beike/Shop/Routes/shop.php index ff180a80..75018e2e 100644 --- a/beike/Shop/Routes/shop.php +++ b/beike/Shop/Routes/shop.php @@ -56,6 +56,8 @@ Route::prefix('/') Route::post('login', [LoginController::class, 'store'])->name('login.store'); Route::get('logout', [LogoutController::class, 'index'])->name('logout'); + Route::get('orders/{number}', [\Beike\Shop\Http\Controllers\OrderController::class, 'show'])->name('orders.show'); + Route::get('page_categories', [PageCategoryController::class, 'home'])->name('page_categories.home'); Route::get('page_categories/{page_category}', [PageCategoryController::class, 'show'])->name('page_categories.show'); Route::get('pages/{page}', [PageController::class, 'show'])->name('pages.show'); diff --git a/themes/default/account/order_info.blade.php b/themes/default/account/order_info.blade.php index 7ef543d6..03423c8d 100644 --- a/themes/default/account/order_info.blade.php +++ b/themes/default/account/order_info.blade.php @@ -10,235 +10,8 @@
- - @if ($errors->any()) - @foreach ($errors->all() as $error) - - @endforeach - @endif - -
-
-
{{ __('shop/account.order.order_info.order_details') }}
-
- @if ($order->status == 'unpaid') - {{ __('shop/account.order.order_info.to_pay') }} - - @endif - @if ($order->status == 'shipped') - - @endif -
-
-
-
- - - - - - - - - - - - - - - - - -
{{ __('shop/account.order.order_info.order_number') }}{{ __('shop/account.order.order_info.order_date') }}{{ __('shop/account.order.order_info.state') }}{{ __('shop/account.order.order_info.order_amount') }}
{{ $order->number }}{{ $order->created_at }} - {{$order->status_format}} - {{ currency_format($order->total, $order->currency_code, $order->currency_value) }}
-
-
-
-
-
{{ __('order.address_info') }}
-
- - - - - - - - - - - - - -
{{ __('order.shipping_address') }}{{ __('order.payment_address') }}
-
{{ __('address.name') }}:{{ $order->shipping_customer_name }} ({{ $order->shipping_telephone }})
-
- {{ __('address.address') }}: - {{ $order->shipping_address_1 }} - {{ $order->shipping_address_2 }} - {{ $order->shipping_city }} - {{ $order->shipping_zone }} - {{ $order->shipping_country }} -
-
{{ __('address.post_code') }}:{{ $order->shipping_zipcode }}
-
-
{{ __('address.name') }}:{{ $order->payment_customer_name }} ({{ $order->payment_telephone }})
-
- {{ __('address.address') }}: - {{ $order->payment_address_1 }} - {{ $order->payment_address_2 }} - {{ $order->payment_city }} - {{ $order->payment_zone }} - {{ $order->payment_country }} -
-
{{ __('address.post_code') }}:{{ $order->payment_zipcode }}
-
-
-
-
-
-
{{ __('shop/account.order.order_info.order_items') }}
-
-
- @foreach ($order->orderProducts as $product) -
-
-
-
- -
- {{ currency_format($product->price, $order->currency_code, $order->currency_value) }} - x {{ $product->quantity }} - = {{ currency_format($product->price * $product->quantity, $order->currency_code, $order->currency_value) }} -
-
-
- @if ($order->status == 'completed') - {{ __('shop/account.order.order_info.apply_after_sales') }} - @endif -
- @endforeach -
-
- -
-
-
{{ __('shop/account.order.order_info.order_total') }}
-
-
- - - @foreach (array_chunk($order->orderTotals->all(), 2) as $totals) - - @foreach ($totals as $total) - - - @endforeach - - @endforeach - -
{{ $total->title }}{{ currency_format($total->value, $order->currency_code, $order->currency_value) }}
-
-
- - @foreach ($html_items as $item) - {!! $item !!} - @endforeach - - @hook('account.order_info.after') - - @if (0) -
-
-
{{ __('shop/account.order.order_info.logistics_status') }}
-
-
- -
-
- @endif - - @if ($order->orderShipments->count()) - @hookwrapper('account.order_info.shipments') -
-
{{ __('order.order_shipments') }}
-
-
- - - - - - - - - - @foreach ($order->orderShipments as $ship) - - - - - - @endforeach - -
{{ __('order.express_company') }}{{ __('order.express_number') }}{{ __('order.history_created_at') }}
{{ $ship->express_company }}{{ $ship->express_number }}{{ $ship->created_at }}
-
-
-
- @endhookwrapper - @endif - - @if ($order->orderHistories->count()) -
-
-
{{ __('shop/account.order.order_info.order_status') }}
-
-
- - - - - - - - - - @foreach ($order->orderHistories as $orderHistory) - - - - - - @endforeach - -
{{ __('shop/account.order.order_info.state') }}{{ __('shop/account.order.order_info.remark') }}{{ __('shop/account.order.order_info.update_time') }}
{{ $orderHistory->status_format }}{{ $orderHistory->comment }}{{ $orderHistory->created_at }}
-
-
- @endif + @include('shared.order_info')
@endsection - - -@push('add-scripts') - -@endpush diff --git a/themes/default/checkout/success.blade.php b/themes/default/checkout/success.blade.php index 55df0303..2fb487d8 100644 --- a/themes/default/checkout/success.blade.php +++ b/themes/default/checkout/success.blade.php @@ -1,5 +1,5 @@ @extends('layout.master') -@section('body-class', 'page-checkout-success') +@section('body-class', 'page-account-order-info') @section('title', __('shop/checkout.checkout_success_title')) @section('content') @@ -22,6 +22,8 @@
{{ __('shop/account.order.order_info.order_details') }}
@if (current_customer()) {{ __('common.view_more') }} + @else + {{ __('common.view_more') }} @endif
@@ -98,10 +100,4 @@
- - @endsection diff --git a/themes/default/order_info.blade.php b/themes/default/order_info.blade.php new file mode 100644 index 00000000..1ef3913b --- /dev/null +++ b/themes/default/order_info.blade.php @@ -0,0 +1,11 @@ +@extends('layout.master') + +@section('body-class', 'page-account-order-info') + +@section('content') +
+
+ @include('shared.order_info') +
+
+@endsection \ No newline at end of file diff --git a/themes/default/shared/order_info.blade.php b/themes/default/shared/order_info.blade.php new file mode 100644 index 00000000..0b69ee82 --- /dev/null +++ b/themes/default/shared/order_info.blade.php @@ -0,0 +1,215 @@ +@if ($errors->any()) + @foreach ($errors->all() as $error) + + @endforeach +@endif + +
+
+
{{ __('shop/account.order.order_info.order_details') }}
+
+ @if ($order->status == 'unpaid') + {{ __('shop/account.order.order_info.to_pay') }} + + @endif + @if ($order->status == 'shipped') + + @endif +
+
+
+
+ + + + + + + + + + + + + + + + + +
{{ __('shop/account.order.order_info.order_number') }}{{ __('shop/account.order.order_info.order_date') }}{{ __('shop/account.order.order_info.state') }}{{ __('shop/account.order.order_info.order_amount') }}
{{ $order->number }}{{ $order->created_at }} + {{$order->status_format}} + {{ currency_format($order->total, $order->currency_code, $order->currency_value) }}
+
+
+
+
+
{{ __('order.address_info') }}
+
+ + + + + + + + + + + + + +
{{ __('order.shipping_address') }}{{ __('order.payment_address') }}
+
{{ __('address.name') }}:{{ $order->shipping_customer_name }} ({{ $order->shipping_telephone }})
+
+ {{ __('address.address') }}: + {{ $order->shipping_address_1 }} + {{ $order->shipping_address_2 }} + {{ $order->shipping_city }} + {{ $order->shipping_zone }} + {{ $order->shipping_country }} +
+
{{ __('address.post_code') }}:{{ $order->shipping_zipcode }}
+
+
{{ __('address.name') }}:{{ $order->payment_customer_name }} ({{ $order->payment_telephone }})
+
+ {{ __('address.address') }}: + {{ $order->payment_address_1 }} + {{ $order->payment_address_2 }} + {{ $order->payment_city }} + {{ $order->payment_zone }} + {{ $order->payment_country }} +
+
{{ __('address.post_code') }}:{{ $order->payment_zipcode }}
+
+
+
+
+
+
{{ __('shop/account.order.order_info.order_items') }}
+
+
+ @foreach ($order->orderProducts as $product) +
+
+
+
+ +
+ {{ currency_format($product->price, $order->currency_code, $order->currency_value) }} + x {{ $product->quantity }} + = {{ currency_format($product->price * $product->quantity, $order->currency_code, $order->currency_value) }} +
+
+
+ @if ($order->status == 'completed') + {{ __('shop/account.order.order_info.apply_after_sales') }} + @endif +
+ @endforeach +
+
+ +
+
+
{{ __('shop/account.order.order_info.order_total') }}
+
+
+ + + @foreach (array_chunk($order->orderTotals->all(), 2) as $totals) + + @foreach ($totals as $total) + + + @endforeach + + @endforeach + +
{{ $total->title }}{{ currency_format($total->value, $order->currency_code, $order->currency_value) }}
+
+
+ +@foreach ($html_items as $item) + {!! $item !!} +@endforeach + +@hook('account.order_info.after') + +@if ($order->orderShipments->count()) + @hookwrapper('account.order_info.shipments') +
+
{{ __('order.order_shipments') }}
+
+
+ + + + + + + + + + @foreach ($order->orderShipments as $ship) + + + + + + @endforeach + +
{{ __('order.express_company') }}{{ __('order.express_number') }}{{ __('order.history_created_at') }}
{{ $ship->express_company }}{{ $ship->express_number }}{{ $ship->created_at }}
+
+
+
+ @endhookwrapper +@endif + +@if ($order->orderHistories->count()) +
+
+
{{ __('shop/account.order.order_info.order_status') }}
+
+
+ + + + + + + + + + @foreach ($order->orderHistories as $orderHistory) + + + + + + @endforeach + +
{{ __('shop/account.order.order_info.state') }}{{ __('shop/account.order.order_info.remark') }}{{ __('shop/account.order.order_info.update_time') }}
{{ $orderHistory->status_format }}{{ $orderHistory->comment }}{{ $orderHistory->created_at }}
+
+
+@endif + +@push('add-scripts') + +@endpush \ No newline at end of file