From 6c72027a865705baf3ef3c2e39de6065c2201991 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Thu, 10 Apr 2025 18:27:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/index.ts | 10 +++++++++- src/views/product/index.vue | 31 ++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/api/product/index.ts b/src/api/product/index.ts index bda2707..8e39140 100644 --- a/src/api/product/index.ts +++ b/src/api/product/index.ts @@ -55,7 +55,7 @@ const AuthAPI = { method: "delete", }); }, - // 退款退回 + // 同步 refundToStock(data: any) { return request({ url: `${baseURL}/refundToStock`, @@ -63,6 +63,14 @@ const AuthAPI = { data, }); }, + // 退款退回 + sync(data: any) { + return request({ + url: `${baseURL}/sync`, + method: "post", + data, + }); + }, // 耗材列表 productcons(params: any) { diff --git a/src/views/product/index.vue b/src/views/product/index.vue index 1136ea5..3d9d32f 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -199,6 +199,20 @@ let datas = reactive({ remark: "", images: [] }); +if (JSON.parse(localStorage.getItem('userInfo') || '{}').isHeadShop == 0) { + contentConfig.toolbar.splice(0, 1) +}else { + contentConfig.toolbar.splice(1, 1) +} +onMounted(() => { + console.log(route.query); + if (route.query.id) { + contentRef.value?.fetchPageData({ id: route.query.id }); + } + // 获取耗材列表 + gethaocaiList() + +}); function newHandleQueryClick(e: IObject | undefined) { const filterParams = contentRef.value?.getFilterParams(); contentRef.value?.fetchPageData({ ...e, ...filterParams }, true); @@ -299,14 +313,16 @@ async function handleEditClick(row: IObject) { } // 其他工具栏 -function handleToolbarClick(name: string) { +async function handleToolbarClick(name: string) { console.log(name); if ( name === "custom1" ) { // ElMessage.success("点击了自定义1按钮"); myDialogRef.value.open(); } if ( name === "custom2" ) { //商品同步 - + let res = await UserAPI.sync() + ElMessage.success('操作成功,数据正在后台同步中...') + console.log(res) } } async function confirm() { @@ -357,14 +373,7 @@ async function handleOperatClick(data: IOperatData) { } -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 @@ -388,4 +397,4 @@ async function gethaocaiList() { } } } - \ No newline at end of file +