修复库存开关按钮无效问题,增加商品上下架sku联动,修复商品绑定耗材编辑回显问题
This commit is contained in:
@@ -46,10 +46,12 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #isStock="scope">
|
<template #isStock="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
disabled
|
v-if="!scope.row.productId"
|
||||||
v-model="scope.row[scope.prop]"
|
v-model="scope.row[scope.prop]"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
|
:disabled="!scope.row.type"
|
||||||
|
@click="isStockChange(scope.row)"
|
||||||
></el-switch>
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -160,6 +162,7 @@
|
|||||||
<el-table-column label="耗材名称" prop="consInfoId">
|
<el-table-column label="耗材名称" prop="consInfoId">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-select
|
<el-select
|
||||||
|
filterable
|
||||||
v-model="scope.row.consInfoId"
|
v-model="scope.row.consInfoId"
|
||||||
reserve-keyword
|
reserve-keyword
|
||||||
placeholder="请输入关键词"
|
placeholder="请输入关键词"
|
||||||
@@ -167,9 +170,9 @@
|
|||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.id"
|
:key="item.id * 1"
|
||||||
:label="item.conName"
|
:label="item.conName"
|
||||||
:value="item.id"
|
:value="item.id * 1"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<!-- <div class="tips" v-if="scope.row.stockNumber">库存:{{ scope.row.stockNumber }}</div> -->
|
<!-- <div class="tips" v-if="scope.row.stockNumber">库存:{{ scope.row.stockNumber }}</div> -->
|
||||||
@@ -401,13 +404,25 @@ function createItem(val: IObject) {
|
|||||||
haocaiData.value.consList.push(item);
|
haocaiData.value.consList.push(item);
|
||||||
}
|
}
|
||||||
// 上架
|
// 上架
|
||||||
function handleSwitchChange(data: any) {
|
async function handleSwitchChange(data: any) {
|
||||||
|
console.log(data);
|
||||||
let obj = {
|
let obj = {
|
||||||
type: data.productId ? "sku" : "product",
|
type: data.productId ? "sku" : "product",
|
||||||
id: data.id,
|
id: data.id,
|
||||||
isSale: data.isSale,
|
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) {
|
function handleSwitchChangeTwo(data: any) {
|
||||||
@@ -417,6 +432,7 @@ function handleSwitchChangeTwo(data: any) {
|
|||||||
isSoldOut: data.isSoldStock,
|
isSoldOut: data.isSoldStock,
|
||||||
};
|
};
|
||||||
UserAPI.markIsSoldOut(obj);
|
UserAPI.markIsSoldOut(obj);
|
||||||
|
ElMessage.success("修改成功!");
|
||||||
}
|
}
|
||||||
function handleSwitchChangethree(data: any) {
|
function handleSwitchChangethree(data: any) {
|
||||||
let obj = {
|
let obj = {
|
||||||
@@ -427,6 +443,18 @@ function handleSwitchChangethree(data: any) {
|
|||||||
UserAPI.markIsSoldOut(obj);
|
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) {
|
async function handleSwitchhaocai(row: IObject) {
|
||||||
let res = await UserAPI.refundToStock({ isReturn: row.isRefundStock, id: row.id });
|
let res = await UserAPI.refundToStock({ isReturn: row.isRefundStock, id: row.id });
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
table: {
|
table: {
|
||||||
border: true,
|
border: true,
|
||||||
highlightCurrentRow: true,
|
highlightCurrentRow: true,
|
||||||
|
expandRowKeys: [],
|
||||||
rowKey: 'id',
|
rowKey: 'id',
|
||||||
treeProps: {
|
treeProps: {
|
||||||
children: 'skuList' // 指定子节点存储的字段为 customChildren
|
children: 'skuList' // 指定子节点存储的字段为 customChildren
|
||||||
|
|||||||
Reference in New Issue
Block a user