4
0
Fork 0

goods-sku

master
panliang 2022-09-21 14:40:46 +08:00
parent 275b80a1f9
commit 568b551aae
4 changed files with 10 additions and 12 deletions

View File

@ -28,12 +28,4 @@ class Spec extends Field
return $this;
}
protected function formatFieldData($data)
{
// 获取到当前字段值
$value = parent::formatFieldData($data);
return $value ?: [];
}
}

View File

@ -56,7 +56,6 @@ class GoodsSkuController extends Controller
});
}
}
// $grid->column('spec')->view('dcat-admin-goods::grid.attr');
$user = Admin::user();
$grid->showCreateButton($user->can('dcat.admin.goods_sku.create'));
@ -84,6 +83,8 @@ class GoodsSkuController extends Controller
$show->field('price');
$show->field('stock');
$show->field('spec')->view('dcat-admin-goods::goods.grid-spec');
$show->disableDeleteButton();
$show->disableEditButton();
});
return $content
@ -141,6 +142,9 @@ class GoodsSkuController extends Controller
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableResetButton();
$form->disableViewButton();
$form->disableListButton();
$form->disableDeleteButton();
});
}

View File

@ -9,7 +9,7 @@ class GoodsSku extends Model
{
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 = [
'spec' => 'array',

View File

@ -16,7 +16,8 @@
</tr>
</thead>
<tbody>
@foreach($value?:[] as $item)
@if($value)
@foreach($value as $item)
<tr data-id="{{ $item['name'] }}">
<td rowspan="{{count($item['values']) + 2}}" class="editable">{{ $item['name'] }}</td>
</tr>
@ -45,6 +46,7 @@
</td>
</tr>
@endforeach
@endif
<tr>
<td colspan="{{ count($headers) }}">
<input type="text" class="form-control add-attr-input" placeholder="添加 {{ $headers[0] }}">
@ -79,7 +81,7 @@
element.on('click', '.add-attr-button', function () {
var value = $('.add-attr-input').val()
if (!value) {
return Dcat.swal.warning(`请填写 ${headers.name}`)
return Dcat.swal.warning(`请填写 ${headers[0]}`)
}
addGroup(value)