diff --git a/java-mall-app-shop-admin/api/warehouse/typeManage.js b/java-mall-app-shop-admin/api/warehouse/typeManage.js index b5a1036..c25f125 100644 --- a/java-mall-app-shop-admin/api/warehouse/typeManage.js +++ b/java-mall-app-shop-admin/api/warehouse/typeManage.js @@ -1,7 +1,7 @@ import http from "../../utils/http"; import config from "../../config/config"; -/** 获取店铺商品分类 +/** 获取店铺商品类型列表 * * @author Seven * @data 2025-7-12 @@ -21,3 +21,73 @@ export function GetTypeManageList(params) { baseURL: config.adminApi, }); } + +/** 编辑店铺商品类型 + * + * @author Seven + * @data 2025-7-17 + * @params { + * store_id + type_name + type_is_param + type_brand_ids + type_buildin + type_is_assist + type_spec_ids: "1112,1113" 规格ID + type_id + type_category_id 分类ID + type_is_draft + type_is_entity + type_is_brand + store_name + type_remark + type_assist_ids + * } + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-type/edit?source_lang=zh_CN + */ + +export function UpdateType(params) { + return http({ + url: "/shop/shop-base-product-type/edit", + method: "post", + params, + baseURL: config.adminApi, + }); +} + +/** 删除店铺商品类型 + * + * @author Seven + * @data 2025-7-17 + * @params { + * type_ids + * } + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-type/delete + */ + +export function DelectType(params) { + return http({ + url: "shop/shop-base-product-type/delete", + method: "post", + params, + baseURL: config.adminApi, + }); +} + +/** 获取店铺商品类型列表 + * + * @author Seven + * @data 2025-7-17 + * @returns { } + * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-spec/specMap + */ + +export function GetAllSpecification() { + return http({ + url: "/shop/shop-base-product-spec/specMap", + method: "get", + baseURL: config.adminApi, + }); +} diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/README.md b/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/README.md deleted file mode 100644 index 59d99f9..0000000 --- a/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/README.md +++ /dev/null @@ -1,124 +0,0 @@ -## 树形层级选择器 -### 简介 -为统一样式而生,树形层级选择器,picker弹窗形式的,样式和比例参照uniapp的picker和uni-data-picker组件 -* 支持单选、多选、父级选择,当然也支持单层选择 -* 支持Object对象属性自定义映射 -* 支持显示全部选中、部分选中、未选中三种状态 -* 支持快速自定义简单样式(分割线、按钮、标题、对齐等),深入样式可复写css - -### 使用方法 -在 `script` 中引入组件 -``` javascript - import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue" - export default { - components: { - baTreePicker - } -``` -在 `template` 中使用组件 -``` javascript - -``` -在 `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 deleted file mode 100644 index 59496c9..0000000 --- a/java-mall-app-shop-admin/pages/warehouse/manage/components/ba-tree-picker/ba-tree-picker.vue +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - - diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/editClassify.vue b/java-mall-app-shop-admin/pages/warehouse/manage/editClassify.vue index 994886a..f7d3446 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/editClassify.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/editClassify.vue @@ -286,7 +286,19 @@ > 选择商品类型 + + + + 暂无商品类型,点击马上添加 + + + {{ item.spec_name }} 分类: - {{ - item.spec_category_id == 0 - ? "未绑定分类" - : handerCategoryName(item) - }} + + 未绑定分类 + + {{ handerCategoryName(item) }} 排序:{{ item.spec_order }} @@ -91,6 +90,7 @@ zIndex="10077" :show="showAddAndEditPopup" mode="center" + @close="handerCloseAddAndEditPopup" > @@ -174,8 +174,6 @@ title="选择商品分类" @confirm="treeConfirm" @cancel="treeCancel" - @handerScrolltolower="handerScrolltolower" - @handleRefresh="handleRefresh" > { 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; @@ -389,12 +385,10 @@ export default { 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; @@ -428,33 +422,39 @@ export default { }; this.showAddAndEditPopup = true; }, - async handerAffirmAddAndEdit() { + handerAffirmAddAndEdit() { let params = this.form; - let res = await UpdateSpecification(params); - if (res && res.status == 200) { - this.$refs.uToast.show({ - message: this.isAdd ? "添加成功" : "修改成功", - type: "succeed", - duration: 1000, - }); - this.showAddAndEditPopup = false; + this.$refs.uForm.validate().then(async () => { + let res = await UpdateSpecification(params); + if (res && res.status == 200) { + this.$refs.uToast.show({ + message: this.isAdd ? "添加成功" : "修改成功", + type: "succeed", + duration: 1000, + }); + this.showAddAndEditPopup = false; - if (this.isAdd) { - this.specificationList.push(this.form); - this.specificationList.sort((a, b) => a.spec_order - b.spec_order); + // 静默更新,不影响当前数组 + let params = { + pageSize: 9999, + pageNum: 1, + }; + + let res = await GetSpecificationList(params); + if (res && res.status == 200) { + this.specificationList = res.data.items; + } + + this.form = { + spec_name: "", + spec_order: "", + spec_category_id: 0, + spec_format: "text", + spec_category_name: "", + }; } - - // this.specificationList = - - this.form = { - spec_name: "", - spec_order: "", - spec_category_id: 0, - spec_format: "text", - spec_category_name: "", - }; - } + }); }, async handerDelectClassify() { let params = { diff --git a/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue b/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue index f6f499c..7294a8e 100644 --- a/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue +++ b/java-mall-app-shop-admin/pages/warehouse/manage/typeManagement.vue @@ -1,33 +1,637 @@ @@ -35,4 +639,269 @@ export default { diff --git a/java-mall-app-shop-admin/utils/http.js b/java-mall-app-shop-admin/utils/http.js index 49d4477..55d669e 100644 --- a/java-mall-app-shop-admin/utils/http.js +++ b/java-mall-app-shop-admin/utils/http.js @@ -35,19 +35,23 @@ service.interceptors.response.use( const res = response.data; if (res.status == 250) { - uni.showToast({ - title: `提示${res.msg}`, - icon: "error", - duration: 1000, - }); + uni.$u.toast(`提示:${res.msg}`); + + // uni.showToast({ + // title: `提示${res.msg}`, + // icon: "error", + // duration: 2000, + // }); } if (res.code == 30) { - uni.showToast({ - title: `token已经过期需要重新登录`, - icon: "error", - duration: 1000, - }); + uni.$u.toast(`token已经过期需要重新登录`); + + // uni.showToast({ + // title: `token已经过期需要重新登录`, + // icon: "error", + // duration: 1000, + // }); $store.dispatch("user/LoginOut", true);