|
|
@@ -20,15 +20,16 @@ import moment from 'moment'; |
|
|
|
*/ |
|
|
|
|
|
|
|
const handleUpdate = async (fields) => { |
|
|
|
console.log("fields",fields); |
|
|
|
console.log("fields", fields); |
|
|
|
const hide = message.loading('正在设置可预订数量'); |
|
|
|
try { |
|
|
|
await updateGoods({ |
|
|
|
goodsId: fields.id, |
|
|
|
qty: fields.qty, |
|
|
|
mealType: fields.mealType, |
|
|
|
startReserveTime: fields.startReserveTime, |
|
|
|
endReserveTime: fields.endReserveTime |
|
|
|
week: fields.week, |
|
|
|
// startReserveTime: fields.startReserveTime, |
|
|
|
// endReserveTime: fields.endReserveTime |
|
|
|
}).then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('设置可预订数量成功'); |
|
|
@@ -122,11 +123,11 @@ const GoodsManage = () => { |
|
|
|
valueEnum: goodsTypes, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '可预订数量', |
|
|
|
title: '预订数量', |
|
|
|
dataIndex: 'qty', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '可预定时段', |
|
|
|
title: '用餐时段', |
|
|
|
dataIndex: 'mealType', |
|
|
|
render: (_, record) => { |
|
|
|
var mealtypes = ""; |
|
|
@@ -145,6 +146,35 @@ const GoodsManage = () => { |
|
|
|
return mealtypes; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '星期', |
|
|
|
dataIndex: 'week', |
|
|
|
render: (_, record) => { |
|
|
|
var weeks = ""; |
|
|
|
if (record.week) { |
|
|
|
var str_array = record.week.split(',') |
|
|
|
|
|
|
|
for (var i = 0; i < str_array.length; i++) { |
|
|
|
if (str_array[i] === '1') |
|
|
|
weeks += "[一]"; |
|
|
|
if (str_array[i] === '2') |
|
|
|
weeks += "[二]"; |
|
|
|
if (str_array[i] === '3') |
|
|
|
weeks += "[三]"; |
|
|
|
if (str_array[i] === '4') |
|
|
|
weeks += "[四]"; |
|
|
|
if (str_array[i] === '5') |
|
|
|
weeks += "[五]"; |
|
|
|
if (str_array[i] === '6') |
|
|
|
weeks += "[六]"; |
|
|
|
if (str_array[i] === '7') |
|
|
|
weeks += "[日]"; |
|
|
|
} |
|
|
|
} |
|
|
|
return weeks; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
@@ -157,10 +187,10 @@ const GoodsManage = () => { |
|
|
|
onClick={() => { |
|
|
|
handleModalVisible(true); |
|
|
|
const temp = JSON.parse(JSON.stringify(record)); |
|
|
|
if (temp.startReserveTime) { temp.startReserveTime = temp.startReserveTime = moment(temp.startReserveTime); } |
|
|
|
else {temp.startReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 00:00:00'));} |
|
|
|
if (temp.startReserveTime) { temp.startReserveTime = temp.startReserveTime = moment(temp.startReserveTime); } |
|
|
|
else { temp.startReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 00:00:00')); } |
|
|
|
if (temp.endReserveTime) { temp.endReserveTime = moment(temp.endReserveTime); } |
|
|
|
else { temp.endReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 23:59:59')); } |
|
|
|
else { temp.endReserveTime = moment(moment(new Date(Date.now() + 24 * 60 * 60 * 1000)).format('YYYY-MM-DD 23:59:59')); } |
|
|
|
setCurrentRow(temp); |
|
|
|
}} |
|
|
|
> |
|
|
@@ -211,10 +241,13 @@ const GoodsManage = () => { |
|
|
|
if (typeof value.mealType === 'object') { |
|
|
|
value.mealType = value.mealType.join(); |
|
|
|
} |
|
|
|
if (typeof value.week === 'object') { |
|
|
|
value.week = value.week.join(); |
|
|
|
} |
|
|
|
// value.mealType = value.mealType.join(); |
|
|
|
console.log("调试", value); |
|
|
|
value.startReserveTime = new Date(value.startReserveTime).toLocaleString(); |
|
|
|
value.endReserveTime = new Date(value.endReserveTime).toLocaleString(); |
|
|
|
// value.startReserveTime = new Date(value.startReserveTime).toLocaleString(); |
|
|
|
// value.endReserveTime = new Date(value.endReserveTime).toLocaleString(); |
|
|
|
success = await handleUpdate(value); |
|
|
|
if (success) { |
|
|
|
handleModalVisible(false); |
|
|
|