From 36ec3f6e3b8199ddbe0b1376de3eb9aa5dd679d7 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 20 Aug 2025 13:58:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20=E9=A2=84=E8=A7=88:=20=E5=8D=95=E4=BD=8D=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Print/AgencyPreview.jsx | 285 ++++++++++++++++++--- 1 file changed, 253 insertions(+), 32 deletions(-) diff --git a/src/views/products/Print/AgencyPreview.jsx b/src/views/products/Print/AgencyPreview.jsx index c702dab..032dfc2 100644 --- a/src/views/products/Print/AgencyPreview.jsx +++ b/src/views/products/Print/AgencyPreview.jsx @@ -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 ? ( -
- 平季
(除特殊时段外)
-
- ) : '') : ( + quote_season === 'SS' ? ( + rowSpan > 1 ? ( +
+ 平季
(除特殊时段外)
+
+ ) : ( + '' + ) + ) : (
特殊时段
@@ -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 }) => {
{(SS || []).length === 1 ? (
- {SS[0].adult_cost} + {SS[0].adult_cost}{SS[0].unit_id !== '1' ? ` /${SS[0].unit_name}` : ''}
) : ( (SS || []).map((ele, qi) => ( @@ -409,7 +526,7 @@ const AgencyPreview = ({ params, ...props }) => { {formatGroupSize(ele.group_size_min, ele.group_size_max, true)}, {ele.unit_name} - {ele.adult_cost} + {ele.adult_cost}
)) @@ -426,7 +543,7 @@ const AgencyPreview = ({ params, ...props }) => {
{(SS || []).length === 1 ? (
- {SS[0].child_cost} + {SS[0].child_cost}{SS[0].unit_id !== '1' ? ` /${SS[0].unit_name}` : ''}
) : ( (SS || []).map((ele, qi) => ( @@ -467,11 +584,35 @@ const AgencyPreview = ({ params, ...props }) => {
))}
- {ele.adult_cost} + {ele.adult_cost}{ele.unit_id !== '1' ? ` /${ele.unit_name}` : ''} ))} ), + // // 表格形式 + // render: (_, { PSData }) => ( + //
+ // {(PSData || []).map((ele, pi) => ( + //
+ //
+ // {ele.headerDates.map((d, di) => ( + //
+ // {d.use_dates_start.replace(`${use_year}.`, '')}~{d.use_dates_end.replace(`${use_year}.`, '')} + //
+ // ))} + //
+ // {ele.rows.map((qrow, qri) => ( + //
+ // {formatGroupSize(qrow.group_size_min, qrow.group_size_max, true)} + // {qrow.unit_name} + // {qrow.adult_cost} + //
+ // ))} + //
+ //
+ // ))} + //
+ // ), }, { title: '儿童', @@ -489,7 +630,7 @@ const AgencyPreview = ({ params, ...props }) => { ))} - {ele.child_cost} + {ele.child_cost}{ele.unit_id !== '1' ? ` /${ele.unit_name}` : ''} ))} @@ -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 ? ( -
- 平季
(除特殊时段外)
-
- ) : '') : ( + quote_season === 'SS' ? ( + rowSpan > 1 ? ( +
+ 平季
(除特殊时段外)
+
+ ) : ( + '' + ) + ) : (
特殊时段
@@ -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 ? ( -
- 平季
(除特殊时段外)
-
- ) : '') : ( + quote_season === 'SS' ? ( + rowSpan > 1 ? ( +
+ 平季
(除特殊时段外)
+
+ ) : ( + '' + ) + ) : (
特殊时段
@@ -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}` : ''} + + ), + }, ], })), ]}