!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);
|
return image_resize($image);
|
||||||
}, $this->images ?? []),
|
}, $this->images ?? []),
|
||||||
'name' => $this->description->name ?? '',
|
'name' => $this->description->name ?? '',
|
||||||
|
'model' => $masterSku->model,
|
||||||
|
'quantity' => $masterSku->quantity,
|
||||||
'price_formatted' => currency_format($masterSku->price),
|
'price_formatted' => currency_format($masterSku->price),
|
||||||
'active' => $this->active,
|
'active' => $this->active,
|
||||||
'position' => $this->position,
|
'position' => $this->position,
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,9 @@
|
||||||
<td>{{ $product['position'] }}</td>
|
<td>{{ $product['position'] }}</td>
|
||||||
@if ($type != 'trashed')
|
@if ($type != 'trashed')
|
||||||
<td>
|
<td>
|
||||||
<span class="{{ $product['active'] ? 'text-success' : 'text-secondary' }}">
|
<div class="form-check form-switch">
|
||||||
{{ $product['active'] ? __('common.enable') : __('common.disable') }}
|
<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' : '' }}>
|
||||||
</span>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
@hook('admin.product.list.column_value')
|
@hook('admin.product.list.column_value')
|
||||||
|
|
@ -203,6 +203,17 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
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() {
|
batchDelete() {
|
||||||
this.$confirm('{{ __('admin/product.confirm_batch_product') }}', '{{ __('common.text_hint') }}', {
|
this.$confirm('{{ __('admin/product.confirm_batch_product') }}', '{{ __('common.text_hint') }}', {
|
||||||
confirmButtonText: '{{ __('common.confirm') }}',
|
confirmButtonText: '{{ __('common.confirm') }}',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue