feat: 产品管理: 预览: 单位不一致的样式

main
Lei OT 1 month ago
parent 6f08760876
commit 36ec3f6e3b

@ -249,11 +249,15 @@ const AgencyPreview = ({ params, ...props }) => {
width: '9rem',
fixed: 'left',
render: (_, { quote_season, use_dates_start, use_dates_end, rowSpan }) =>
quote_season === 'SS' ? (rowSpan > 1 ? (
<div key={'ss'}>
平季<div>(除特殊时段外)</div>
</div>
) : '') : (
quote_season === 'SS' ? (
rowSpan > 1 ? (
<div key={'ss'}>
平季<div>(除特殊时段外)</div>
</div>
) : (
''
)
) : (
<div key={'ps'}>
特殊时段
<div>
@ -267,8 +271,63 @@ const AgencyPreview = ({ params, ...props }) => {
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
{ title: '成人', dataIndex: [formatGroupSize(...col), 'adult_cost'], key: 'adult_cost', width: '4rem' },
{ title: '儿童', dataIndex: [formatGroupSize(...col), 'child_cost'], key: 'child_cost', width: '4rem' },
{
title: '成人',
dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: 'adult_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.adult_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => {
const _warning = r.info?.isCityRow !== true && text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return {
children: (
<>
{text}
{_warning ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
};
},
},
{
title: '儿童',
dataIndex: [formatGroupSize(...col), 'child_cost'],
key: 'child_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.child_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => {
const _warning = r.info?.isCityRow !== true && text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return {
children: (
<>
{text}
{_warning ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
};
},
},
],
})),
]}
@ -338,10 +397,68 @@ const AgencyPreview = ({ params, ...props }) => {
title: formatGroupSize(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
// children1: [
// { title: '', dataIndex: [formatGroupSize(...col), 'adult_cost'], key: 'adult_cost' },
// { title: '', dataIndex: [formatGroupSize(...col), 'child_cost'], key: 'child_cost' },
// ],
children: [
{ title: '成人', dataIndex: [formatGroupSize(...col), 'adult_cost'], key: 'adult_cost' },
{ title: '儿童', dataIndex: [formatGroupSize(...col), 'child_cost'], key: 'child_cost' },
],
{
title: '成人',
dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: 'adult_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.adult_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => {
const _warning = r.info?.isCityRow !== true && text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return {
children: (
<>
{text}
{_warning ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
};
},
},
{
title: '儿童',
dataIndex: [formatGroupSize(...col), 'child_cost'],
key: 'child_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.child_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => {
const _warning = r.info?.isCityRow !== true && text
&& r[formatGroupSize(...col)]?.unit_id !== '1';
// && r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return {
children: (
<>
{text}
{_warning ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
};
},
},
]
})),
]}
dataSource={data}
@ -400,7 +517,7 @@ const AgencyPreview = ({ params, ...props }) => {
<div className='divide-x-0 divide-y divide-solid divide-stone-200'>
{(SS || []).length === 1 ? (
<div className='flex justify-between divide-x divide-y-0 divide-solid divide-stone-200'>
<span className='flex-1 text-center'>{SS[0].adult_cost}</span>
<span className={`flex-1 text-center ${SS[0].unit_id !== '1' ? 'bg-yellow-100' : ''}`}>{SS[0].adult_cost}{SS[0].unit_id !== '1' ? ` /${SS[0].unit_name}` : ''}</span>
</div>
) : (
(SS || []).map((ele, qi) => (
@ -409,7 +526,7 @@ const AgencyPreview = ({ params, ...props }) => {
<span className='flex-0 w-32 text-start'>
{formatGroupSize(ele.group_size_min, ele.group_size_max, true)}, {ele.unit_name}
</span>
<span className='flex-1'>{ele.adult_cost}</span>
<span className={`flex-1`}>{ele.adult_cost}</span>
</div>
</div>
))
@ -426,7 +543,7 @@ const AgencyPreview = ({ params, ...props }) => {
<div className='divide-x-0 divide-y divide-solid divide-stone-200'>
{(SS || []).length === 1 ? (
<div className='flex justify-between divide-x divide-y-0 divide-solid divide-stone-200'>
<span className='flex-1 text-center'>{SS[0].child_cost}</span>
<span className={`flex-1 text-center ${SS[0].unit_id !== '1' ? 'bg-yellow-100' : ''}`}>{SS[0].child_cost}{SS[0].unit_id !== '1' ? ` /${SS[0].unit_name}` : ''}</span>
</div>
) : (
(SS || []).map((ele, qi) => (
@ -467,11 +584,35 @@ const AgencyPreview = ({ params, ...props }) => {
</div>
))}
</div>
<span className='flex-1 self-center'>{ele.adult_cost}</span>
<span className={`flex-1 self-center ${ele.unit_id !== '1' ? 'bg-yellow-100' : ''}`}>{ele.adult_cost}{ele.unit_id !== '1' ? ` /${ele.unit_name}` : ''}</span>
</div>
))}
</div>
),
// //
// render: (_, { PSData }) => (
// <div className='divide-x-0 divide-y divide-solid divide-stone-200'>
// {(PSData || []).map((ele, pi) => (
// <div key={pi} className='divide-x-0 divide-y divide-solid divide-stone-200'>
// <div className='flex-0 text-center w-24-'>
// {ele.headerDates.map((d, di) => (
// <div key={di}>
// {d.use_dates_start.replace(`${use_year}.`, '')}~{d.use_dates_end.replace(`${use_year}.`, '')}
// </div>
// ))}
// </div>
// {ele.rows.map((qrow, qri) => (
// <div className='flex justify-between divide-x divide-y-0 divide-solid divide-stone-200' key={qrow.id}>
// <span className='flex-0 w-16 text-start self-center'>{formatGroupSize(qrow.group_size_min, qrow.group_size_max, true)}</span>
// <span className='flex-0 w-10 self-center'>{qrow.unit_name}</span>
// <span className='flex-1 self-center'>{qrow.adult_cost}</span>
// </div>
// ))}
// <div></div>
// </div>
// ))}
// </div>
// ),
},
{
title: '儿童',
@ -489,7 +630,7 @@ const AgencyPreview = ({ params, ...props }) => {
</div>
))}
</div>
<span className='flex-1 self-center'>{ele.child_cost}</span>
<span className={`flex-1 self-center ${ele.unit_id !== '1' ? 'bg-yellow-100' : ''}`}>{ele.child_cost}{ele.unit_id !== '1' ? ` /${ele.unit_name}` : ''}</span>
</div>
))}
</div>
@ -675,11 +816,15 @@ const AgencyPreview = ({ params, ...props }) => {
width: '5rem',
fixed: 'left',
render: (_, { quote_season, use_dates_start, use_dates_end, rowSpan }) =>
quote_season === 'SS' ? (rowSpan > 1 ? (
<div>
平季<div>(除特殊时段外)</div>
</div>
) : '') : (
quote_season === 'SS' ? (
rowSpan > 1 ? (
<div>
平季<div>(除特殊时段外)</div>
</div>
) : (
''
)
) : (
<div>
特殊时段
<div>
@ -693,15 +838,45 @@ const AgencyPreview = ({ params, ...props }) => {
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
{ title: '成人', dataIndex: [formatGroupSize(...col), 'adult_cost'], key: 'adult_cost', width: '4rem' },
{ title: '儿童', dataIndex: [formatGroupSize(...col), 'child_cost'], key: 'child_cost', width: '4rem' },
{
title: '成人',
dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: 'adult_cost',
width: '4rem',
onCell: (r) => {
const text = r[formatGroupSize(...col)]?.adult_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '0';
return { className: _warning ? 'bg-yellow-100' : '' };
},
},
{
title: '儿童',
dataIndex: [formatGroupSize(...col), 'child_cost'],
key: 'child_cost',
width: '4rem',
onCell: (r) => {
const text = r[formatGroupSize(...col)]?.child_cost
const _warning = r.info?.isCityRow !== true
&& text
&& r[formatGroupSize(...col)]?.unit_id !== '0';
return { className: _warning ? 'bg-yellow-100' : '' };
},
},
],
})),
{ title: '司陪餐补(元/团/餐)', dataIndex: 'extra', key: 'extra', width: '4rem',
{
title: '司陪餐补(元/团/餐)',
dataIndex: 'extra',
key: 'extra',
width: '4rem',
onCell: (record, index) => {
return { rowSpan: index === 0 ? data.length : 0 };
},
render: _ => (<>不分人等</>)
render: (_) => <>不分人等</>,
},
]}
dataSource={data}
@ -735,7 +910,9 @@ const AgencyPreview = ({ params, ...props }) => {
title: '附加项目',
dataIndex: ['info', 'product_title'],
key: 'product_title',
width: '12rem', maxWidth: '12rem', className: 'max-w-48',
width: '12rem',
maxWidth: '12rem',
className: 'max-w-48',
fixed: 'left',
onCell: (record) => {
return { rowSpan: record.rowSpan };
@ -748,11 +925,15 @@ const AgencyPreview = ({ params, ...props }) => {
width: '5rem',
fixed: 'left',
render: (_, { quote_season, use_dates_start, use_dates_end, rowSpan }) =>
quote_season === 'SS' ? (rowSpan > 1 ? (
<div>
平季<div>(除特殊时段外)</div>
</div>
) : '') : (
quote_season === 'SS' ? (
rowSpan > 1 ? (
<div>
平季<div>(除特殊时段外)</div>
</div>
) : (
''
)
) : (
<div>
特殊时段
<div>
@ -766,8 +947,48 @@ const AgencyPreview = ({ params, ...props }) => {
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
{ title: '成人', dataIndex: [formatGroupSize(...col), 'adult_cost'], key: 'adult_cost', width: '4rem' },
{ title: '儿童', dataIndex: [formatGroupSize(...col), 'child_cost'], key: 'child_cost', width: '4rem' },
{
title: '成人',
dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: 'adult_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.adult_cost
const _warning = r.info?.isCityRow !== true
&& text
// && r[formatGroupSize(...col)]?.unit_id !== '1';
&& r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => (
<>
{text}
{r.info?.isCityRow !== true && text ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
},
{
title: '儿童',
dataIndex: [formatGroupSize(...col), 'child_cost'],
key: 'child_cost',
width: '4rem',
onCell: (r, ) => {
const text = r[formatGroupSize(...col)]?.child_cost
const _warning = r.info?.isCityRow !== true
&& text
// && r[formatGroupSize(...col)]?.unit_id !== '1';
&& r[formatGroupSize(...col)]?.unit_id !== r.unit_id;
return { className: _warning ? 'bg-yellow-100' : '' };
},
render: (text, r) => (
<>
{text}
{r.info?.isCityRow !== true && text ? ` /${r[formatGroupSize(...col)].unit_name}` : ''}
</>
),
},
],
})),
]}

Loading…
Cancel
Save