Commit 204a333f authored by 陈万宝's avatar 陈万宝

feat: 修复保存草稿数据问题

parent c11440e5
...@@ -451,7 +451,7 @@ const ServiceGoods = options => { ...@@ -451,7 +451,7 @@ const ServiceGoods = options => {
!info.infoMation || !info.infoMation ||
!info.infoMation.name || !info.infoMation.name ||
!info.infoMation.categoryId !info.infoMation.categoryId
// (info.infoMation.categoryId.length !== 3 && info.type !== 5) // info.infoMation.categoryId.length !== 3 // 不能限制长度必须为3
) { ) {
message.warning('请添加商品类目和名称'); message.warning('请添加商品类目和名称');
return; return;
...@@ -463,20 +463,23 @@ const ServiceGoods = options => { ...@@ -463,20 +463,23 @@ const ServiceGoods = options => {
info.type = productType; info.type = productType;
let arr = newCategoryList[info.type]; let arr = newCategoryList[info.type];
const first = arr.find(item => item.id === info.infoMation.categoryId[0]); const first = arr.find(item => item.id === info.infoMation.categoryId[0]);
arr = first.children; let second = '';
const second = arr.find(item => item.id === info.infoMation.categoryId[1]); let third = '';
arr = second.children; if (arr.length) {
const third = arr.find(item => item.id === info.infoMation.categoryId[2]); arr = first?.children;
second = arr?.find(item => item.id === info.infoMation.categoryId[1]) || '';
arr = second?.children;
third = arr?.find(item => item.id === info.infoMation.categoryId[2]) || '';
}
const params = { const params = {
productName: info.infoMation.name, productName: info.infoMation.name,
productType: info.type, productType: info.type,
firstCategoryId: info.infoMation.categoryId[0], firstCategoryId: info.infoMation.categoryId[0],
firstCategoryName: first.name, firstCategoryName: first.name,
secondCategoryId: info.infoMation.categoryId[1], secondCategoryId: info.infoMation.categoryId[1],
secondCategoryName: second.name, secondCategoryName: second?.name || '',
thirdCategoryId: info.infoMation.categoryId[2], thirdCategoryId: info.infoMation.categoryId[2],
thirdCategoryName: third?.name, thirdCategoryName: third?.name || '',
content: JSON.stringify(info), content: JSON.stringify(info),
}; };
console.log('params :>> ', params); console.log('params :>> ', params);
......
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