Commit 579d7a99 authored by 陈万宝's avatar 陈万宝

feat:更新列出商品

parent 5e51f768
......@@ -113,32 +113,42 @@ export const filterSendData = (type, params) => {
const { infoMation, infoImageData, attributeApplyList, takeawayItem } = params;
// 外卖商品
if (type === 5) {
const temp = Object.assign({}, takeawayItem?.intactData, infoMation)
temp.categoryId = (Array.isArray(temp.categoryId) && temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString())
temp.productRefShopId = temp.productRefShopId.toString()
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'))
const temp = Object.assign({}, takeawayItem?.intactData, infoMation);
temp.categoryId =
Array.isArray(temp.categoryId) &&
temp.categoryId?.slice(temp.categoryId?.length - 1)?.toString();
temp.productRefShopId = temp.productRefShopId.toString();
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
temp.items.forEach(item => {
item.autoStock = item.autoStock ? 1 : 0
item.serviceItem.autoStock = item?.serviceItem?.autoStock ? 1 : 0
item.productStock = item?.serviceItem?.productStock
item.autoStock = item.autoStock ? 1 : 0;
item.serviceItem.autoStock = item?.serviceItem?.autoStock ? 1 : 0;
item.productStock = item?.serviceItem?.productStock;
item.list = temp.list;
if (item?.specs?.length) {
item?.specs.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
itm.quantity = `${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}`
itm.quantity =
`${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}`;
}
})
}
})
temp.specList && temp.specList.forEach(item => {
if (item?.specs?.length) {
item?.specs.forEach(itm => {
itm.unit = (Array.isArray(itm.unit) && itm.unit?.length>=2 && itm.unit?.splice(itm.unit?.length - 1)[0]) || itm.unit
if (tempWeightName.includes(itm.unit)) {
itm.quantity = `${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}`
}
})
});
}
})
});
temp.specList &&
temp.specList.forEach(item => {
if (item?.specs?.length) {
item?.specs.forEach(itm => {
itm.unit =
(Array.isArray(itm.unit) &&
itm.unit?.length >= 2 &&
itm.unit?.splice(itm.unit?.length - 1)[0]) ||
itm.unit;
if (tempWeightName.includes(itm.unit)) {
itm.quantity =
`${itm?.quantity}`.indexOf('约') > -1 ? itm?.quantity : `${itm?.quantity}`;
}
});
}
});
return temp;
}
const items = filterItems(type, 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