Commit 2400a604 authored by 武广's avatar 武广

fix: 修改餐段问题

parent 67e599c1
...@@ -213,10 +213,19 @@ const CustomerInfo = props => { ...@@ -213,10 +213,19 @@ const CustomerInfo = props => {
const obj = Object.assign({}, res.data); const obj = Object.assign({}, res.data);
if (res.data.mealTimePeriod && res.data.mealTimePeriod.length) { if (res.data.mealTimePeriod && res.data.mealTimePeriod.length) {
const m = moment().format('YYYY-MM-DD'); const m = moment().format('YYYY-MM-DD');
obj.mealTimePeriod = res.data.mealTimePeriod.map(item => ({ const arr = Object.keys(mealSections);
mealPeriodType: `${item.mealPeriodType}`, obj.mealTimePeriod = Object.keys(mealSections).map(() => ({}));
time: [moment(`${m} ${item.beginTime}`), moment(`${m} ${item.endTime}`)], res.data.mealTimePeriod.forEach((item, i) => {
})); if (item) {
const index = arr.indexOf(`${item.mealPeriodType}`);
if (index > -1) {
obj.mealTimePeriod[index] = {
mealPeriodType: `${item.mealPeriodType}`,
time: [moment(`${m} ${item.beginTime}`), moment(`${m} ${item.endTime}`)],
};
}
}
});
} else { } else {
obj.mealTimePeriod = []; obj.mealTimePeriod = [];
} }
......
...@@ -82,7 +82,7 @@ export const takeawayGoodsColumn = options => { ...@@ -82,7 +82,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: 'SKU编码', title: 'SKU编码',
dataIndex: 'skuId', dataIndex: 'skuId',
width: 160, width: 170,
align: 'center', align: 'center',
}, },
{ {
...@@ -101,7 +101,6 @@ export const takeawayGoodsColumn = options => { ...@@ -101,7 +101,6 @@ export const takeawayGoodsColumn = options => {
{ {
title: '可售日期', title: '可售日期',
dataIndex: 'saleDateList', dataIndex: 'saleDateList',
width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -125,7 +124,6 @@ export const takeawayGoodsColumn = options => { ...@@ -125,7 +124,6 @@ export const takeawayGoodsColumn = options => {
{ {
title: '可售餐段', title: '可售餐段',
dataIndex: 'tabCateList', dataIndex: 'tabCateList',
width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -145,7 +143,7 @@ export const takeawayGoodsColumn = options => { ...@@ -145,7 +143,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '企业价格', title: '企业价格',
dataIndex: 'activityPrice', dataIndex: 'activityPrice',
width: 100, width: 120,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -184,7 +182,7 @@ export const takeawayGoodsColumn = options => { ...@@ -184,7 +182,7 @@ export const takeawayGoodsColumn = options => {
{ {
title: '排序', title: '排序',
dataIndex: 'sort', dataIndex: 'sort',
width: 80, width: 90,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
...@@ -204,8 +202,8 @@ export const takeawayGoodsColumn = options => { ...@@ -204,8 +202,8 @@ export const takeawayGoodsColumn = options => {
{ {
title: '列出商品', title: '列出商品',
dataIndex: 'showFlag', dataIndex: 'showFlag',
width: 80,
align: 'center', align: 'center',
width: 100,
hideInSearch: true, hideInSearch: true,
render: (_, record) => ( render: (_, record) => (
<Space> <Space>
...@@ -217,15 +215,19 @@ export const takeawayGoodsColumn = options => { ...@@ -217,15 +215,19 @@ export const takeawayGoodsColumn = options => {
}, },
{ {
title: '餐品类型', title: '餐品类型',
dataIndex: 'mealType', dataIndex: 'mealTypeList',
width: 80,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render(arr) {
if (arr && arr.length) {
return arr.map(item => item.name).join('/');
}
return '-';
},
}, },
{ {
title: '添加时间', title: '添加时间',
dataIndex: 'createDate', dataIndex: 'createDate',
width: 120,
valueType: 'dateRange', valueType: 'dateRange',
align: 'center', align: 'center',
render(v, record) { render(v, record) {
...@@ -235,7 +237,6 @@ export const takeawayGoodsColumn = options => { ...@@ -235,7 +237,6 @@ export const takeawayGoodsColumn = options => {
{ {
title: '当日餐段', title: '当日餐段',
dataIndex: 'tabId', dataIndex: 'tabId',
width: 120,
align: 'center', align: 'center',
valueEnum: mealColumn, valueEnum: mealColumn,
hideInTable: true, hideInTable: true,
......
...@@ -35,19 +35,41 @@ const TakeawayGoodsInfo = props => { ...@@ -35,19 +35,41 @@ const TakeawayGoodsInfo = 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 = {
shopId, shopId,
enterpriseId: id, enterpriseId: id,
pickSelfIdList: slePickSelf, pickSelfIdList: slePickSelf,
skuInfoList, skuInfoList,
}; };
console.log('params :>> ', params);
const res = await apiSaveGoodsList(params); const res = await apiSaveGoodsList(params);
if (res && res.success) { if (res && res.success) {
notification.success({ message: '添加成功' }); notification.success({ message: '添加成功' });
......
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