goods-sku
parent
275b80a1f9
commit
568b551aae
|
|
@ -28,12 +28,4 @@ class Spec extends Field
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function formatFieldData($data)
|
|
||||||
{
|
|
||||||
// 获取到当前字段值
|
|
||||||
$value = parent::formatFieldData($data);
|
|
||||||
|
|
||||||
return $value ?: [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ class GoodsSkuController extends Controller
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $grid->column('spec')->view('dcat-admin-goods::grid.attr');
|
|
||||||
|
|
||||||
$user = Admin::user();
|
$user = Admin::user();
|
||||||
$grid->showCreateButton($user->can('dcat.admin.goods_sku.create'));
|
$grid->showCreateButton($user->can('dcat.admin.goods_sku.create'));
|
||||||
|
|
@ -84,6 +83,8 @@ class GoodsSkuController extends Controller
|
||||||
$show->field('price');
|
$show->field('price');
|
||||||
$show->field('stock');
|
$show->field('stock');
|
||||||
$show->field('spec')->view('dcat-admin-goods::goods.grid-spec');
|
$show->field('spec')->view('dcat-admin-goods::goods.grid-spec');
|
||||||
|
$show->disableDeleteButton();
|
||||||
|
$show->disableEditButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
return $content
|
return $content
|
||||||
|
|
@ -141,6 +142,9 @@ class GoodsSkuController extends Controller
|
||||||
$form->disableEditingCheck();
|
$form->disableEditingCheck();
|
||||||
$form->disableViewCheck();
|
$form->disableViewCheck();
|
||||||
$form->disableResetButton();
|
$form->disableResetButton();
|
||||||
|
$form->disableViewButton();
|
||||||
|
$form->disableListButton();
|
||||||
|
$form->disableDeleteButton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class GoodsSku extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'goods_sku';
|
protected $table = 'goods_sku';
|
||||||
|
|
||||||
protected $fillable = ['sn', 'goods_id', 'name', 'price', 'vip_price', 'stock', 'spec', 'weight', 'volume', 'shipping_tmp_id'];
|
protected $fillable = ['sn', 'goods_id', 'name', 'price', 'vip_price', 'stock', 'spec', 'weight', 'volume', 'shipping_tmp_id', 'score_'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'spec' => 'array',
|
'spec' => 'array',
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($value?:[] as $item)
|
@if($value)
|
||||||
|
@foreach($value as $item)
|
||||||
<tr data-id="{{ $item['name'] }}">
|
<tr data-id="{{ $item['name'] }}">
|
||||||
<td rowspan="{{count($item['values']) + 2}}" class="editable">{{ $item['name'] }}</td>
|
<td rowspan="{{count($item['values']) + 2}}" class="editable">{{ $item['name'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -45,6 +46,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="{{ count($headers) }}">
|
<td colspan="{{ count($headers) }}">
|
||||||
<input type="text" class="form-control add-attr-input" placeholder="添加 {{ $headers[0] }}">
|
<input type="text" class="form-control add-attr-input" placeholder="添加 {{ $headers[0] }}">
|
||||||
|
|
@ -79,7 +81,7 @@
|
||||||
element.on('click', '.add-attr-button', function () {
|
element.on('click', '.add-attr-button', function () {
|
||||||
var value = $('.add-attr-input').val()
|
var value = $('.add-attr-input').val()
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return Dcat.swal.warning(`请填写 ${headers.name}`)
|
return Dcat.swal.warning(`请填写 ${headers[0]}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
addGroup(value)
|
addGroup(value)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue