diff --git a/beike/Admin/Repositories/InquiryRepo.php b/beike/Admin/Repositories/InquiryRepo.php index d968afe3..4981c100 100644 --- a/beike/Admin/Repositories/InquiryRepo.php +++ b/beike/Admin/Repositories/InquiryRepo.php @@ -25,7 +25,9 @@ class InquiryRepo public static function getList(): LengthAwarePaginator { $builder = Inquiry::query()->with([ - 'productsku', + 'productsku', 'productsku.product','productsku.product' => function ($query) { + $query->with(['description']); + }, ])->orderByDesc('updated_at'); return $builder->paginate(perPage()); diff --git a/beike/Admin/View/Components/Header.php b/beike/Admin/View/Components/Header.php index b1a13a0e..88e3409b 100644 --- a/beike/Admin/View/Components/Header.php +++ b/beike/Admin/View/Components/Header.php @@ -79,6 +79,7 @@ class Header extends Component ['name' => trans('admin/common.customer'), 'route' => 'customers.index', 'code' => 'Customer'], ['name' => trans('admin/common.page'), 'route' => 'pages.index', 'code' => 'Page'], ['name' => trans('admin/common.setting'), 'route' => 'settings.index', 'code' => 'Setting'], + ['name' => trans('admin/common.inquiry'), 'route' => 'inquiry.index', 'code' => 'Inquiry'], ]; return hook_filter('admin.header_menus', $menus); diff --git a/beike/Admin/View/Components/Sidebar.php b/beike/Admin/View/Components/Sidebar.php index 5c32fd9e..01bbc0d5 100644 --- a/beike/Admin/View/Components/Sidebar.php +++ b/beike/Admin/View/Components/Sidebar.php @@ -69,6 +69,11 @@ class Sidebar extends Component foreach ($routes as $route) { $this->addLink($route, $this->equalRoute($route['route']), (bool) ($route['blank'] ?? false), $route['hide_mobile'] ?? 0); } + } elseif (Str::startsWith($routeName, $this->getInquirySubPrefix())) { + $routes = $this->getInquirySubRoutes(); + foreach ($routes as $route) { + $this->addLink($route, $this->equalRoute($route['route']), (bool) ($route['blank'] ?? false), $route['hide_mobile'] ?? 0); + } } return view('admin::components.sidebar'); @@ -157,6 +162,16 @@ class Sidebar extends Component return hook_filter('admin.sidebar.page.prefix', $prefix); } + /** + * 获取后台寻盘子页面路由前缀列表 + */ + private function getInquirySubPrefix() + { + $prefix = ['inquiry.']; + + return hook_filter('admin.sidebar.page.prefix', $prefix); + } + /** * 获取后台系统设置子页面路由前缀列表 */ @@ -243,6 +258,19 @@ class Sidebar extends Component return hook_filter('admin.sidebar.pages_routes', $routes); } + /** + * 获取寻盘管理子页面路由 + * @return mixed + */ + public function getInquirySubRoutes() + { + $routes = [ + ['route' => 'inquiry.index', 'icon' => 'fa fa-tachometer-alt'], + ]; + + return hook_filter('admin.sidebar.pages_routes', $routes); + } + /** * 获取系统设置子页面路由 * @return mixed diff --git a/beike/Shop/Http/Resources/InquiryDetail.php b/beike/Shop/Http/Resources/InquiryDetail.php index 97792670..c1d8d3c4 100644 --- a/beike/Shop/Http/Resources/InquiryDetail.php +++ b/beike/Shop/Http/Resources/InquiryDetail.php @@ -24,7 +24,8 @@ class InquiryDetail extends JsonResource public function toArray($request): array { $productsku = $this->productsku; - + $product = $productsku->product; + $description = $product->description; return [ 'id' => $this->id, 'product_sku_id' => $this->product_sku_id, @@ -32,6 +33,15 @@ class InquiryDetail extends JsonResource 'email' => $this->email, 'content' => $this->content, 'product_sku_sku' => $productsku->sku, + 'product_name' => $description->name ?? '', + 'product_images' => array_map(function ($image) { + return [ + 'preview' => image_resize($image, 500, 500), + 'popup' => image_resize($image, 800, 800), + 'thumb' => image_resize($image, 150, 150), + ]; + }, $product->images ?? []), + 'product_id' => $productsku->product_id, 'created_at' => time_format($this->created_at), 'updated_at' => time_format($this->updated_at), ]; diff --git a/beike/Shop/Http/Resources/ProductDetail.php b/beike/Shop/Http/Resources/ProductDetail.php index 05f5dbc8..02cfb740 100644 --- a/beike/Shop/Http/Resources/ProductDetail.php +++ b/beike/Shop/Http/Resources/ProductDetail.php @@ -52,8 +52,8 @@ class ProductDetail extends JsonResource 'skus' => SkuDetail::collection($this->skus)->jsonSerialize(), 'in_wishlist' => $this->inCurrentWishlist->id ?? 0, 'active' => (bool) $this->active, - 'price_setting' => $this->price_setting ?? '', - 'numPrices' => numPricesDetail::collection($this->numprices)->jsonSerialize() ?? '', + 'price_setting' => $this->price_setting ?? '', + 'numPrices' => numPricesDetail::collection($this->numprices)->jsonSerialize() ?? '', ]; } diff --git a/beike/Shop/Http/Resources/ProductSimple.php b/beike/Shop/Http/Resources/ProductSimple.php index febc4359..65da7d7c 100644 --- a/beike/Shop/Http/Resources/ProductSimple.php +++ b/beike/Shop/Http/Resources/ProductSimple.php @@ -49,6 +49,8 @@ class ProductSimple extends JsonResource 'origin_price_format' => currency_format($masterSku->origin_price), 'category_id' => $this->category_id ?? null, 'in_wishlist' => $this->inCurrentWishlist->id ?? 0, + 'price_setting' => $this->price_setting ?? '', + 'numprices' => numPricesDetail::collection($this->numprices)->jsonSerialize() ?? '', 'images' => array_map(function ($item) { return image_resize($item, 400, 400); diff --git a/resources/beike/admin/views/pages/inquiry/index.blade.php b/resources/beike/admin/views/pages/inquiry/index.blade.php index c75f330a..099d1995 100644 --- a/resources/beike/admin/views/pages/inquiry/index.blade.php +++ b/resources/beike/admin/views/pages/inquiry/index.blade.php @@ -8,7 +8,7 @@ @endif -
+
{{--
--}} {{-- {{ __('common.add') }}--}} @@ -18,7 +18,8 @@ ID - {{ __('common.sku') }} + {{ __('admin/product.products_img') }} + {{ __('admin/product.products_name') }}-{{ __('common.sku') }} {{ __('common.contacts') }} {{ __('common.email') }} {{ __('common.content') }} @@ -30,14 +31,17 @@ @if (count($pages_format)) - @foreach ($pages_format as $page) + @foreach ($pages_format as $pageKey=>$page) {{ $page['id'] }} -
{{ $page['product_sku_sku'] ?? '' }}
+
-
{{ $page['contacts'] ?? '' }}
+ + + +
{{ $page['contacts'] ?? '' }}
{{-- --}} {{-- {{ $page['active'] ? __('common.enable') : __('common.disable') }}--}} @@ -52,8 +56,8 @@ {{ $page['updated_at'] }} @hook('admin.page.list.column_value') -{{-- {{ __('common.edit') }}--}} + @hook('admin.page.list.action') @@ -70,6 +74,72 @@ {{ $pages->links('admin::vendor/pagination/bootstrap-4') }}
+ + + + + +
+ +
+
+ + + @{{ dialog.form.product_name }}-@{{ dialog.form.product_sku_sku}} + + +
+ + + + @{{ dialog.form.contacts }} + + + + @{{ dialog.form.email }} + + + + + + + @{{ dialog.form.content }} + + + + + + + @{{ dialog.form.created_at }} + + + + @{{ dialog.form.updated_at }} + + +
@hook('admin.page.list.content.footer') @@ -77,6 +147,95 @@ @push('footer') - - - - + + + @endpush @section('content') @@ -184,7 +183,11 @@
- + +
+
@@ -210,9 +213,28 @@ - + +
+
+
+
+ +
+
+
{{ $product['name'] }}
+
+
+
+
+ {{-- Cancel--}} diff --git a/themes/default/shared/product.blade.php b/themes/default/shared/product.blade.php index eb40d04a..e8754031 100644 --- a/themes/default/shared/product.blade.php +++ b/themes/default/shared/product.blade.php @@ -21,7 +21,11 @@ data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('shop/products.add_to_cart') }}" - onclick="bk.addCart({sku_id: '{{ $product['sku_id'] }}'}, this)"> + @if ($product['price_setting'] === 'num') + onclick="bk.addCart({sku_id: '{{ $product['sku_id'] }}',quantity: {{$product['numprices'][0]['num']}} }, this)"> + @else + onclick="bk.addCart({sku_id: '{{ $product['sku_id'] }}'}, this)"> + @endif @@ -39,8 +43,12 @@
- 1 pieces - (Min Order) + @if ($product['price_setting'] === 'num') + {{$product['numprices'][0]['num']}} pieces + @else + 1 pieces + @endif + (Min Order)
@if (request('style_list') == 'list') @@ -60,4 +68,4 @@ @endif - \ No newline at end of file +