From e97424262bd07f43a8198ee1cbb32af895f3f57a Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Mon, 17 Mar 2025 16:06:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8-=E6=8A=A5=E6=8D=9F-=E5=94=AE=E7=BD=84-=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/index.ts | 23 ++ src/components/CURD/PageContent.vue | 283 +++++------------- src/views/product/index.vue | 102 ++++--- src/views/product/indexconfig/content.ts | 27 +- src/views/user/active/indexconfig/Content.vue | 4 + 5 files changed, 182 insertions(+), 257 deletions(-) diff --git a/src/api/product/index.ts b/src/api/product/index.ts index 12ebdb4..49178e4 100644 --- a/src/api/product/index.ts +++ b/src/api/product/index.ts @@ -71,6 +71,29 @@ const AuthAPI = { params }); }, + // 报损 + reportDamage(data: any) { + return request({ + url: `${baseURL}/reportDamage`, + method: "post", + data, + }); + }, + // 库存预警 + stockWarning(data: any) { + return request({ + url: `${baseURL}/stockWarning?warnLine=${data}`, + method: "post", + }); + }, + // 售罄 + markIsSoldOut(data: any) { + return request({ + url: `${baseURL}/markIsSoldOut`, + method: "post", + data, + }); + } }; diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue index 27d117b..aa59fcb 100644 --- a/src/components/CURD/PageContent.vue +++ b/src/components/CURD/PageContent.vue @@ -8,58 +8,37 @@ @@ -88,68 +67,36 @@ - + @@ -263,63 +191,44 @@ @@ -70,7 +72,7 @@ - + @@ -83,6 +85,56 @@ + + + + + {{ haocaiData.name }} + + + + + + + + + + + + + + + + + + + + + @@ -99,7 +151,6 @@ import editModalConfig from "./indexconfig/edit"; import searchConfig from "./indexconfig/search"; import MyDialog from "@/components/mycomponents/myDialog.vue"; import Statistics from "./indexconfig/statistics.vue"; -import { Search } from '@element-plus/icons-vue' const { searchRef, contentRef, @@ -115,6 +166,15 @@ const { } = usePage(); const router = useRouter(); let gongjiData = ref({}); +const myDialogRef = ref(null); +const route = useRoute(); +const myDialogRefbaosun = ref(null); +const myDialogRefhaocai = ref(null); +let haocaiData = ref({}); +let options = ref([]); +const form = reactive({ + warnLine: "", +}); let datas = reactive({ number: 0, remark: "", @@ -125,8 +185,18 @@ function newHandleQueryClick(e: IObject | undefined) { contentRef.value?.fetchPageData({ ...e, ...filterParams }, true); getTongji(e); } -function editOpen() { - +function editOpen(item: any) { + haocaiData.value = item + if (haocaiData.value.consList.length == 0) { + let items = { + "productId": item.id, + "consInfoId": "", + "surplusStock": '0' + } + haocaiData.value.consList.push(items) + } + handleResetClick() + myDialogRefhaocai.value.open(); } // 重置 function handleResetClick2(queryParams: IObject) { @@ -141,9 +211,7 @@ function getTongji(params: IObject | undefined) { gongjiData.value = res }); } -const form = reactive({ - warnLine: "", -}); + // 新增 async function handleAddClick() { router.push({ name: "addgoods" }); @@ -151,7 +219,15 @@ async function handleAddClick() { // 加载上级规格下拉数据源 // addModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" }); // 加载角色下拉数据源 - // addModalConfig.formItems[4]!.options = await RoleAPI.getOptions(); +} +// 生成新商品绑定耗材关系项 +function createItem(val: IObject) { + let item = { + "productId": val.productId, + "consInfoId": "", + "surplusStock": '' + } + haocaiData.value.consList.push(item) } // 上架 function handleSwitchChange(data: any) { @@ -171,13 +247,18 @@ function handleSwitchChangeTwo(data: any) { }; UserAPI.markIsSoldOut(obj); } +// 退款退回 +async function handleSwitchhaocai(row: IObject) { + let res = await UserAPI.refundToStock({ isReturn: row, id: haocaiData.value.id }) + ElMessage.success('成功') + // myDialogRefhaocai.value.close() +} // 编辑 async function handleEditClick(row: IObject) { router.push({ name: "addgoods", query: { goods_id: row.id } }); } -const myDialogRef = ref(null); -const myDialogRefbaosun = ref(null); + // 其他工具栏 function handleToolbarClick(name: string) { console.log(name); @@ -192,11 +273,27 @@ async function confirm() { myDialogRef.value.close(); } +// 商品选择耗材 +function selectionChange(e, row) { + let item = options.value.find(item => item.id == e) + row.name = item.conName + row.conUnit = item.conUnit +} async function confirmbaosun() { let res = await UserAPI.reportDamage(datas) ElMessage.success("成功"); myDialogRefbaosun.value.close(); } +async function confirmhaocai() { + let obj = { + consList: haocaiData.value.consList, + id: haocaiData.value.id + } + let res = await UserAPI.bind(obj) + ElMessage.success("成功"); + handleResetClick() + myDialogRefhaocai.value.close(); +} // 商品规格 function typeFilter(item: any) { if (item == "single") { @@ -218,11 +315,35 @@ async function handleOperatClick(data: IOperatData) { } -const route = useRoute(); onMounted(() => { console.log(route.query); if (route.query.id) { contentRef.value?.fetchPageData({ id: route.query.id }); } + // 获取耗材列表 + gethaocaiList() }); +async function gethaocaiList() { + let res = await UserAPI.productcons({ id: route.query.id }) + options.value = res.records +} + \ No newline at end of file