From e052c52caed7f74710d43e972002e508112aa6ce Mon Sep 17 00:00:00 2001 From: qijq <624811160@qq.com> Date: Thu, 17 Jul 2025 13:41:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?update=20=E5=A2=9E=E5=8A=A0=E8=A7=84?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/warehouse/specification.js | 73 ++ java-mall-app-shop-admin/pages.json | 6 + .../pages/order/order.vue | 3 + .../pages/warehouse/manage/classifyList.vue | 6 +- .../components/ba-tree-picker/README.md | 124 +++ .../ba-tree-picker/ba-tree-picker.vue | 704 ++++++++++++++++++ .../manage/components/tree/style.css | 160 ++++ .../warehouse/manage/components/tree/tree.vue | 573 ++++++++++++++ .../pages/warehouse/manage/specification.vue | 544 ++++++++++++++ .../pages/warehouse/warehouse.vue | 7 +- 10 files changed, 2192 insertions(+), 8 deletions(-) create mode 100644 java-mall-app-shop-admin/api/warehouse/specification.js create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/README.md create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/ba-tree-picker.vue create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/components/tree/style.css create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/components/tree/tree.vue create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/specification.vue diff --git a/java-mall-app-shop-admin/api/warehouse/specification.js b/java-mall-app-shop-admin/api/warehouse/specification.js new file mode 100644 index 0000000..657488d --- /dev/null +++ b/java-mall-app-shop-admin/api/warehouse/specification.js @@ -0,0 +1,73 @@ +import http from "../../utils/http"; +import config from "../../config/config"; + +/** 获取规格列表 + * + * @author Seven + * @data 2025-7-12 + * @params { + * pageNum + * pageSize + * } + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-spec/list + */ + +export function GetSpecificationList(params) { + return http({ + url: "/shop/shop-base-product-spec/list", + method: "get", + params, + baseURL: config.adminApi, + }); +} + +/** 编辑规格 + * + * @author Seven + * @data 2025-7-12 + * @params { + * spec_buildin + store_id + spec_order + specItems + spec_id + spec_remark + store_name + spec_format + text + spec_name + spec_category_id + * } + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-spec/edit + */ + +export function UpdateSpecification(params) { + return http({ + url: "/shop/shop-base-product-spec/edit", + method: "post", + params, + baseURL: config.adminApi, + }); +} + +/** 删除规格 + * + * @author Seven + * @data 2025-7-12 + * @params { + * spec_ids + * } + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-spec/delete + */ + +export function DelectSpecification(params) { + return http({ + url: "/shop/shop-base-product-spec/delete", + method: "post", + params, + baseURL: config.adminApi, + }); +} diff --git a/java-mall-app-shop-admin/pages.json b/java-mall-app-shop-admin/pages.json index e43654a..95f28dd 100644 --- a/java-mall-app-shop-admin/pages.json +++ b/java-mall-app-shop-admin/pages.json @@ -224,6 +224,12 @@ "navigationBarTitleText": "分类管理" } }, + { + "path": "pages/warehouse/manage/specification", + "style": { + "navigationBarTitleText": "规格管理" + } + }, { "path": "pages/warehouse/manage/batch", "style": { diff --git a/java-mall-app-shop-admin/pages/order/order.vue b/java-mall-app-shop-admin/pages/order/order.vue index a9083a6..aa68646 100644 --- a/java-mall-app-shop-admin/pages/order/order.vue +++ b/java-mall-app-shop-admin/pages/order/order.vue @@ -1016,12 +1016,15 @@ export default { tabs2: [ { name: "进行中", + num: 0, }, { name: "异常配送", + num: 0, }, { name: "退款", + num: 0, }, ], commodityArr: [ 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 782780e..45fe2ee 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/classifyList.vue @@ -249,7 +249,7 @@ - 暂无商品,马上添加 + 暂无商品类型,点击马上添加 +``` +在 `script` 中定义打开方法,和选择监听 +``` javascript + methods: { + // 显示选择器 + showPicker() { + this.$refs.treePicker._show(); + }, + //监听选择(ids为数组) + selectChange(ids, names) { + console.log(ids, names) + } + } +``` +在 `template` 中调用打开 +``` javascript + 调用选择器 +``` + +### 属性 +|属性名|类型|默认值|说明| +|:-|:-:|:--:|-:| +|localdata|Array|[]|源数据,目前支持tree结构,后续会考虑支持扁平化结构| +|valueKey|String|id|指定 Object 中 key 的值作为节点数据id| +|textKey|String|name|指定 Object 中 key 的值作为节点显示内容| +|childrenKey|String|children|指定 Object 中 key 的值作为节点子集| +|multiple|Boolean|false|是否多选,默认单选| +|selectParent|Boolean|true|是否可以选父级,默认可以| +|title|String| |标题| +|titleColor|String||标题颜色| +|confirmColor|String|#0055ff|确定按钮颜色| +|cancelColor|String|#757575|取消按钮颜色| +|switchColor|String|#666|节点切换图标颜色| +|border|Boolean|false|是否有分割线,默认无| + + + +### 数据格式 + +注意:必须有id、name(id可通过valueKey来配置为其它键值,如value)字段,且唯一 + +``` json +[ + { + id: 1, + name: '公司1', + children: [{ + id: 11, + name: '研发部', + children: [{ + id: 111, + name: '张三', + + },{ + id: 112, + name: '李四', + + }] + },{ + id: 12, + name: '综合部', + + } ] + }, + { + id: 2, + name: '公司2', + children: [{ + id: 21, + name: '研发部', + + },{ + id: 22, + name: '综合部', + + },{ + id: 23, + name: '财务部', + + }, ] + }, + { + id: 3, + name: '公司3' + }, + { + id: 4, + name: '公司4', + children: [{ + id: 41, + name: '研发部', + + }] + } +] +``` + + +### 方法 +|方法名|参数|默认值|说明| +|:-|:-:|:--:|-:| +|_show()| | |显示选择器| +|_hide()| | |隐藏选择器| diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/ba-tree-picker.vue b/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/ba-tree-picker.vue new file mode 100644 index 0000000..59496c9 --- /dev/null +++ b/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/ba-tree-picker.vue @@ -0,0 +1,704 @@ + + + + + + + diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/style.css b/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/style.css new file mode 100644 index 0000000..10c8dd8 --- /dev/null +++ b/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/style.css @@ -0,0 +1,160 @@ +.tki-tree-mask { + position: fixed; + top: 0rpx; + right: 0rpx; + bottom: 0rpx; + left: 0rpx; + z-index: 11999; + background-color: rgba(0, 0, 0, 0.6); + opacity: 0; + transition: all 0.3s ease; + visibility: hidden; +} +.tki-tree-mask.show { + visibility: visible; + opacity: 1; +} + +.tki-tree-cnt { + position: fixed; + top: 0rpx; + right: 0rpx; + bottom: 0rpx; + left: 0rpx; + z-index: 12000; + top: 225rpx; + transition: all 0.3s ease; + transform: translateY(100%); +} +.tki-tree-cnt.show { + transform: translateY(0); +} + +.tki-tree-bar-title { + font-weight: bold; + color: #000; +} + +.tki-tree-bar { + background-color: #fff; + height: 62px; + padding-left: 20rpx; + padding-right: 20rpx; + display: flex; + justify-content: space-between; + align-items: center; + box-sizing: border-box; + border-bottom-width: 1rpx !important; + border-bottom-style: solid; + border-bottom-color: #f5f5f5; + font-size: 32rpx; + color: #757575; + line-height: 1; +} +.tki-tree-bar-confirm { + color: #fe411b; +} +.tki-tree-view { + position: absolute; + top: 0rpx; + right: 0rpx; + bottom: 0rpx; + left: 0rpx; + top: 120rpx; + background-color: #fff; + padding-top: 20rpx; + padding-right: 20rpx; + padding-bottom: 20rpx; + padding-left: 20rpx; +} +.tki-tree-view-sc { + height: 100%; + overflow: hidden; +} +.tki-tree-item { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 26rpx; + color: #757575; + line-height: 1; + height: 0; + opacity: 0; + transition: 0.2s; + position: relative; + overflow: hidden; + margin-bottom: 20rpx; +} +.tki-tree-item.show { + height: 80rpx; + opacity: 1; +} +.tki-tree-item.showchild:before { + transform: rotate(90deg); +} +.tki-tree-item.last:before { + opacity: 0; +} +.tki-tree-icon { + width: 26rpx; + height: 26rpx; + margin-right: 24rpx; +} +.tki-tree-label { + flex: 1; + display: flex; + align-items: center; + height: 100%; + font-size: 36rpx; + line-height: 1.2; +} +.tki-tree-check { + width: 40px; + height: 40px; + display: flex; + justify-content: center; + align-items: center; +} +.tki-tree-check-yes, +.tki-tree-check-no { + width: 20px; + height: 20px; + border-top-left-radius: 20%; + border-top-right-radius: 20%; + border-bottom-right-radius: 20%; + border-bottom-left-radius: 20%; + border-top-width: 1rpx; + border-left-width: 1rpx; + border-bottom-width: 1rpx; + border-right-width: 1rpx; + border-style: solid; + border-color: #fe411b; + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; +} +.tki-tree-check-yes-b { + width: 12px; + height: 12px; + border-top-left-radius: 20%; + border-top-right-radius: 20%; + border-bottom-right-radius: 20%; + border-bottom-left-radius: 20%; + background-color: #fe411b; +} +.tki-tree-check .radio { + border-top-left-radius: 50%; + border-top-right-radius: 50%; + border-bottom-right-radius: 50%; + border-bottom-left-radius: 50%; +} +.tki-tree-check .radio .tki-tree-check-yes-b { + border-top-left-radius: 50%; + border-top-right-radius: 50%; + border-bottom-right-radius: 50%; + border-bottom-left-radius: 50%; +} +.hover-c { + opacity: 0.6; +} diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/tree.vue b/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/tree.vue new file mode 100644 index 0000000..0861fe6 --- /dev/null +++ b/java-mall-app-shop-admin/pages/warehouse/manage/components/tree/tree.vue @@ -0,0 +1,573 @@ + + + + + diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue b/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue new file mode 100644 index 0000000..9582115 --- /dev/null +++ b/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue @@ -0,0 +1,544 @@ + + + + + diff --git a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue index fd050d4..4e2b99c 100644 --- a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue +++ b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue @@ -14,7 +14,7 @@ 商品管理 - + 规格管理 - + Date: Thu, 17 Jul 2025 16:36:58 +0800 Subject: [PATCH 2/4] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E8=A7=84?= =?UTF-8?q?=E6=A0=BCbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/forgetPassword/forgetPassword.vue | 2 +- .../pages/login/login.vue | 2 +- .../pages/register/register.vue | 2 +- .../pages/warehouse/manage/specification.vue | 165 +++++++++++++++++- 4 files changed, 163 insertions(+), 8 deletions(-) diff --git a/java-mall-app-shop-admin/pages/forgetPassword/forgetPassword.vue b/java-mall-app-shop-admin/pages/forgetPassword/forgetPassword.vue index 27d0ee1..7a26974 100644 --- a/java-mall-app-shop-admin/pages/forgetPassword/forgetPassword.vue +++ b/java-mall-app-shop-admin/pages/forgetPassword/forgetPassword.vue @@ -339,7 +339,7 @@ export default { } .input_icon { - /deep/ .u-icon__icon { + ::v-deep .u-icon__icon { font-size: 36rpx !important; } } diff --git a/java-mall-app-shop-admin/pages/login/login.vue b/java-mall-app-shop-admin/pages/login/login.vue index 9f595d8..d9a8f0a 100644 --- a/java-mall-app-shop-admin/pages/login/login.vue +++ b/java-mall-app-shop-admin/pages/login/login.vue @@ -496,7 +496,7 @@ export default { } .input_icon { - /deep/ .u-icon__icon { + ::v-deep .u-icon__icon { font-size: 36rpx !important; } } diff --git a/java-mall-app-shop-admin/pages/register/register.vue b/java-mall-app-shop-admin/pages/register/register.vue index 50057f4..8de9ade 100644 --- a/java-mall-app-shop-admin/pages/register/register.vue +++ b/java-mall-app-shop-admin/pages/register/register.vue @@ -270,7 +270,7 @@ export default { } .input_icon { - /deep/ .u-icon__icon { + ::v-deep.u-icon__icon { font-size: 36rpx !important; } } 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 9582115..a454c45 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/specification.vue @@ -108,9 +108,9 @@ > - + --> + + + + 确认删除"{{ currDelectItem.spec_name }}"规格? + + + + 取消 + + + 确认 + + + + + @@ -276,7 +309,6 @@ export default { pageSize: 20, specificationList: [], currDelectItem: {}, - currEidtItem: {}, showDelectPopup: false, showAddAndEditPopup: false, form: { @@ -315,7 +347,6 @@ export default { let res = await GetCommodityClassify(); if (res && res.status == 200) { const classifyList = res.data; - if (classifyList.length > 0) { this.baTreePickerList = classifyList.map((item) => { // 创建父节点,并保留所有原始字段 @@ -357,11 +388,50 @@ export default { this.currDelectItem = item; this.showDelectPopup = true; }, + handerShowEeditPopup(item){ + this.isAdd = false + item = { + spec_category_name: "", + ...item + } + this.form = 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); + if (matchedCategory) { + this.form.spec_category_name = matchedCategory.category_name + } + } + this.showAddAndEditPopup = true + }, hadnerShowClassifyListPopup() { this.$refs.tkitree._show(); }, handerAddAndEditPopup(isAdd) { this.isAdd = isAdd; + this.form = { + spec_name: "", + spec_order: "", + spec_category_id: "", + spec_format: "text", + spec_category_name: "", + } this.showAddAndEditPopup = true; }, async handerAffirmAddAndEdit() { @@ -374,10 +444,48 @@ export default { type: "succeed", duration: 1000, }); - + this.showAddAndEditPopup = false this.getSpecificationList(true); + this.form = { + spec_name: "", + spec_order: "", + spec_category_id: "", + spec_format: "text", + spec_category_name: "", + } } }, + async handerDelectClassify(){ + let params = { + spec_ids:this.currDelectItem.spec_id + } + + let res = await DelectSpecification(params) + if(res && res.status == 200){ + this.$refs.uToast.show({ + message: "删除成功", + type: "succeed", + duration: 1000, + }); + this.showDelectPopup = false + this.getSpecificationList() + } + }, + treeCancel(){ + this.$refs.tkitree._hide(); + + }, + 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{ + this.form.spec_category_name = list[0].category_name; + this.form.spec_category_id = list[0].category_id; + } + + } }, }; @@ -456,6 +564,53 @@ export default { } } + .affirm-popup { + ::v-deep.u-popup__content { + border-radius: 16rpx; + } + + ::v-deep.u-fade-enter-to { + z-index: 10076 !important; + } + + .affirm-popup-content { + width: 600rpx; + + .affirm-popup-title { + padding: 40rpx; + text-align: center; + font-weight: 500; + } + + .affirm-popup-tips { + padding: 0 60rpx; + font-size: 28rpx; + text-align: center; + } + + .popup-btn-list { + display: flex; + margin: 50rpx; + + .btn-item { + width: 46%; + height: 80rpx; + border-color: #909193; + + &::after { + border: none; + } + } + + .btn-item-2 { + background: $base-color; + color: #fff; + border: none; + } + } + } + } + .add-popup { ::v-deep.u-popup__content { border-radius: 16rpx; From a86973f3e08c37ee06f7f2bc8be9fed50f79390d Mon Sep 17 00:00:00 2001 From: qijq Date: Thu, 17 Jul 2025 21:48:50 +0800 Subject: [PATCH 3/4] update --- java-mall-app-shop-admin/pages.json | 6 +++ .../pages/warehouse/manage/typeManagement.vue | 38 +++++++++++++++++++ .../pages/warehouse/warehouse.vue | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue diff --git a/java-mall-app-shop-admin/pages.json b/java-mall-app-shop-admin/pages.json index 95f28dd..02f5e19 100644 --- a/java-mall-app-shop-admin/pages.json +++ b/java-mall-app-shop-admin/pages.json @@ -229,6 +229,12 @@ "style": { "navigationBarTitleText": "规格管理" } + }, + { + "path": "pages/warehouse/manage/TypeManagement", + "style": { + "navigationBarTitleText": "类型管理" + } }, { "path": "pages/warehouse/manage/batch", diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue b/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue new file mode 100644 index 0000000..f6f499c --- /dev/null +++ b/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue index 4e2b99c..7306836 100644 --- a/java-mall-app-shop-admin/pages/warehouse/warehouse.vue +++ b/java-mall-app-shop-admin/pages/warehouse/warehouse.vue @@ -34,7 +34,7 @@ 类型管理 - + Date: Fri, 18 Jul 2025 04:10:51 +0800 Subject: [PATCH 4/4] '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 @@ 规格管理 - + 类型管理 - +