商家端优化库存预警,管理端 商家端隐藏所有促销活动的删除按钮

master
15386982806 2024-01-11 13:32:39 +08:00
parent 9ce1c966eb
commit 9908b83b18
10 changed files with 130 additions and 76 deletions

View File

@ -99,16 +99,16 @@
@click="close(row)" @click="close(row)"
>关闭 >关闭
</Button> </Button>
<Button <!--<Button-->
class="ml_5" <!--class="ml_5"-->
v-if=" <!--v-if="-->
row.promotionStatus === 'CLOSE' || row.promotionStatus === 'END' <!--row.promotionStatus === 'CLOSE' || row.promotionStatus === 'END'-->
" <!--"-->
type="error" <!--type="error"-->
size="small" <!--size="small"-->
@click="remove(row)" <!--@click="remove(row)"-->
>删除 <!--&gt;删除-->
</Button> <!--</Button>-->
<Button <Button
style="margin: 5px" style="margin: 5px"
type="info" type="info"
@ -286,7 +286,7 @@ export default {
slot: "action", slot: "action",
align: "center", align: "center",
fixed: "right", fixed: "right",
width: 150, width: 250,
}, },
], ],
data: [], // data: [], //

View File

@ -111,13 +111,13 @@
@click="edit(row, 'onlyView')" @click="edit(row, 'onlyView')"
>查看 >查看
</Button> </Button>
<Button <!--<Button-->
type="error" <!--type="error"-->
size="small" <!--size="small"-->
style="margin-right: 10px" <!--style="margin-right: 10px"-->
@click="delAll(row)" <!--@click="delAll(row)"-->
>删除 <!--&gt;删除-->
</Button> <!--</Button>-->
</template> </template>
</Table> </Table>
<Row type="flex" justify="end" class="page"> <Row type="flex" justify="end" class="page">

View File

@ -124,14 +124,14 @@
style="margin-right: 5px" style="margin-right: 5px"
>关闭</Button >关闭</Button
> >
<Button <!--<Button-->
v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'END'" <!--v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'END'"-->
type="error" <!--type="error"-->
size="small" <!--size="small"-->
@click="close(row.id)" <!--@click="close(row.id)"-->
style="margin-right: 5px" <!--style="margin-right: 5px"-->
>删除</Button <!--&gt;删除</Button-->
> <!--&gt;-->
</template> </template>
</Table> </Table>
<Row type="flex" justify="end" class="mt_10"> <Row type="flex" justify="end" class="mt_10">

View File

@ -93,14 +93,14 @@
>关闭</Button >关闭</Button
> >
&nbsp; &nbsp;
<Button <!--<Button-->
type="error" <!--type="error"-->
size="small" <!--size="small"-->
v-if="row.promotionStatus == 'CLOSE' || row.promotionStatus == 'END'" <!--v-if="row.promotionStatus == 'CLOSE' || row.promotionStatus == 'END'"-->
ghost <!--ghost-->
@click="expire(row)" <!--@click="expire(row)"-->
>删除</Button <!--&gt;删除</Button-->
> <!--&gt;-->
</template> </template>
</Table> </Table>

View File

@ -231,6 +231,13 @@ export const updateGoodsSkuStocks = params => {
"Content-Type": "application/json" "Content-Type": "application/json"
}); });
}; };
// 更新商品库存预警
export const updateGoodsAlertStocks = params => {
return putRequest("/goods/goods/update/alert/stocks", params, {
"Content-Type": "application/json"
});
};
// 获取商品分页列表 // 获取商品分页列表
export const getGoodsListDataSeller = params => { export const getGoodsListDataSeller = params => {
return getRequest("/goods/goods/list", params); return getRequest("/goods/goods/list", params);

View File

@ -148,9 +148,9 @@
title="更新库存" title="更新库存"
v-model="updateStockModalVisible" v-model="updateStockModalVisible"
:mask-closable="false" :mask-closable="false"
:width="500" :width="610"
> >
<Tabs value="updateStock"> <Tabs value="updateStock" v-model="updateStockType">
<TabPane label="手动规格更新" name="updateStock"> <TabPane label="手动规格更新" name="updateStock">
<Table <Table
class="mt_10" class="mt_10"
@ -162,8 +162,11 @@
<TabPane label="批量规格更新" name="stockAll"> <TabPane label="批量规格更新" name="stockAll">
<Input type="number" v-model="stockAllUpdate" placeholder="统一规格修改" /> <Input type="number" v-model="stockAllUpdate" placeholder="统一规格修改" />
</TabPane> </TabPane>
<TabPane label="库存预警更新" name="yujing"> <TabPane label="手动库存预警更新" name="alertQuantity">
<Table class="mt_10" :columns="yujingColumns" :data="stockList" border></Table> <Table class="mt_10" :columns="alertQuantityColumns" :data="alertQuantityList" border></Table>
</TabPane>
<TabPane label="批量库存预警更新" name="alertQuantityAll">
<Input type="number" v-model="stockAllAlertQuantity" placeholder="统一库存预警修改" />
</TabPane> </TabPane>
</Tabs> </Tabs>
@ -218,6 +221,7 @@ import {
getGoodsListDataSeller, getGoodsListDataSeller,
getGoodsSkuListDataSeller, getGoodsSkuListDataSeller,
updateGoodsSkuStocks, updateGoodsSkuStocks,
updateGoodsAlertStocks,
upGoods, upGoods,
lowGoods, lowGoods,
deleteGoods, deleteGoods,
@ -244,6 +248,7 @@ export default {
logisticsTemplate: [], // logisticsTemplate: [], //
updateStockModalVisible: false, // updateStockModalVisible: false, //
stockAllUpdate: undefined, // stockAllUpdate: undefined, //
stockAllAlertQuantity: undefined, //
searchForm: { searchForm: {
// //
pageNumber: 1, // pageNumber: 1, //
@ -252,6 +257,7 @@ export default {
order: "desc", // order: "desc", //
}, },
stockList: [], // stockList: [], //
alertQuantityList: [], //
form: { form: {
// //
goodsName: "", goodsName: "",
@ -262,7 +268,7 @@ export default {
}, },
updateStockColumns: [ updateStockColumns: [
{ {
title: "库存预警", title: "sku规格",
key: "sn", key: "sn",
minWidth: 120, minWidth: 120,
render: (h, params) => { render: (h, params) => {
@ -303,9 +309,9 @@ export default {
}, },
}, },
], ],
yujingColumns: [ alertQuantityColumns: [
{ {
title: "sku规格", title: "库存预警",
key: "sn", key: "sn",
minWidth: 120, minWidth: 120,
render: (h, params) => { render: (h, params) => {
@ -335,11 +341,11 @@ export default {
let vm = this; let vm = this;
return h("InputNumber", { return h("InputNumber", {
props: { props: {
value: params.row.quantity, value: params.row.alertQuantity,
}, },
on: { on: {
"on-change": (event) => { "on-change": (event) => {
vm.stockList[params.index].quantity = event; vm.alertQuantityList[params.index].alertQuantity = event;
}, },
}, },
}); });
@ -537,6 +543,7 @@ export default {
], ],
data: [], // data: [], //
total: 0, // total: 0, //
updateStockType: 'updateStock', //
}; };
}, },
methods: { methods: {
@ -577,8 +584,11 @@ export default {
getGoodsSkuListDataSeller({ goodsId: id, pageSize: 1000 }).then((res) => { getGoodsSkuListDataSeller({ goodsId: id, pageSize: 1000 }).then((res) => {
if (res.success) { if (res.success) {
this.updateStockModalVisible = true; this.updateStockModalVisible = true;
this.updateStockType = 'updateStock';
this.stockAllUpdate = undefined; this.stockAllUpdate = undefined;
this.stockList = res.result.records; this.stockList = res.result.records;
this.stockAllAlertQuantity = undefined;
this.alertQuantityList = res.result.records;
} }
}); });
}, },
@ -631,21 +641,41 @@ export default {
}); });
}, },
// //
updateStock() { updateStock () {
let updateStockList = this.stockList.map((i) => { if (this.updateStockType === 'alertQuantity' || this.updateStockType === 'alertQuantityAll') {
let j = { skuId: i.id, quantity: i.quantity }; // alertQuantity alertQuantityAll
if (this.stockAllUpdate) { let updateAlertQuantityList = this.alertQuantityList.map((i) => {
j.quantity = this.stockAllUpdate; let j = { skuId: i.id, alertQuantity: i.alertQuantity };
} if (this.stockAllAlertQuantity) {
return j; j.alertQuantity = this.stockAllAlertQuantity;
}); }
updateGoodsSkuStocks(updateStockList).then((res) => { return j;
if (res.success) { });
this.updateStockModalVisible = false; updateGoodsAlertStocks(updateAlertQuantityList).then((res) => {
this.$Message.success("更新库存成功"); if (res.success) {
this.getDataList(); this.updateStockModalVisible = false;
} this.$Message.success("更新库存预警成功");
}); this.getDataList();
}
});
} else if (this.updateStockType === 'updateStock' || this.updateStockType === 'stockAll') {
// updateStock stockAll
let updateStockList = this.stockList.map((i) => {
let j = { skuId: i.id, quantity: i.quantity };
if (this.stockAllUpdate) {
j.quantity = this.stockAllUpdate;
}
return j;
});
updateGoodsSkuStocks(updateStockList).then((res) => {
if (res.success) {
this.updateStockModalVisible = false;
this.$Message.success("更新库存成功");
this.getDataList();
}
});
}
}, },
// //
changePage(v) { changePage(v) {

View File

@ -213,8 +213,8 @@
overflow-x: hidden; overflow-x: hidden;
} }
"> ">
<template slot="yujing" slot-scope="{ row }"> <template slot="alertQuantity" slot-scope="{ row }">
<Input v-model="row.yujing" clearable placeholder="请输入库存预警" @on-change="updateSkuTable(row, 'yujing')"> <Input v-model="row.alertQuantity" clearable placeholder="请输入库存预警" @on-change="updateSkuTable(row, 'alertQuantity')">
<span slot="append">{{baseInfoForm.goodsUnit || ""}}</span> <span slot="append">{{baseInfoForm.goodsUnit || ""}}</span>
</Input> </Input>
</template> </template>
@ -644,6 +644,7 @@ export default {
"price", "price",
"weight", "weight",
"quantity", "quantity",
"alertQuantity",
"specId", "specId",
"specValueId", "specValueId",
], ],
@ -1057,6 +1058,7 @@ export default {
price: e.price, price: e.price,
// cost: e.cost, // cost: e.cost,
quantity: e.quantity, quantity: e.quantity,
alertQuantity: e.alertQuantity,
weight: e.weight, weight: e.weight,
}; };
e.specList.forEach((u) => { e.specList.forEach((u) => {
@ -1360,6 +1362,7 @@ export default {
find.sn && (find.sn = ""); find.sn && (find.sn = "");
// find.cost && (find.cost = ""); // find.cost && (find.cost = "");
find.quantity && (find.quantity = ""); find.quantity && (find.quantity = "");
find.alertQuantity && (find.alertQuantity = "");
find.weight && (find.weight = ""); find.weight && (find.weight = "");
this.skuTableData.splice(this.skuTableData.length, 0, find); this.skuTableData.splice(this.skuTableData.length, 0, find);
@ -1374,6 +1377,7 @@ export default {
find.sn && (find.sn = ""); find.sn && (find.sn = "");
// find.cost && (find.cost = ""); // find.cost && (find.cost = "");
find.quantity && (find.quantity = ""); find.quantity && (find.quantity = "");
find.alertQuantity && (find.alertQuantity = "");
find.weight && (find.weight = ""); find.weight && (find.weight = "");
this.skuTableData.splice(index, 0, find); this.skuTableData.splice(index, 0, find);
@ -1421,10 +1425,7 @@ export default {
key: columnName, key: columnName,
}); });
}); });
pushData.push({
title: "库存预警",
slot: "yujing",
});
// //
if (this.baseInfoForm.salesModel !== "WHOLESALE") { if (this.baseInfoForm.salesModel !== "WHOLESALE") {
pushData.push( pushData.push(
@ -1458,12 +1459,15 @@ export default {
slot: "weight", slot: "weight",
}); });
} }
pushData.push( pushData.push(
{ {
title: "库存", title: "库存",
slot: "quantity", slot: "quantity",
}, },
{
title: "库存预警",
slot: "alertQuantity",
},
{ {
title: "货号", title: "货号",
slot: "sn", slot: "sn",
@ -1510,6 +1514,7 @@ export default {
id: skus[index].id, id: skus[index].id,
sn: skus[index].sn, sn: skus[index].sn,
quantity: skus[index].quantity, quantity: skus[index].quantity,
alertQuantity: skus[index].alertQuantity,
cost: 1, cost: 1,
price: skus[index].price, price: skus[index].price,
[spec[0].name]: specItem.value, [spec[0].name]: specItem.value,
@ -1591,6 +1596,17 @@ export default {
this.validatatxt = "请输入0~99999999之间的整数"; this.validatatxt = "请输入0~99999999之间的整数";
return; return;
} }
} else if (item === "alertQuantity") {
if (
!/^[0-9]\d*$/.test(row[item]) ||
parseInt(row[item]) < 0 ||
parseInt(row[item]) > 99999999
) {
//
this.validateError.push([index, item]);
this.validatatxt = "请输入0~99999999之间的整数";
return;
}
} }
// else if (item === "cost" || item === "price") { // else if (item === "cost" || item === "price") {
// if ( // if (
@ -1684,6 +1700,7 @@ export default {
cost: 1, cost: 1,
price: sku.price, price: sku.price,
quantity: sku.quantity, quantity: sku.quantity,
alertQuantity: sku.alertQuantity,
sn: sku.sn, sn: sku.sn,
images: sku.images, images: sku.images,
}; };

View File

@ -235,7 +235,7 @@ export default {
slot: "action", slot: "action",
align: "center", align: "center",
fixed: "right", fixed: "right",
maxWidth: 140, maxWidth: 240,
}, },
], ],
data: [], // data: [], //

View File

@ -43,8 +43,8 @@
@click="openOrClose(row)">关闭</Button> @click="openOrClose(row)">关闭</Button>
<Button type="success" v-if="row.promotionStatus === 'CLOSE'" style="margin-left: 5px" size="small" <Button type="success" v-if="row.promotionStatus === 'CLOSE'" style="margin-left: 5px" size="small"
@click="openOrClose(row)">开启</Button> @click="openOrClose(row)">开启</Button>
<Button type="error" :disabled="row.promotionStatus == 'START'" style="margin-left: 5px" size="small" <!--<Button type="error" :disabled="row.promotionStatus == 'START'" style="margin-left: 5px" size="small"-->
@click="del(row)">删除</Button> <!--@click="del(row)">删除</Button>-->
</div> </div>
</template> </template>
</Table> </Table>

View File

@ -77,13 +77,13 @@
@click="manage(row, 'view')" @click="manage(row, 'view')"
>查看</Button >查看</Button
> >
<Button <!--<Button-->
type="error" <!--type="error"-->
size="small" <!--size="small"-->
v-if="row.promotionStatus != 'START'" <!--v-if="row.promotionStatus != 'START'"-->
@click="remove(row)" <!--@click="remove(row)"-->
>删除</Button <!--&gt;删除</Button-->
> <!--&gt;-->
<Button <Button
type="success" type="success"
v-if="row.promotionStatus == 'CLOSE'" v-if="row.promotionStatus == 'CLOSE'"