Commit f50d20a4 authored by 武广's avatar 武广

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

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