Commit 77526c73 authored by 武广's avatar 武广

fix: 修改弹窗不显示问题

parent a68f202a
......@@ -329,49 +329,55 @@ const ServiceGoods = options => {
// 保存草稿
const onSaveDraft = async () => {
console.log('newCategoryList :>> ', newCategoryList);
const info = localStorage.get(localAutoSaveKey);
if (info) {
if (
!info.infoMation ||
!info.infoMation.name ||
!info.infoMation.categoryId ||
info.infoMation.categoryId.length !== 3
) {
message.warning('请添加商品类目和名称');
return;
}
info.type = productType;
let arr = newCategoryList[info.type];
const first = arr.find(item => item.id === info.infoMation.categoryId[0]);
arr = first.children;
const second = arr.find(item => item.id === info.infoMation.categoryId[1]);
arr = second.children;
const third = arr.find(item => item.id === info.infoMation.categoryId[2]);
const params = {
productName: info.infoMation.name,
productType: info.type,
firstCategoryId: info.infoMation.categoryId[0],
firstCategoryName: first.name,
secondCategoryId: info.infoMation.categoryId[1],
secondCategoryName: second.name,
thirdCategoryId: info.infoMation.categoryId[2],
thirdCategoryName: third.name,
content: JSON.stringify(info),
};
console.log('params :>> ', params);
setPageLoading(true);
let api = apiCreateDraft;
if (options.isDraft) {
params.id = SourceData.id;
api = apiEditDraft;
}
await api(params);
localStorage.remove(localAutoSaveKey);
setPageLoading(false);
message.success('草稿保存成功!');
handleCancel(true);
if (
!info ||
!info.infoMation ||
!info.infoMation.name ||
!info.infoMation.categoryId ||
info.infoMation.categoryId.length !== 3
) {
message.warning('请添加商品类目和名称');
return;
}
Modal.confirm({
title: '确认提示',
content: '确定将商品信息保存至草稿箱?',
onOk: async () => {
info.type = productType;
let arr = newCategoryList[info.type];
const first = arr.find(item => item.id === info.infoMation.categoryId[0]);
arr = first.children;
const second = arr.find(item => item.id === info.infoMation.categoryId[1]);
arr = second.children;
const third = arr.find(item => item.id === info.infoMation.categoryId[2]);
const params = {
productName: info.infoMation.name,
productType: info.type,
firstCategoryId: info.infoMation.categoryId[0],
firstCategoryName: first.name,
secondCategoryId: info.infoMation.categoryId[1],
secondCategoryName: second.name,
thirdCategoryId: info.infoMation.categoryId[2],
thirdCategoryName: third.name,
content: JSON.stringify(info),
};
console.log('params :>> ', params);
setPageLoading(true);
let api = apiCreateDraft;
if (options.isDraft) {
params.id = SourceData.id;
api = apiEditDraft;
}
await api(params);
localStorage.remove(localAutoSaveKey);
setPageLoading(false);
message.success('草稿保存成功!');
handleCancel(true);
},
});
};
const providerValue = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment