提交 720ec15c authored 作者: 刘旭's avatar 刘旭

优化

上级 f4d45d02
...@@ -176,9 +176,8 @@ let addCartFn = (obj: any) => { ...@@ -176,9 +176,8 @@ let addCartFn = (obj: any) => {
icon: 'none', icon: 'none',
duration: 300, duration: 300,
success() { success() {
goodsInfo.value = {} handleClose()
emits('partsClose') // 还原 emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false skuKey.value = false
} }
}); });
...@@ -244,9 +243,8 @@ let buyNow = (selectShop: any) => { ...@@ -244,9 +243,8 @@ let buyNow = (selectShop: any) => {
}) })
}); });
setTimeout(function() { setTimeout(function() {
goodsInfo.value = {} handleClose()
emits('partsClose') // 还原 emits('partsClose') // 还原
skuPopupRef.value.handClose()
skuKey.value = false skuKey.value = false
}, 300); }, 300);
} }
...@@ -274,7 +272,7 @@ const addProduct = (selectShop: any) => { ...@@ -274,7 +272,7 @@ const addProduct = (selectShop: any) => {
// console.log(selectShop, '加入产品线'); // console.log(selectShop, '加入产品线');
emits('addProduct', selectShop, productId, specifications, specificationCustom) emits('addProduct', selectShop, productId, specifications, specificationCustom)
emits('close-sku', '') // 在修改规格时使用 emits('close-sku', '') // 在修改规格时使用
goodsInfo.value = {} handleClose()
detailData.value = undefined detailData.value = undefined
detailId.value = undefined detailId.value = undefined
} }
...@@ -297,10 +295,18 @@ const getProductId = (specText: any) => { ...@@ -297,10 +295,18 @@ const getProductId = (specText: any) => {
return productId return productId
} }
// 清楚sku数据
const handleClose = () => {
goodsInfo.value = {}
skuPopupRef.value.handClose()
}
defineExpose({ defineExpose({
skuKey, skuKey,
skuMode, skuMode,
init, init,
handleClose,
}); });
</script> </script>
......
...@@ -156,8 +156,10 @@ let closeSku = (val: string) => { ...@@ -156,8 +156,10 @@ let closeSku = (val: string) => {
if (editFlag.value) { if (editFlag.value) {
skuClose.value = val; skuClose.value = val;
if (skuClose.value) { if (skuClose.value) {
// 取消修改后的逻辑
lineList.value.splice(editIndex.value.index, 0, editIndex.value.data); lineList.value.splice(editIndex.value.index, 0, editIndex.value.data);
} else { } else {
// 确定修改产品
let index = lineList.value.length - 2; let index = lineList.value.length - 2;
if (lineList.value.length === 2) index = 0; if (lineList.value.length === 2) index = 0;
let data = lineList.value[index]; let data = lineList.value[index];
...@@ -168,7 +170,10 @@ let closeSku = (val: string) => { ...@@ -168,7 +170,10 @@ let closeSku = (val: string) => {
store.$patch({ store.$patch({
lineData: lineList.value, lineData: lineList.value,
}); });
goodsSkuRef.value.handleClose();
editFlag.value = false; editFlag.value = false;
} else {
goodsSkuRef.value.handleClose();
} }
}; };
...@@ -178,11 +183,11 @@ let editFlag = ref(false); ...@@ -178,11 +183,11 @@ let editFlag = ref(false);
// 产品修改 // 产品修改
let sheetEdit = (index: number) => { let sheetEdit = (index: number) => {
editFlag.value = true; editFlag.value = true;
let data = lineList.value[index];
editIndex.value = { editIndex.value = {
index, index,
data: lineList.value[index], data,
}; };
let data = lineList.value[index];
store.$patch({ store.$patch({
lineData: lineList.value.splice(index, 1), lineData: lineList.value.splice(index, 1),
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论