diff --git a/beike/Shop/Http/Controllers/CategoryController.php b/beike/Shop/Http/Controllers/CategoryController.php index 65e2b275..7e760ced 100644 --- a/beike/Shop/Http/Controllers/CategoryController.php +++ b/beike/Shop/Http/Controllers/CategoryController.php @@ -5,6 +5,7 @@ namespace Beike\Shop\Http\Controllers; use Beike\Models\Category; use Beike\Repositories\CategoryRepo; use Beike\Repositories\ProductRepo; +use Beike\Shop\Http\Resources\CategoryDetail; use Beike\Shop\Http\Resources\ProductSimple; use Illuminate\Http\Request; @@ -28,6 +29,7 @@ class CategoryController extends Controller $data = [ 'all_categories' => CategoryRepo::getTwoLevelCategories(), 'category' => $category, + 'children' => CategoryDetail::collection($category->activeChildren)->jsonSerialize(), 'filter_data' => [ 'attr' => ProductRepo::getFilterAttribute($filterData), 'price' => ProductRepo::getFilterPrice($filterData), diff --git a/resources/beike/admin/css/_bootstrap-extra.scss b/resources/beike/admin/css/_bootstrap-extra.scss index 35e9ab1a..9e1b54f2 100644 --- a/resources/beike/admin/css/_bootstrap-extra.scss +++ b/resources/beike/admin/css/_bootstrap-extra.scss @@ -28,7 +28,7 @@ hr.horizontal.dark { color: #dc3545 !important; font-weight: bold; position: relative; - padding-left: 17px; + padding-left: 17px !important; &:before { content: '\F333'; diff --git a/resources/beike/admin/views/pages/file_manager/index.blade.php b/resources/beike/admin/views/pages/file_manager/index.blade.php index 4c7bad61..85d44934 100644 --- a/resources/beike/admin/views/pages/file_manager/index.blade.php +++ b/resources/beike/admin/views/pages/file_manager/index.blade.php @@ -10,6 +10,7 @@ {{-- --}} + @@ -21,6 +22,20 @@ @endif beike filemanager + 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 2410a0ff..9784dfde 100644 --- a/resources/beike/admin/views/pages/products/form/form.blade.php +++ b/resources/beike/admin/views/pages/products/form/form.blade.php @@ -409,7 +409,7 @@ - + skus[0]['sku'] ?? ''), status: @json($product->skus[0]['status'] ?? false), variables: @json($product->variables ?? []), - skus: @json($product->skus ?? []), + skus: @json(old('skus', $product->skus) ?? []), }, variablesBatch: { @@ -588,10 +588,6 @@ if (!this.editing.isVariable) { this.source.variables = []; } - - setTimeout(() => { - $('form#app').submit(); - }, 0); }, relationsQuerySearch(keyword, cb) { @@ -656,48 +652,44 @@ batchSettingVariant() { // 要修改的 skuIndex 下标 let setSkuIndex = []; + const skus = JSON.parse(JSON.stringify(this.form.skus)); - this.form.skus.forEach((sku, skuIndex) => { - this.variablesBatch.variables.forEach((variantIndex, index) => { - if (variantIndex !== '') { - // 根据 variantIndex, index,修改 sku.variants[index] 的值 - if (sku.variants[index] == variantIndex) { - setSkuIndex.push(skuIndex); - } - - return; - } - - // 如果 variantIndex 全部为空,就把所有的 skuIndex 都加入到 setSkuIndex 中 - if (this.variablesBatch.variables.every(v => v === '')) { - setSkuIndex.push(skuIndex); + skus.forEach((sku, skuIndex) => { + this.variablesBatch.variables.forEach((v, i) => { + if (v === '') { + // sku.variants 数据中 i 的值修改为 ‘’ + sku.variants[i] = ''; } }) - // 修改 skuIndex 下标对应的 sku - setSkuIndex.forEach((index) => { - if (this.variablesBatch.model) { - this.form.skus[index].model = this.variablesBatch.model + '-' + (index + 1); - } - if (this.variablesBatch.sku) { - this.form.skus[index].sku = this.variablesBatch.sku + '-' + (index + 1); - } - if (this.variablesBatch.image) { - this.form.skus[index].images = [this.variablesBatch.image]; - } - if (this.variablesBatch.price) { - this.form.skus[index].price = this.variablesBatch.price; - } - if (this.variablesBatch.origin_price) { - this.form.skus[index].origin_price = this.variablesBatch.origin_price; - } - if (this.variablesBatch.cost_price) { - this.form.skus[index].cost_price = this.variablesBatch.cost_price; - } - if (this.variablesBatch.quantity) { - this.form.skus[index].quantity = this.variablesBatch.quantity; - } - }) + if (this.variablesBatch.variables.toString() === sku.variants.toString()) { + setSkuIndex.push(skuIndex); + } + }) + + // 修改 skuIndex 下标对应的 sku + setSkuIndex.forEach((index) => { + if (this.variablesBatch.model) { + this.form.skus[index].model = this.variablesBatch.model + '-' + (index + 1); + } + if (this.variablesBatch.sku) { + this.form.skus[index].sku = this.variablesBatch.sku + '-' + (index + 1); + } + if (this.variablesBatch.image) { + this.form.skus[index].images = [this.variablesBatch.image]; + } + if (this.variablesBatch.price) { + this.form.skus[index].price = this.variablesBatch.price; + } + if (this.variablesBatch.origin_price) { + this.form.skus[index].origin_price = this.variablesBatch.origin_price; + } + if (this.variablesBatch.cost_price) { + this.form.skus[index].cost_price = this.variablesBatch.cost_price; + } + if (this.variablesBatch.quantity) { + this.form.skus[index].quantity = this.variablesBatch.quantity; + } }) // this.variablesBatch 对象内除了 variables 之外的值都清空 diff --git a/resources/beike/shop/default/css/page-categories.scss b/resources/beike/shop/default/css/page-categories.scss index ba170687..292a412c 100644 --- a/resources/beike/shop/default/css/page-categories.scss +++ b/resources/beike/shop/default/css/page-categories.scss @@ -27,6 +27,21 @@ body.page-categories { } } + .children-wrap { + @media (max-width: 992px) { + display: none; + } + + a { + color: #333; + margin-right: 4px; + + &:hover { + color: $primary; + } + } + } + .style-wrap { label { cursor: pointer; diff --git a/resources/lang/de/category.php b/resources/lang/de/category.php index 7ee6ce18..fdad2183 100644 --- a/resources/lang/de/category.php +++ b/resources/lang/de/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'Kategoriename', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/en/category.php b/resources/lang/en/category.php index 647a846e..e74ae5a0 100644 --- a/resources/lang/en/category.php +++ b/resources/lang/en/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'Name', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/es/category.php b/resources/lang/es/category.php index e0b27708..61f55dda 100644 --- a/resources/lang/es/category.php +++ b/resources/lang/es/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'nombre de la categoría', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/fr/category.php b/resources/lang/fr/category.php index fb3c8b27..463ab1cb 100644 --- a/resources/lang/fr/category.php +++ b/resources/lang/fr/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'Nom de catégorie', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/it/category.php b/resources/lang/it/category.php index 2c059697..5207b37a 100644 --- a/resources/lang/it/category.php +++ b/resources/lang/it/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'Nome della categoria', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/ja/category.php b/resources/lang/ja/category.php index 498e5a40..11d2c558 100644 --- a/resources/lang/ja/category.php +++ b/resources/lang/ja/category.php @@ -11,4 +11,5 @@ return [ 'name' => '種別名', + 'children' => 'サブカテゴリ', ]; diff --git a/resources/lang/ru/category.php b/resources/lang/ru/category.php index 5435960c..e9031872 100644 --- a/resources/lang/ru/category.php +++ b/resources/lang/ru/category.php @@ -11,4 +11,5 @@ return [ 'name' => 'Название категории', + 'children' => 'Subcategory', ]; diff --git a/resources/lang/zh_cn/category.php b/resources/lang/zh_cn/category.php index 5a67238f..ea6ca806 100644 --- a/resources/lang/zh_cn/category.php +++ b/resources/lang/zh_cn/category.php @@ -11,4 +11,5 @@ return [ 'name' => '分类名称', + 'children' => '子分类', ]; diff --git a/resources/lang/zh_hk/category.php b/resources/lang/zh_hk/category.php index 9f823737..e77515fd 100644 --- a/resources/lang/zh_hk/category.php +++ b/resources/lang/zh_hk/category.php @@ -11,4 +11,5 @@ return [ 'name' => '分類名稱', + 'children' => '子分類', ]; diff --git a/themes/default/shared/filter_bar_block.blade.php b/themes/default/shared/filter_bar_block.blade.php index 7a50013e..07c43952 100644 --- a/themes/default/shared/filter_bar_block.blade.php +++ b/themes/default/shared/filter_bar_block.blade.php @@ -1,6 +1,6 @@
@if (!is_mobile()) -
+
+ + @if ($children) +
+ {{ __('category.children') }}: + @foreach ($children as $item) + {{ $item['name'] }} + @endforeach +
+ @endif
@endif