提交 005406de authored 作者: 刘旭's avatar 刘旭

优化

上级 8ba8a78c
......@@ -235,7 +235,7 @@ let closeSku = (val: string) => {
skuClose.value = val;
if (skuClose.value) {
// 取消修改后的逻辑
lineList.value.splice(editIndex.value.index, 0, editIndex.value.data);
lineList.value.splice(editIndex.value?.index, 0, editIndex.value.data);
} else {
// 确定修改产品
let index = lineList.value.length - 2;
......@@ -249,11 +249,9 @@ let closeSku = (val: string) => {
lineEdit.value.specifications = data.specifications;
lineEdit.value.number = data.number;
// 当是失效商品需要重新选规格时使用
if (lineList.value[editIndex.value.index + 1].hasOwnProperty('deleted'))
delete lineList.value[editIndex.value.index + 1].deleted;
if (lineList.value[editIndex.value.index + 1].hasOwnProperty('isSubmit'))
delete lineList.value[editIndex.value.index + 1].isSubmit;
if (lineEdit.value.hasOwnProperty('isSubmit')) delete lineEdit.value.isSubmit;
lineList.value.splice(editIndex.value.index, 0, lineEdit.value);
lineEdit.value = null;
} else lineList.value.splice(editIndex.value.index, 0, data);
}
store.$patch({
......@@ -279,6 +277,12 @@ let sheetEdit = (index: number) => {
if (lineId.value) {
data.updateTime = null;
lineEdit.value = data;
console.log(lineEdit.value, 'xiugaua');
if (lineEdit.value.deleted && !lineEdit.value.isSubmit)
return uni.showToast({
title: '请勿修改失效商品',
icon: 'none',
});
}
editIndex.value = {
index,
......@@ -308,6 +312,11 @@ let sheetDel = (index: number) => {
// 产品复制
let sheetCopy = (index: number) => {
if (lineList.value[index].deleted && !lineList.value[index].isSubmit)
return uni.showToast({
title: '请勿复制失效商品',
icon: 'none',
});
flag.value = false;
lineList.value.splice(index, 0, lineList.value[index]);
// 避免splice改变原数组
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论