!151 后台商品添加model和quantity 列表直接修改上下架状态
* cursor-pointer * admin products-list add switch to edit status * ProductResource add model and quantity
This commit is contained in:
parent
1a3b7d134f
commit
df96ffafa5
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@
|
|||
<td>{{ $product['position'] }}</td>
|
||||
@if ($type != 'trashed')
|
||||
<td>
|
||||
<span class="{{ $product['active'] ? 'text-success' : 'text-secondary' }}">
|
||||
{{ $product['active'] ? __('common.enable') : __('common.disable') }}
|
||||
</span>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input cursor-pointer" type="checkbox" role="switch" data-active="{{ $product['active'] ? true : false }}" data-id="{{ $product['id'] }}" @change="turnOnOff($event)" {{ $product['active'] ? 'checked' : '' }}>
|
||||
</div>
|
||||
</td>
|
||||
@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') }}',
|
||||
|
|
|
|||
Loading…
Reference in New Issue