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