From 43ae9f371d6cfa915ca2de7f76cc60ed930f4b17 Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Fri, 21 Feb 2025 14:41:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 + src/api/product/specificationsconfig.ts | 8 + src/components/CURD/PageContent.vue | 3 + src/components/CURD/usePage.ts | 10 + src/components/Upload/MultiImageUpload.vue | 38 +- src/components/mycomponents/shopList.vue | 55 +++ .../mycomponents/shopListconfig/content2.ts | 40 ++ .../mycomponents/shopListconfig/search.ts | 41 ++ src/views/online-shop/goods-group.vue | 8 +- .../online-shop/goodsGroupconfig/content2.ts | 7 +- src/views/product/index.vue | 11 + .../indexconfig/SpecificationAttribute.vue | 178 ++++++-- src/views/product/indexconfig/addgoods.vue | 418 +++++++++++++++--- src/views/product/indexconfig/content.ts | 9 +- src/views/product/specifications.vue | 247 ++++++++++- .../product/specificationsconfig/content.ts | 13 +- .../product/specificationsconfig/edit.ts | 5 +- 17 files changed, 954 insertions(+), 140 deletions(-) create mode 100644 src/components/mycomponents/shopList.vue create mode 100644 src/components/mycomponents/shopListconfig/content2.ts create mode 100644 src/components/mycomponents/shopListconfig/search.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index abfc93e..01df9ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -80,5 +80,8 @@ "scss.lint.unknownAtRules": "ignore", "[typescript]": { "editor.defaultFormatter": "vscode.typescript-language-features" + }, + "[html]": { + "editor.defaultFormatter": "vscode.html-language-features" } } diff --git a/src/api/product/specificationsconfig.ts b/src/api/product/specificationsconfig.ts index 69358e8..0c03923 100644 --- a/src/api/product/specificationsconfig.ts +++ b/src/api/product/specificationsconfig.ts @@ -3,6 +3,14 @@ const baseURL = "/product/admin/prod/spec"; // 商品管理-商品规格 const AuthAPI = { + // 新快捷新增 + quickAdd(data: any) { + return request({ + url: `${baseURL}/quickAdd`, + method: "post", + data, + }); + }, /** 列表*/ getPage(params: any) { return request({ diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue index 61125a8..8f17387 100644 --- a/src/components/CURD/PageContent.vue +++ b/src/components/CURD/PageContent.vue @@ -798,6 +798,8 @@ function fetchPageData(formData: IObject = {}, isRestart = false) { if (isRestart) { pagination.currentPage = 1; } + console.log(props, 'debug1') + console.log(props.contentConfig, 'debug2') props.contentConfig .indexAction( showPagination @@ -809,6 +811,7 @@ function fetchPageData(formData: IObject = {}, isRestart = false) { : formData ) .then((data) => { + if (showPagination) { if (props.contentConfig.parseData) { data = props.contentConfig.parseData(data); diff --git a/src/components/CURD/usePage.ts b/src/components/CURD/usePage.ts index b12fc26..584f1f9 100644 --- a/src/components/CURD/usePage.ts +++ b/src/components/CURD/usePage.ts @@ -3,7 +3,9 @@ import type { IObject, PageContentInstance, PageModalInstance, PageSearchInstanc function usePage() { const searchRef = ref(); + const searchRefs = ref(); const contentRef = ref(); + const contentRefs = ref(); const addModalRef = ref(); const editModalRef = ref(); // 搜索 @@ -11,6 +13,11 @@ function usePage() { const filterParams = contentRef.value?.getFilterParams(); contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true); } + // 搜索2 + function searchs(queryParams: IObject) { + const filterParams = contentRefs.value?.getFilterParams(); + contentRefs.value?.fetchPageData({ ...queryParams, ...filterParams }, true); + } // 重置 function handleResetClick(queryParams: IObject) { const filterParams = contentRef.value?.getFilterParams(); @@ -50,10 +57,13 @@ function usePage() { return { searchRef, + searchRefs, contentRef, + contentRefs, addModalRef, editModalRef, handleQueryClick, + searchs, handleResetClick, handleAddClick, handleEditClick, diff --git a/src/components/Upload/MultiImageUpload.vue b/src/components/Upload/MultiImageUpload.vue index 6dc39b3..5efac6e 100644 --- a/src/components/Upload/MultiImageUpload.vue +++ b/src/components/Upload/MultiImageUpload.vue @@ -1,18 +1,11 @@ \ No newline at end of file diff --git a/src/components/mycomponents/shopListconfig/content2.ts b/src/components/mycomponents/shopListconfig/content2.ts new file mode 100644 index 0000000..9b2d6f8 --- /dev/null +++ b/src/components/mycomponents/shopListconfig/content2.ts @@ -0,0 +1,40 @@ +import type { IContentConfig } from "@/components/CURD/types"; +import UserAPI from "@/api/product/index"; + +const contentConfig: IContentConfig = { + pageName: "sys:user", + table: { + showOverflowTooltip: true, + }, + toolbar: [], + pagination: { + background: true, + layout: "prev,pager,next,jumper,total,sizes", + pageSize: 10, + pageSizes: [10, 20, 30, 50], + }, + indexAction: function (params) { + return UserAPI.getPage(params); + }, + modifyAction(data) { + // 模拟发起网络请求修改字段 + // console.log("modifyAction:", data); + ElMessage.success(JSON.stringify(data)); + return Promise.resolve(null); + }, + + cols: [ + { type: "selection", width: 50, align: "center" }, + { label: "封面图", align: "center", prop: "coverImg", templet: "image" }, + { label: "商品信息", align: "center", prop: "name" }, + { label: "规格", align: "center", prop: "specSnap", }, + { label: "是否售罄", align: "center", prop: "isPauseSale", }, + { label: "售价", align: "center", prop: "lowPrice", }, + { label: "库存", align: "center", prop: "realSalesNumber", }, + { label: "销量", align: "center", prop: "stockNumber", }, + { label: "分类名称", align: "center", prop: "categoryName", }, + + ], +}; + +export default contentConfig; diff --git a/src/components/mycomponents/shopListconfig/search.ts b/src/components/mycomponents/shopListconfig/search.ts new file mode 100644 index 0000000..e9237eb --- /dev/null +++ b/src/components/mycomponents/shopListconfig/search.ts @@ -0,0 +1,41 @@ +import DeptAPI from "@/api/product/specificationsconfig"; +import UserAPI from "@/api/onlineShop/goodsGroupconfig"; + +import type { ISearchConfig } from "@/components/CURD/types"; + +const searchConfig: ISearchConfig = { + pageName: "sys:user", + formItems: [ + { + type: "input", + label: "商品名称", + prop: "name", + attrs: { + placeholder: "请输入商品名称", + clearable: true, + style: { + width: "200px", + }, + }, + }, + { + type: "select", + label: "商品分类", + prop: "categoryId", + attrs: { + placeholder: "请选择商品分类", + clearable: true, + style: { + width: "200px", + }, + }, + options: [], + async initFn(formItem) { + formItem.options = await UserAPI.getList(); + }, + }, + + ], +}; + +export default searchConfig; diff --git a/src/views/online-shop/goods-group.vue b/src/views/online-shop/goods-group.vue index 3de1555..f015e15 100644 --- a/src/views/online-shop/goods-group.vue +++ b/src/views/online-shop/goods-group.vue @@ -86,7 +86,7 @@ - + @@ -125,6 +128,14 @@ function handleToolbarClick(name: string) { function confirm() { console.log(form, 'debug') } +// 商品规格 +function typeFilter(item: any) { + if (item == 'single') { return '单规格' } + else if (item == 'sku') { return '多规格' } + else if (item == 'package') { return '套餐商品' } + else if (item == 'weight') { return '称重商品' } + else if (item == 'coupon') { return '团购券' } +} // 其他操作列 async function handleOperatClick(data: IOperatData) { console.log(data); diff --git a/src/views/product/indexconfig/SpecificationAttribute.vue b/src/views/product/indexconfig/SpecificationAttribute.vue index 99642f1..ce825b3 100644 --- a/src/views/product/indexconfig/SpecificationAttribute.vue +++ b/src/views/product/indexconfig/SpecificationAttribute.vue @@ -1,50 +1,149 @@ + - + + + + + + + + - + + + + + + + +
+ + {{ val.name }} + + + + + 添加 + + 删除 +
+
+
+ + + + + + + + + + + + + + 添加 + 取消 + + + + 添加规格 + + +