diff --git a/beike/Admin/Http/Resources/ProductResource.php b/beike/Admin/Http/Resources/ProductResource.php index b75a0cab..7e03794a 100644 --- a/beike/Admin/Http/Resources/ProductResource.php +++ b/beike/Admin/Http/Resources/ProductResource.php @@ -24,6 +24,8 @@ class ProductResource extends JsonResource return image_resize($image); }, $this->images ?? []), 'name' => $this->description->name ?? '', + 'model' => $masterSku->model, + 'quantity' => $masterSku->quantity, 'price_formatted' => currency_format($masterSku->price), 'active' => $this->active, 'position' => $this->position, diff --git a/resources/beike/admin/views/pages/products/index.blade.php b/resources/beike/admin/views/pages/products/index.blade.php index be35503d..472b618a 100644 --- a/resources/beike/admin/views/pages/products/index.blade.php +++ b/resources/beike/admin/views/pages/products/index.blade.php @@ -135,9 +135,9 @@ {{ $product['position'] }} @if ($type != 'trashed') - - {{ $product['active'] ? __('common.enable') : __('common.disable') }} - +
+ +
@endif @hook('admin.product.list.column_value') @@ -203,6 +203,17 @@ }, methods: { + turnOnOff() { + let id = event.currentTarget.getAttribute("data-id"); + let checked = event.currentTarget.getAttribute("data-active"); + let type = true; + if (checked) type = false; + $http.post('products/status', {ids: [id], status: type}).then((res) => { + layer.msg(res.message) + location.reload(); + }) + }, + batchDelete() { this.$confirm('{{ __('admin/product.confirm_batch_product') }}', '{{ __('common.text_hint') }}', { confirmButtonText: '{{ __('common.confirm') }}',