From 64989931cb0e8958d208da671931fbb844090cd7 Mon Sep 17 00:00:00 2001 From: qijq <624811160@qq.com> Date: Fri, 18 Jul 2025 04:10:51 +0800 Subject: [PATCH] 'update' --- java-mall-app-shop-admin/pages.json | 4 +- .../pages/warehouse/manage/classifyList.vue | 3 - .../pages/warehouse/manage/specification.vue | 287 +++++++++--------- .../pages/warehouse/warehouse.vue | 7 +- 4 files changed, 154 insertions(+), 147 deletions(-) diff --git a/java-mall-app-shop-admin/pages.json b/java-mall-app-shop-admin/pages.json index 02f5e19..622c5ec 100644 --- a/java-mall-app-shop-admin/pages.json +++ b/java-mall-app-shop-admin/pages.json @@ -230,8 +230,8 @@ "navigationBarTitleText": "规格管理" } }, - { - "path": "pages/warehouse/manage/TypeManagement", + { + "path": "pages/warehouse/manage/typeManagement", "style": { "navigationBarTitleText": "类型管理" } diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue b/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue index 45fe2ee..6522efb 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue @@ -963,9 +963,6 @@ export default { font-weight: 500; } - .commodity-type-search-scroll { - } - .commodity-type-radio-group { margin: 40rpx; diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue b/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue index a454c45..a07188c 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue @@ -17,6 +17,10 @@ scroll-y scroll-with-animation :show-scrollbar="false" + @scrolltolower="handerScrolltolower" + refresher-enabled + :refresher-triggered="isRefreshing" + @refresherrefresh="handleRefresh" class="specification-scroll" > - - {{ item.spec_name }} + {{ item.spec_name }} + + 分类: + {{ + item.spec_category_id == 0 + ? "未绑定分类" + : handerCategoryName(item) + }} - 排序{{ item.spec_order }} + 排序:{{ item.spec_order }} + + + + + 正在加载... + + + + + 没有更多商品类型了 ~ + + + @@ -151,108 +177,8 @@ @handerScrolltolower="handerScrolltolower" @handleRefresh="handleRefresh" > - - - - { + this.getSpecificationList(false); + }, 500); + }, + handleRefresh() { + this.isRefreshing = true; + this.pageNum = 1; + this.getSpecificationList(); }, handerShowDelectPopup(item) { this.currDelectItem = item; this.showDelectPopup = true; }, - handerShowEeditPopup(item){ - this.isAdd = false + handerCategoryName(item) { + if (item) { + const findCategory = (categories, targetId) => { + for (const category of categories) { + // Check current category + if (category.category_id === targetId) { + return category; + } + + // Check subcategories if they exist + if (category.children && category.children.length > 0) { + const foundInSub = findCategory(category.children, targetId); + if (foundInSub) return foundInSub; + } + } + return null; + }; + + if (this.baTreePickerList.length > 0) { + const matchedCategory = findCategory( + this.baTreePickerList, + item.spec_category_id + ); + + return (matchedCategory && matchedCategory.category_name) || ""; + } + } + }, + handerShowEeditPopup(item) { + this.isAdd = false; item = { spec_category_name: "", - ...item - } + ...item, + }; this.form = item; - const findCategory = (categories, targetId) => { + const findCategory = (categories, targetId) => { for (const category of categories) { // Check current category if (category.category_id === targetId) { return category; } - + // Check subcategories if they exist if (category.children && category.children.length > 0) { const foundInSub = findCategory(category.children, targetId); @@ -410,15 +401,18 @@ export default { } } return null; - } - - if(this.baTreePickerList.length > 0){ - const matchedCategory = findCategory(this.baTreePickerList, item.spec_category_id); + }; + + if (this.baTreePickerList.length > 0) { + const matchedCategory = findCategory( + this.baTreePickerList, + item.spec_category_id + ); if (matchedCategory) { - this.form.spec_category_name = matchedCategory.category_name + this.form.spec_category_name = matchedCategory.category_name; } } - this.showAddAndEditPopup = true + this.showAddAndEditPopup = true; }, hadnerShowClassifyListPopup() { this.$refs.tkitree._show(); @@ -428,10 +422,10 @@ export default { this.form = { spec_name: "", spec_order: "", - spec_category_id: "", + spec_category_id: 0, spec_format: "text", spec_category_name: "", - } + }; this.showAddAndEditPopup = true; }, async handerAffirmAddAndEdit() { @@ -444,48 +438,55 @@ export default { type: "succeed", duration: 1000, }); - this.showAddAndEditPopup = false - this.getSpecificationList(true); + this.showAddAndEditPopup = false; + + if (this.isAdd) { + this.specificationList.push(this.form); + this.specificationList.sort((a, b) => a.spec_order - b.spec_order); + } + + // this.specificationList = + this.form = { spec_name: "", spec_order: "", - spec_category_id: "", + spec_category_id: 0, spec_format: "text", spec_category_name: "", - } + }; } }, - async handerDelectClassify(){ + async handerDelectClassify() { let params = { - spec_ids:this.currDelectItem.spec_id - } + spec_ids: this.currDelectItem.spec_id, + }; - let res = await DelectSpecification(params) - if(res && res.status == 200){ + let res = await DelectSpecification(params); + if (res && res.status == 200) { this.$refs.uToast.show({ message: "删除成功", type: "succeed", duration: 1000, }); - this.showDelectPopup = false - this.getSpecificationList() + this.showDelectPopup = false; + this.specificationList = this.specificationList.filter( + (item) => item.spec_id !== this.currDelectItem.spec_id + ); } }, - treeCancel(){ + treeCancel() { this.$refs.tkitree._hide(); - }, - treeConfirm(list){ - console.log(this.form) - if(list.length > 1){ + treeConfirm(list) { + console.log(this.form); + if (list.length > 1) { this.form.spec_category_name = list[1].category_name; this.form.spec_category_id = list[1].category_id; - }else{ + } else { this.form.spec_category_name = list[0].category_name; this.form.spec_category_id = list[0].category_id; } - - } + }, }, }; @@ -496,7 +497,7 @@ export default { .specification-scroll { -ms-overflow-style: none; /* IE和Edge */ scrollbar-width: none; /* Firefox */ - height: calc(100vh - 230px); + height: calc(100vh - 300rpx); } .specification-loading { @@ -544,6 +545,12 @@ export default { font-weight: 600; } + .specification-classify { + font-size: 30rpx; + margin: 16rpx 0; + color: #606060; + } + .specification-sort { font-size: 15px; color: #606060; diff --git a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue index 7306836..dcf7629 100644 --- a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue +++ b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue @@ -24,7 +24,10 @@ 规格管理 - + 类型管理 - +