Commit f50d20a4 authored by 武广's avatar 武广

fix: 修改餐段、可售日期问题

parent 33d07729
......@@ -36,7 +36,13 @@ const SaleDateModal = props => {
useEffect(() => {
if (props.visible) {
let v = [];
const dateList = props.item?.saleDateList || props.item?.saleDate;
let dateList = [];
if (props.item) {
if (props.type) {
dateList = props.item[props.type];
}
dateList = dateList || props.item.saleDateList || props.item.saleDate;
}
if (dateList && dateList.length) {
v = dateList.map(item => {
if (typeof item === 'object') {
......
......@@ -41,14 +41,20 @@ const SaleDateModal = props => {
const res = await apiEnterpriseInfo(props.enterpriseID);
setLoading(false);
if (res && res.data && res.data.mealTimePeriod && res.data.mealTimePeriod.length) {
setTabCateList(res.data.mealTimePeriod.map(item => item.mealPeriodType));
setTabCateList(res.data.mealTimePeriod.map(item => `${item.mealPeriodType}`));
}
};
useEffect(() => {
if (props.visible) {
let v = [];
const tabCate = props.item.tabCateList || props.item.tabCate;
let tabCate = [];
if (props.item) {
if (props.type) {
tabCate = props.item[props.type];
}
tabCate = tabCate || props.item.tabCateList || props.item.tabCate;
}
if (tabCate && tabCate.length) {
v = tabCate.map(item => {
if (typeof item === 'object') {
......@@ -58,8 +64,10 @@ const SaleDateModal = props => {
});
}
setValue(v);
if (props.enterpriseID) {
getEnterpriseMealColumn();
}
}
}, [props.visible]);
return (
......
......@@ -236,6 +236,7 @@ const VirtualGoodsInfo = props => {
<SaleDateModal
visible={visibleSaleDate}
item={editItem}
type="saleDate"
handleRefresh={v => refreshList('saleDate', v)}
handleClose={() => setVisibleSaleDate(false)}
/>
......@@ -245,6 +246,7 @@ const VirtualGoodsInfo = props => {
<SaleSectionModal
visible={visibleSaleSection}
item={editItem}
type="tabCate"
enterpriseID={id}
handleRefresh={v => refreshList('tabCate', v)}
handleClose={() => setVisibleSaleSection(false)}
......
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