From be12089ffe25117ffaf4b7cbcc11e411fea85034 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Mon, 30 Mar 2026 18:07:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BA=93=E5=AD=98=E5=BC=80?=
=?UTF-8?q?=E5=85=B3=E6=8C=89=E9=92=AE=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E4=B8=8A=E4=B8=8B?=
=?UTF-8?q?=E6=9E=B6sku=E8=81=94=E5=8A=A8=EF=BC=8C=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E5=95=86=E5=93=81=E7=BB=91=E5=AE=9A=E8=80=97=E6=9D=90=E7=BC=96?=
=?UTF-8?q?=E8=BE=91=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/product/index.vue | 38 ++++++++++++++++++++----
src/views/product/indexconfig/content.ts | 1 +
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/src/views/product/index.vue b/src/views/product/index.vue
index 688c2c7..293184c 100644
--- a/src/views/product/index.vue
+++ b/src/views/product/index.vue
@@ -46,10 +46,12 @@
@@ -160,6 +162,7 @@
@@ -401,13 +404,25 @@ function createItem(val: IObject) {
haocaiData.value.consList.push(item);
}
// 上架
-function handleSwitchChange(data: any) {
+async function handleSwitchChange(data: any) {
+ console.log(data);
let obj = {
type: data.productId ? "sku" : "product",
id: data.id,
isSale: data.isSale,
};
- UserAPI.onOff(obj);
+ await UserAPI.onOff(obj);
+ ElMessage.success("修改成功!");
+
+ if (data.productId) {
+ //sku
+ contentRef.value?.fetchPageData();
+ } else {
+ //product
+ data.skuList.map((v) => {
+ v.isSale = data.isSale;
+ });
+ }
}
// 售罄
function handleSwitchChangeTwo(data: any) {
@@ -417,6 +432,7 @@ function handleSwitchChangeTwo(data: any) {
isSoldOut: data.isSoldStock,
};
UserAPI.markIsSoldOut(obj);
+ ElMessage.success("修改成功!");
}
function handleSwitchChangethree(data: any) {
let obj = {
@@ -427,6 +443,18 @@ function handleSwitchChangethree(data: any) {
UserAPI.markIsSoldOut(obj);
}
+async function isStockChange(data: any) {
+ console.log(data);
+ let obj = {
+ type: "product",
+ id: data.id,
+ isSale: data.isStock,
+ optType: "stock ",
+ };
+ await UserAPI.onOff(obj);
+ ElMessage.success("修改成功!");
+ return;
+}
// 退款退回
async function handleSwitchhaocai(row: IObject) {
let res = await UserAPI.refundToStock({ isReturn: row.isRefundStock, id: row.id });
diff --git a/src/views/product/indexconfig/content.ts b/src/views/product/indexconfig/content.ts
index 7201f04..0318c78 100644
--- a/src/views/product/indexconfig/content.ts
+++ b/src/views/product/indexconfig/content.ts
@@ -9,6 +9,7 @@ const contentConfig: IContentConfig = {
table: {
border: true,
highlightCurrentRow: true,
+ expandRowKeys: [],
rowKey: 'id',
treeProps: {
children: 'skuList' // 指定子节点存储的字段为 customChildren