perf: 产品管理: 合同: 附加项目: 直接把价格列在被绑定的景点表格中, 不单独输出附加项目类

main
Lei OT 4 weeks ago
parent 91e58fa3d0
commit 53b1e2d96f

@ -59,6 +59,18 @@ const tableBorderInnerB = {
left: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' }, left: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
right: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' }, right: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
} }
const tableBorderInnerDashB = {
top: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
bottom: { style: BorderStyle.DASHED, space: 0, size: 6, color: 'auto' },
left: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
right: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
}
const tableBorderInnerT = {
top: { style: BorderStyle.INSET, space: 0, size: 6, color: 'auto' },
bottom: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
left: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
right: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
}
const tableBorderInnerR = { const tableBorderInnerR = {
top: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' }, top: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
bottom: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' }, bottom: { style: BorderStyle.NONE, space: 0, size: 6, color: 'auto' },
@ -290,14 +302,14 @@ export default class AgencyContract {
}), }),
...this.createTable_R(use_year, agencyProducts['R']), ...this.createTable_R(use_year, agencyProducts['R']),
]), ]),
...(isEmpty(agencyProducts['8']) // ...(isEmpty(agencyProducts['8'])
? [] // ? []
: [ // : [
this.createSubHeading(`附加项目(元/团,部分价格为元/人单独注明)`, { // this.createSubHeading(`//`, {
numbering: { reference: 'products-type', level: 0 }, // numbering: { reference: 'products-type', level: 0 },
}), // }),
...this.createTable_8(use_year, agencyProducts['8']), // ...this.createTable_8(use_year, agencyProducts['8']),
]), // ]),
...(isEmpty(agencyProducts['D']) ...(isEmpty(agencyProducts['D'])
? [] ? []
: [ : [
@ -1126,7 +1138,7 @@ export default class AgencyContract {
borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone, borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone,
children: [ children: [
new TableCell({ new TableCell({
borders: ti !== arrt.length - 1 ? tableBorderInner : tableBorderInnerR, borders: tableBorderInner,
width: { size: 2000, type: WidthType.DXA }, width: { size: 2000, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER, verticalAlign: AlignmentType.CENTER,
children: [ children: [
@ -1137,7 +1149,7 @@ export default class AgencyContract {
], ],
}), }),
new TableCell({ new TableCell({
borders: ti !== arrt.length - 1 ? tableBorderInner : tableBorderInnerR, borders: tableBorderInner,
width: { size: 1000, type: WidthType.DXA }, width: { size: 1000, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER, verticalAlign: AlignmentType.CENTER,
children: [ children: [
@ -1148,7 +1160,7 @@ export default class AgencyContract {
], ],
}), }),
new TableCell({ new TableCell({
borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone, borders: tableBorderInnerB,
width: { size: 2400, type: WidthType.DXA }, width: { size: 2400, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER, verticalAlign: AlignmentType.CENTER,
children: [ children: [
@ -1170,15 +1182,78 @@ export default class AgencyContract {
borders: tableBorderOne, borders: tableBorderOne,
verticalAlign: AlignmentType.LEFT, verticalAlign: AlignmentType.LEFT,
children: (agencyExtras[row.info?.id] || []).map( children: (agencyExtras[row.info?.id] || []).map(
(extra) => (extra, ti, arrt) =>
new Paragraph({ new Table({
children: [ borders: tableBorderNone,
new TextRun({ width: {
text: `${extra.info.product_title}-${extra.info.product_type_name_txt}`, size: 100,
bold: true, type: WidthType.PERCENTAGE,
},
rows: [
new TableRow({
// borders: tableBorderInnerB,
children: [
new TableCell({
borders: ti === 0 ? tableBorderNone : tableBorderInnerT, // tableBorderInnerB,
// width: { size: 2000, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER,
columnSpan: 3,
children: [
new Paragraph({
children: [
new TextRun({
text: `${extra.info.product_title}-${extra.info.product_type_name_txt}`,
bold: true,
}),
],
})
]
}),
],
}),
...(extra.info.product_type_id !== '8' ? [] : (extra.quotation || []).map(
(quoteItem, ii, _arr) =>
new TableRow({
borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone,
children: [
new TableCell({
borders: tableBorderInner,
width: { size: 2000, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER,
children: [
new Paragraph({
text: `${formatGroupSize(quoteItem.group_size_min, quoteItem.group_size_max, true)}`,
alignment: AlignmentType.LEFT,
}),
],
}),
new TableCell({
borders: tableBorderInner,
width: { size: 1000, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER,
children: [
new Paragraph({
text: `${quoteItem.unit_name}`,
alignment: AlignmentType.LEFT,
}),
],
}),
new TableCell({
borders: tableBorderInnerB,
width: { size: 2400, type: WidthType.DXA },
verticalAlign: AlignmentType.CENTER,
children: [
new Paragraph({
text: `${quoteItem.adult_cost}`,
alignment: AlignmentType.CENTER,
}),
],
}),
],
})
))
],
}), }),
],
})
), ),
}), }),
], ],

@ -31,7 +31,7 @@ const AgencyPreview = ({ params, ...props }) => {
const agencyExtras = await getAgencyAllExtrasAction(params); const agencyExtras = await getAgencyAllExtrasAction(params);
setExtras(agencyExtras); setExtras(agencyExtras);
// console.log(agencyExtras) // console.log('agencyExtras', agencyExtras)
// ; , ; , // ; , ; ,
const hasDataTypes = Object.keys(agencyProducts); const hasDataTypes = Object.keys(agencyProducts);
@ -870,17 +870,38 @@ const AgencyPreview = ({ params, ...props }) => {
), ),
}, },
{ {
title: '特殊项目', title: (
<>
特殊项目
<div className='flex justify-between divide-x divide-y-0 divide-solid divide-stone-200'>
<span className='flex-0 text-center w-32'>-</span>
<span className='flex-1 text-center'>成人</span>
<span className='flex-1 text-center'>儿童</span>
</div>
</>
),
width: '9rem', width: '9rem',
key: 'extras', key: 'extras',
render: (_, r) => { render: (_, r) => {
const _extras = extras[r.info.id] || []; const _extras = extras[r.info.id] || [];
return ( return (
<div> <div className='divide-x-0 divide-y divide-solid divide-stone-200'>
{_extras.map((e) => ( {_extras.map((e) => (
<div key={e.info.id} className='divide-x-0 divide-y divide-solid divide-stone-200 '>
<div key={e.info.id}> <div key={e.info.id}>
{e.info.product_title}{productsTypesMapVal[e.info.product_type_id]?.label || (e.info.product_type_name)} {e.info.product_title}{productsTypesMapVal[e.info.product_type_id]?.label || (e.info.product_type_name)}
</div> </div>
{e.info.product_type_id === '8' ? (e.quotation).map((ele, qi) => (
<div key={qi} className=''>
<div className='flex justify-between text-center divide-x divide-y-0 divide-solid divide-stone-200'>
<span className='flex-0 w-16 text-start'>{formatGroupSize(ele.group_size_min, ele.group_size_max, true)}</span>
<span className='flex-0 w-16'>{ele.unit_name}</span>
<span className='flex-1'>{ele.adult_cost}</span>
<span className='flex-1'>{ele.child_cost}</span>
</div>
</div>
)) : null}
</div>
))} ))}
</div> </div>
); );

Loading…
Cancel
Save