diff --git a/resources/beike/admin/views/pages/attribute_group/index.blade.php b/resources/beike/admin/views/pages/attribute_group/index.blade.php new file mode 100644 index 00000000..c86f72c2 --- /dev/null +++ b/resources/beike/admin/views/pages/attribute_group/index.blade.php @@ -0,0 +1,161 @@ +@extends('admin::layouts.master') + +@section('title', __('admin/attribute_groups.index')) + +@section('content') +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
ID{{ __('common.name') }}{{ __('common.created_at') }}{{ __('common.action') }}
@{{ group.id }}@{{ group.description?.name || '' }}@{{ group.created_at }} + + +
+
+
+ + + + + + + + + + + + + + + +
+ {{ __('common.save') }} + {{ __('common.cancel') }} +
+
+
+
+
+@endsection + +@push('footer') + +@endpush diff --git a/resources/beike/admin/views/pages/attributes/form.blade.php b/resources/beike/admin/views/pages/attributes/form.blade.php new file mode 100644 index 00000000..356003f6 --- /dev/null +++ b/resources/beike/admin/views/pages/attributes/form.blade.php @@ -0,0 +1,223 @@ +@extends('admin::layouts.master') + +@section('title', __('admin/attribute.index')) + +@section('content') +
+
+ + + +
+ + + + + + + + + + + + + + + + + + {{ __('common.submit') }} + +
+
+ + +
+ + + + + + {{-- --}} + + + + + + + + + + +
ID{{ __('admin/attribute.attribute_value') }}排序{{ __('common.action') }}
@{{ item.id }}@{{ item.description?.name || '' }} + + +
+
+
+
+
+
+ + + + + + + + + + + +
+ {{ __('common.save') }} + {{ __('common.cancel') }} +
+
+
+
+
+@endsection + +@push('footer') + +@endpush diff --git a/resources/beike/admin/views/pages/attributes/index.blade.php b/resources/beike/admin/views/pages/attributes/index.blade.php new file mode 100644 index 00000000..e860f4a9 --- /dev/null +++ b/resources/beike/admin/views/pages/attributes/index.blade.php @@ -0,0 +1,177 @@ +@extends('admin::layouts.master') + +@section('title', __('admin/attribute.index')) + +@section('content') +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
{{ __('common.id') }}{{ __('common.name') }}{{ __('admin/attribute_groups.index') }}{{ __('common.created_at') }}{{ __('common.action') }}
@{{ item.id }}@{{ item.name }}@{{ item.attribute_group_name }}@{{ item.created_at }} + {{ __('common.edit') }} + +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ {{ __('common.save') }} + {{ __('common.cancel') }} +
+
+
+
+
+@endsection + +@push('footer') + +@endpush diff --git a/resources/beike/admin/views/pages/products/form/form.blade.php b/resources/beike/admin/views/pages/products/form/form.blade.php index 0cde2a15..8eefa885 100644 --- a/resources/beike/admin/views/pages/products/form/form.blade.php +++ b/resources/beike/admin/views/pages/products/form/form.blade.php @@ -31,6 +31,9 @@ +
@@ -266,6 +269,51 @@
+
+ +
+ + + + + + + + + + + + + +
{{ __('admin/attribute.index') }}{{ __('admin/attribute.attribute_value') }}
+ + + + + + + +
+
+
+
@@ -287,7 +335,7 @@ { required: true, message: '{{ __('common.error_input_required') }}', trigger: 'blur' }, ]" > - + @@ -297,6 +345,29 @@ + + + + + + + + + + + +
+ {{ __('common.save') }} + {{ __('common.cancel') }} +
+
+
+
@@ -310,6 +381,7 @@ current_language_code: '{{ locale() }}', isMove: false, form: { + attributes: @json(old('pickups', $product_attributes) ?? []), images: @json($product->images ?? []), model: @json($product->skus[0]['model'] ?? ''), price: @json($product->skus[0]['price'] ?? ''), @@ -319,6 +391,7 @@ variables: @json($product->variables ?? []), skus: @json($product->skus ?? []), }, + source: { variables: @json($product->variables ?? []), languages: @json($languages ?? []), @@ -337,6 +410,14 @@ }, }, + attributeDialog: { + show: false, + index: null, + form: { + name: {}, + } + }, + rules: {} }, computed: { @@ -417,7 +498,7 @@ this.$refs[form].validate((valid) => { if (!valid) { - this.$message.error('请检查表单是否填写正确'); + this.$message.error('{{ __('common.error_form') }}'); return; } @@ -502,6 +583,65 @@ this.dialogVariables.variantIndex = variantIndex; }, + addAttribute() { + this.form.attributes.push({attribute:{id:'',name:''}, attribute_value: {id:'',name:''}}) + }, + + attributeQuerySearch(keyword, cb) { + $http.get('attributes/autocomplete?name=' + encodeURIComponent(keyword), null, {hload:true}).then((res) => { + cb(res.data); + }) + }, + + attributeValueQuerySearch(keyword, cb, index) { + $http.get(`attributes/${this.form.attributes[index].attribute.id}/values/autocomplete?name=${encodeURIComponent(keyword)}`, null, {hload:true}).then((res) => { + res.data.push({id: 'add', name: '{{ __('admin/attribute.add_attribute') }}'}) + cb(res.data); + }) + }, + + attributeHandleSelect(item, index, type) { + if (type == 'attribute' && item.id != this.form.attributes[index].attribute.id) { + this.form.attributes[index].attribute_value.name = '' + this.form.attributes[index].attribute_value.id = '' + } + + if (item.id == 'add') { + this.attributeDialog.show = true; + this.attributeDialog.index = index; + this.form.attributes[index].attribute_value.name = '' + return; + } + + this.form.attributes[index][type].name = item.name + this.form.attributes[index][type].id = item.id + }, + + attributeSubmit(form) { + const self = this; + + this.$refs[form].validate((valid) => { + if (!valid) { + this.$message.error('{{ __('common.error_form') }}'); + return; + } + + const id = this.form.attributes[this.attributeDialog.index].attribute.id; + + $http.post(`attributes/${id}/values`, this.attributeDialog.form).then((res) => { + this.form.attributes[this.attributeDialog.index].attribute_value.id = res.data.id + this.form.attributes[this.attributeDialog.index].attribute_value.name = res.data.description.name + this.attributeDialog.show = false + }) + }); + }, + + attributeCloseDialog(form) { + this.$refs[form].resetFields(); + this.attributeDialog.form.name = {} + this.attributeDialog.show = false + }, + remakeSkus() { const combos = makeVariableIndexes(); diff --git a/resources/beike/shop/default/css/page-product.scss b/resources/beike/shop/default/css/page-product.scss index 5c08deb2..52219b0a 100644 --- a/resources/beike/shop/default/css/page-product.scss +++ b/resources/beike/shop/default/css/page-product.scss @@ -230,4 +230,24 @@ body.page-product { } } } + + .attribute-table { + tr { + td:first-of-type { + @media (min-width: 768px) { + width: 20%; + } + + @media (max-width: 768px) { + width: 40%; + } + } + + &:nth-child(2n+1) { + td { + background-color: rgba(249, 172, 17, .05); + } + } + } + } } \ No newline at end of file diff --git a/resources/lang/de/admin/attribute.php b/resources/lang/de/admin/attribute.php new file mode 100644 index 00000000..3ceefaff --- /dev/null +++ b/resources/lang/de/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'attribut', + 'attribute_info' => 'Attributinformationen', + 'create_at' => 'Attribut erstellen', + 'attribute_value' => 'Attributwert', + 'set_attribute' => 'Konfigurationsattribut', + 'add_attribute' => 'Attributwert hinzufügen', + 'before_attribute' => 'Bitte zuerst das linke Attribut auswählen', +]; diff --git a/resources/lang/de/admin/attribute_groups.php b/resources/lang/de/admin/attribute_groups.php new file mode 100644 index 00000000..79c5d527 --- /dev/null +++ b/resources/lang/de/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'Attributgruppe', + 'create_at_groups' => 'Attributgruppe erstellen', +]; diff --git a/resources/lang/en/admin/attribute.php b/resources/lang/en/admin/attribute.php new file mode 100644 index 00000000..d68dd073 --- /dev/null +++ b/resources/lang/en/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'Attribute', + 'attribute_info' => 'Attribute information', + 'create_at' => 'Create attribute', + 'attribute_value' => 'Cttribute value', + 'set_attribute' => 'Configuration attribute', + 'add_attribute' => 'Add attribute value', + 'before_attribute' => 'Please select the left attribute first', +]; diff --git a/resources/lang/en/admin/attribute_groups.php b/resources/lang/en/admin/attribute_groups.php new file mode 100644 index 00000000..35c8a56e --- /dev/null +++ b/resources/lang/en/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'Attribute group', + 'create_at_groups' => 'Create attribute group', +]; diff --git a/resources/lang/es/admin/attribute.php b/resources/lang/es/admin/attribute.php new file mode 100644 index 00000000..1fdeb929 --- /dev/null +++ b/resources/lang/es/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'atributo', + 'attribute_info' => 'información del atributo', + 'create_at' => 'crear atributo', + 'attribute_value' => 'valor de atributo', + 'set_attribute' => 'atributo de configuración', + 'add_attribute' => 'agregar valor de atributo', + 'before_attribute' => 'Seleccione primero el atributo de la izquierda', +]; diff --git a/resources/lang/es/admin/attribute_groups.php b/resources/lang/es/admin/attribute_groups.php new file mode 100644 index 00000000..26f7ac18 --- /dev/null +++ b/resources/lang/es/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'grupo de atributos', + 'create_at_groups' => 'crear grupo de atributos', +]; diff --git a/resources/lang/fr/admin/attribute.php b/resources/lang/fr/admin/attribute.php new file mode 100644 index 00000000..555f48b1 --- /dev/null +++ b/resources/lang/fr/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'attribut', + 'attribute_info' => 'informations d\'attribut', + 'create_at' => 'créer un attribut', + 'attribute_value' => 'valeur d\'attribut', + 'set_attribute' => 'attribut de configuration', + 'add_attribute' => 'ajouter une valeur d\'attribut', + 'before_attribute' => 'Veuillez d\'abord sélectionner l\'attribut de gauche', +]; diff --git a/resources/lang/fr/admin/attribute_groups.php b/resources/lang/fr/admin/attribute_groups.php new file mode 100644 index 00000000..e33ffed7 --- /dev/null +++ b/resources/lang/fr/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'groupe d\'attributs', + 'create_at_groups' => 'créer un groupe d\'attributs', +]; diff --git a/resources/lang/it/admin/attribute.php b/resources/lang/it/admin/attribute.php new file mode 100644 index 00000000..d3d9d20e --- /dev/null +++ b/resources/lang/it/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'attributo', + 'attribute_info' => 'informazioni sugli attributi', + 'create_at' => 'crea attributo', + 'attribute_value' => 'valore attributo', + 'set_attribute' => 'attributo di configurazione', + 'add_attribute' => 'aggiungi valore attributo', + 'before_attribute' => 'Si prega di selezionare prima l\'attributo di sinistra', +]; diff --git a/resources/lang/it/admin/attribute_groups.php b/resources/lang/it/admin/attribute_groups.php new file mode 100644 index 00000000..d5d7b07a --- /dev/null +++ b/resources/lang/it/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'gruppo di attributi', + 'create_at_groups' => 'crea gruppo di attributi', +]; diff --git a/resources/lang/ja/admin/attribute.php b/resources/lang/ja/admin/attribute.php new file mode 100644 index 00000000..883911b6 --- /dev/null +++ b/resources/lang/ja/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '属性', + 'attribute_info' => '属性情報', + 'create_at' => '属性を作成', + 'attribute_value' => '属性値', + 'set_attribute' => '構成属性', + 'add_attribute' => '属性値を追加', + 'before_attribute' => '最初に左の属性を選択してください', +]; diff --git a/resources/lang/ja/admin/attribute_groups.php b/resources/lang/ja/admin/attribute_groups.php new file mode 100644 index 00000000..9240c953 --- /dev/null +++ b/resources/lang/ja/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '属性グループ', + 'create_at_groups' => '属性グループの作成', +]; diff --git a/resources/lang/ru/admin/attribute.php b/resources/lang/ru/admin/attribute.php new file mode 100644 index 00000000..c7e7acc9 --- /dev/null +++ b/resources/lang/ru/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'атрибут', + 'attribute_info' => 'информация об атрибутах', + 'create_at' => 'создать атрибут', + 'attribute_value' => 'значение атрибута', + 'set_attribute' => 'атрибут конфигурации', + 'add_attribute' => 'добавить значение атрибута', + 'before_attribute' => 'Сначала выберите левый атрибут', +]; diff --git a/resources/lang/ru/admin/attribute_groups.php b/resources/lang/ru/admin/attribute_groups.php new file mode 100644 index 00000000..0724624b --- /dev/null +++ b/resources/lang/ru/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => 'группа атрибутов', + 'create_at_groups' => 'создать группу атрибутов', +]; diff --git a/resources/lang/zh_cn/admin/attribute.php b/resources/lang/zh_cn/admin/attribute.php new file mode 100644 index 00000000..9792479e --- /dev/null +++ b/resources/lang/zh_cn/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '属性', + 'attribute_info' => '属性信息', + 'create_at' => '创建属性', + 'attribute_value' => '属性值', + 'set_attribute' => '配置属性', + 'add_attribute' => '添加属性值', + 'before_attribute' => '请先选择左边属性', +]; diff --git a/resources/lang/zh_cn/admin/attribute_groups.php b/resources/lang/zh_cn/admin/attribute_groups.php new file mode 100644 index 00000000..a7d81c90 --- /dev/null +++ b/resources/lang/zh_cn/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '属性组', + 'create_at_groups' => '创建属性组', +]; diff --git a/resources/lang/zh_hk/admin/attribute.php b/resources/lang/zh_hk/admin/attribute.php new file mode 100644 index 00000000..bce843a6 --- /dev/null +++ b/resources/lang/zh_hk/admin/attribute.php @@ -0,0 +1,20 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '屬性', + 'attribute_info' => '屬性信息', + 'create_at' => '創建屬性', + 'attribute_value' => '屬性值', + 'set_attribute' => '配置屬性', + 'add_attribute' => '添加屬性值', + 'before_attribute' => '請先選擇左邊屬性', +]; diff --git a/resources/lang/zh_hk/admin/attribute_groups.php b/resources/lang/zh_hk/admin/attribute_groups.php new file mode 100644 index 00000000..94e4dd42 --- /dev/null +++ b/resources/lang/zh_hk/admin/attribute_groups.php @@ -0,0 +1,15 @@ + + * @created 2022-08-02 14:22:41 + * @modified 2022-08-02 14:22:41 + */ + +return [ + 'index' => '屬性組', + 'create_at_groups' => '創建屬性組', +]; diff --git a/themes/default/product.blade.php b/themes/default/product.blade.php index 463c5d94..a2a6c4ae 100644 --- a/themes/default/product.blade.php +++ b/themes/default/product.blade.php @@ -136,14 +136,31 @@
-
+
{!! $product['description'] !!}
+
+ + + @foreach ($product['attributes'] as $item) + + + + + @endforeach + +
{{ $item['attribute'] }}{{ $item['attribute_value'] }}
+