v1 修改完成

This commit is contained in:
liqianjin 2023-05-30 11:56:47 +08:00
parent 18a314f357
commit 66d08c1654
13 changed files with 263 additions and 21 deletions

View File

@ -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());

View File

@ -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);

View File

@ -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

View File

@ -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),
];

View File

@ -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() ?? '',
];
}

View File

@ -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);

View File

@ -8,7 +8,7 @@
<x-admin-alert type="danger" msg="{{ $errors->first('error') }}" class="mt-4" />
@endif
<div class="card">
<div id="tax-classes-app" class="card">
<div class="card-body h-min-600">
{{-- <div class="d-flex justify-content-between mb-4">--}}
{{-- <a href="{{ admin_route('pages.create') }}" class="btn btn-primary">{{ __('common.add') }}</a>--}}
@ -18,7 +18,8 @@
<thead>
<tr>
<th>ID</th>
<th>{{ __('common.sku') }}</th>
<th>{{ __('admin/product.products_img') }}</th>
<th>{{ __('admin/product.products_name') }}-{{ __('common.sku') }}</th>
<th>{{ __('common.contacts') }}</th>
<th>{{ __('common.email') }}</th>
<th>{{ __('common.content') }}</th>
@ -30,14 +31,17 @@
</thead>
<tbody>
@if (count($pages_format))
@foreach ($pages_format as $page)
@foreach ($pages_format as $pageKey=>$page)
<tr>
<td>{{ $page['id'] }}</td>
<td>
<div >{{ $page['product_sku_sku'] ?? '' }}</div>
<div class="wh-60 border d-flex justify-content-between align-items-center"><img src="{{ $page['product_images'][0]['preview'] ?? 'image/placeholder.png' }}" class="img-fluid"></div>
</td>
<td>
<div title="">{{ $page['contacts'] ?? '' }}</div><!-- <a class="text-dark" href="{/{ shop_route('pages.show', $page['id']) }}" target="_blank">{/{ $page['title_format'] ?? '' }}</a> -->
<div ><a class="text-dark" href="{{ shop_route('products.show', $page['product_id']) }}" target="_blank">{{ $page['product_name'] ?? '' }}-{{ $page['product_sku_sku'] ?? '' }}</a></div>
</td>
<td>
<div title="">{{ $page['contacts'] ?? '' }}</div><!-- -->
</td>
{{-- <td class="{{ $page['active'] ? 'text-success' : 'text-secondary' }}">--}}
{{-- {{ $page['active'] ? __('common.enable') : __('common.disable') }}--}}
@ -52,8 +56,8 @@
<td>{{ $page['updated_at'] }}</td>
@hook('admin.page.list.column_value')
<td class="text-end">
{{-- <a href="{{ admin_route('pages.edit', [$page['id']]) }}"--}}
{{-- class="btn btn-outline-secondary btn-sm">{{ __('common.edit') }}</a>--}}
<button @click="checkedCreate('edit', {{$pageKey}})"
class="btn btn-outline-secondary btn-sm">{{ __('common.view') }}</button>
<button class="btn btn-outline-danger btn-sm delete-btn" type='button'
data-id="{{ $page['id'] }}">{{ __('common.delete') }}</button>
@hook('admin.page.list.action')
@ -70,6 +74,72 @@
{{ $pages->links('admin::vendor/pagination/bootstrap-4') }}
</div>
<el-dialog title="{{ __('admin/page.inquiry') }}" :visible.sync="dialog.show" width="870px"
@close="closeCustomersDialog('form')" :close-on-click-modal="false">
<el-descriptions class="margin-top" :column="2" :size="size" border>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
{{ __('admin/product.products_img') }}
</template>
<div class="wh-100 border d-flex justify-content-between align-items-center">
<img :src="dialog.form.product_images.length !== 0 ? dialog.form.product_images[0].preview : 'image/placeholder.png'" class="img-fluid">
</div>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
{{ __('admin/product.products_name') }}-{{ __('common.sku') }}
</template>
<a class="text-dark" href="/products/@{{ dialog.form.product_id }}" target="_blank">@{{ dialog.form.product_name }}-@{{ dialog.form.product_sku_sku}}</a>
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" :column="2" :size="size" border>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-tickets"></i>
{{ __('common.contacts') }}
</template>
@{{ dialog.form.contacts }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-mobile-phone"></i>
{{ __('common.email') }}
</template>
@{{ dialog.form.email }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" :column="1" :size="size" border>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-tickets"></i>
{{ __('common.content') }}
</template>
@{{ dialog.form.content }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" :column="2" :size="size" border>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
{{ __('common.created_at') }}
</template>
@{{ dialog.form.created_at }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
{{ __('common.updated_at') }}
</template>
@{{ dialog.form.updated_at }}
</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
@hook('admin.page.list.content.footer')
@ -77,6 +147,95 @@
@push('footer')
<script>
new Vue({
el: '#tax-classes-app',
data: {
size: '',
currencies: @json($pages_format ?? []),
dialog: {
show: false,
index: null,
type: 'add',
form: {
product_images: [],
product_id: '',
product_name: '',
product_sku_sku: '',
contacts: '',
email: '',
content: '',
created_at: '',
updated_at: '',
},
},
rules: {
name: [{required: true,message: '{{ __('common.error_required', ['name' => __('common.name')]) }}', trigger: 'blur'}, ],
code: [{required: true,message: '{{ __('common.error_required', ['name' => __('currency.code')]) }}', trigger: 'blur'}, ],
value: [{required: true,message: '{{ __('common.error_required', ['name' => __('currency.value')]) }}',trigger: 'blur'}, ],
decimal_place: [{required: true,message: '{{ __('common.error_required', ['name' => __('currency.decimal_place')]) }}',trigger: 'blur'}, ],
}
},
methods: {
checkedCreate(type, index) {
this.dialog.show = true
this.dialog.type = type
this.dialog.index = index
if (type == 'edit') {
this.dialog.form = JSON.parse(JSON.stringify(this.currencies[index]))
}
},
addFormSubmit(form) {
const self = this;
const type = this.dialog.type == 'add' ? 'post' : 'put';
const url = this.dialog.type == 'add' ? 'currencies' : 'currencies/' + this.dialog.form.id;
this.$refs[form].validate((valid) => {
if (!valid) {
this.$message.error('{{ __('common.error_form') }}');
return;
}
$http[type](url, this.dialog.form).then((res) => {
this.$message.success(res.message);
if (this.dialog.type == 'add') {
this.currencies.push(res.data)
} else {
this.currencies[this.dialog.index] = res.data
}
this.dialog.show = false
})
});
},
deleteCustomer(id, index) {
const self = this;
this.$confirm('{{ __('common.confirm_delete') }}', '{{ __('common.text_hint') }}', {
confirmButtonText: '{{ __('common.confirm') }}',
cancelButtonText: '{{ __('common.cancel') }}',
type: 'warning'
}).then(() => {
$http.delete('currencies/' + id).then((res) => {
this.$message.success(res.message);
self.currencies.splice(index, 1)
})
}).catch(()=>{})
},
closeCustomersDialog(form) {
// this.$refs[form].resetFields();
Object.keys(this.dialog.form).forEach(key => this.dialog.form[key] = '')
// this.dialog.show = false
}
}
})
$('.delete-btn').click(function(event) {
const id = $(this).data('id');
const self = $(this);

View File

@ -34,6 +34,8 @@ return [
'customer_group' => 'Customer Groups',
'customer' => 'Customers',
'page' => 'Content',
'inquiry' => 'Inquiry',
'page_category' => 'Page Category',
'setting' => 'Settings',
'plugin' => 'Plugin',
@ -61,6 +63,8 @@ return [
'regions_index' => 'Regions',
'tax_rates_index' => 'Tax Rates',
'pages_index' => 'Articles',
'inquiry_index' => 'Inquiry',
'page_categories_index' => 'Catalogs',
'tax_classes_index' => 'Tax Classes',
'currencies_index' => 'Currencies',

View File

@ -11,6 +11,8 @@
return [
'products_index' => 'Index',
'products_name' => 'Products Name',
'products_img' => 'Products Image',
'products_create' => 'Create',
'products_show' => 'Detail',
'products_update' => 'Edit',

View File

@ -34,6 +34,7 @@ return [
'customer_group' => '客户组管理',
'customer' => '客户管理',
'page' => '文章管理',
'inquiry' => '询盘管理',
'page_category' => '文章分类',
'setting' => '系统设置',
'plugin' => '插件管理',
@ -65,6 +66,7 @@ return [
'languages_index' => '语言管理',
'design_index' => '首页装修',
'pages_index' => '文章管理',
'inquiry_index' => '询盘管理',
'page_categories_index' => '文章分类',
'design_footer_index' => '页尾装修',
'design_menu_index' => '导航配置',

View File

@ -11,6 +11,8 @@
return [
'products_index' => '商品列表',
'products_name' => '商品名称',
'products_img' => '商品图片',
'products_create' => '创建商品',
'products_show' => '商品详情',
'products_update' => '更新商品',

View File

@ -9,10 +9,9 @@
<script src="{{ asset('vendor/swiper/swiper-bundle.min.js') }}"></script>
<script src="{{ asset('vendor/zoom/jquery.zoom.min.js') }}"></script>
<link rel="stylesheet" href="{{ asset('vendor/swiper/swiper-bundle.min.css') }}">
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="{{ asset('vendor/element-ui/2.15.6/js.js') }}"></script>
<link rel="stylesheet" href="{{ asset('vendor/element-ui/2.15.6/css.css') }}">
@endpush
@section('content')
@ -184,7 +183,11 @@
</div>
</div>
<!-- 弹出层 -->
<el-dialog title="Inquiry" :visible.sync="centerDialogVisable" width="400px" center>
<el-dialog title="Inquiry" :visible.sync="centerDialogVisable" width="700px" center>
<div class="root" style="
display: flex;">
<div class="left" style="
flex: 4;">
<el-form :model="registerForm" ref="registerForm" label-width="90px" :rules="rules">
<!-- 弹出层歌手名列 -->
<el-form-item prop="contacts" label="Contacts" size="mini">
@ -210,9 +213,28 @@
<el-input v-model="registerForm.email" placeholder="E-mail"></el-input>
</el-form-item>
<el-form-item prop="content" label="Content" size="mini">
<el-input v-model="registerForm.content" placeholder="Content" type="textarea"></el-input>
<el-input v-model="registerForm.content" placeholder="Content" type="textarea" :rows="10" ></el-input>
</el-form-item>
</el-form>
</div>
<div class="right" style="
flex: 2;
display: flex;
align-items: center;
}">
<div class="product" style="
margin: -35px 10px 0 10px;">
<div class="product-image">
<img :src="images.length ? images[0].preview : '{{ asset('image/placeholder.png') }}'" class="img-fluid">
</div>
<div class="product-info" style="
margin: 5px 5px 0 5px;">
<div class="product-name">{{ $product['name'] }}</div>
</div>
</div>
</div>
</div>
<!-- 取消,确定按钮点击事件 -->
<span slot="footer">
{{-- <el-button size="mini" @click="centerDialogVisable = false">Cancel</el-button>--}}

View File

@ -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
<i class="bi bi-cart"></i>
</button>
</div>
@ -39,8 +43,12 @@
</div>
<!--yt修改-->
<div class="product-price">
<span class="price-new">1 pieces</span>
<span style="color:#aaa;margin-left:4px">(Min Order)</span>
@if ($product['price_setting'] === 'num')
<span class="price-new">{{$product['numprices'][0]['num']}} pieces</span>
@else
<span class="price-new">1 pieces</span>
@endif
<span style="color:#aaa;margin-left:4px">(Min Order)</span>
</div>
@if (request('style_list') == 'list')
@ -60,4 +68,4 @@
</div>
@endif
</div>
</div>
</div>