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

fix: 修改餐段问题

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