Commit a7bdf2f4 authored by 武广's avatar 武广

feat: 虚拟商品校验

parent 2400a604
...@@ -246,7 +246,6 @@ const CustomerInfo = props => { ...@@ -246,7 +246,6 @@ const CustomerInfo = props => {
obj.hideInfo.push('hideImage'); obj.hideInfo.push('hideImage');
} }
obj.mealType = res.data.mealType.map(item => `${item}`); obj.mealType = res.data.mealType.map(item => `${item}`);
console.log('obj :>> ', obj);
setMealTypes(obj.mealType); setMealTypes(obj.mealType);
const json = {}; const json = {};
res.data.mealTimePeriod.forEach(item => { res.data.mealTimePeriod.forEach(item => {
......
...@@ -46,13 +46,34 @@ const VirtualGoodsInfo = props => { ...@@ -46,13 +46,34 @@ const VirtualGoodsInfo = props => {
message.error('请添加商品'); message.error('请添加商品');
return; return;
} }
const skuInfoList = dataSource.map(item => ({ const skuInfoList = [];
skuId: item.skuId, try {
enterprisePrice: item.enterprisePrice, dataSource.forEach(item => {
mealTypeList: item.mealTypeList.map(m => m.code), if (!item.mealTypeList || item.mealTypeList.length < 1) {
saleDateList: item.saleDate, throw Error('请添加餐品类型!');
tabCateList: item.tabCate.map(t => ({ tabId: t })), }
})); if (!item.enterprisePrice || item.enterprisePrice.length < 1) {
throw Error('请添加企业价格!');
}
if (!item.saleDate || item.saleDate.length < 1) {
throw Error('请添加可售日期!');
}
if (!item.tabCate || item.tabCate.length < 1) {
throw Error('请添加可售餐段!');
}
const json = {
skuId: item.skuId,
enterprisePrice: item.enterprisePrice,
mealTypeList: item.mealTypeList.map(m => m.code),
saleDateList: item.saleDate,
tabCateList: item.tabCate.map(t => ({ tabId: t })),
};
skuInfoList.push(json);
});
} catch (e) {
message.error(e.message);
return;
}
const params = { const params = {
enterpriseId: id, enterpriseId: id,
shopId: sleShopID, shopId: sleShopID,
......
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