diff --git a/src/views/products/Print/AgencyContract.jsx b/src/views/products/Print/AgencyContract.jsx index 3b40a07..9afc078 100644 --- a/src/views/products/Print/AgencyContract.jsx +++ b/src/views/products/Print/AgencyContract.jsx @@ -59,6 +59,18 @@ const tableBorderInnerB = { left: { 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 = { top: { 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']), ]), - ...(isEmpty(agencyProducts['8']) - ? [] - : [ - this.createSubHeading(`附加项目(元/团,部分价格为元/人单独注明)`, { - numbering: { reference: 'products-type', level: 0 }, - }), - ...this.createTable_8(use_year, agencyProducts['8']), - ]), + // ...(isEmpty(agencyProducts['8']) + // ? [] + // : [ + // this.createSubHeading(`附加项目(元/团,部分价格为元/人单独注明)`, { + // numbering: { reference: 'products-type', level: 0 }, + // }), + // ...this.createTable_8(use_year, agencyProducts['8']), + // ]), ...(isEmpty(agencyProducts['D']) ? [] : [ @@ -1126,7 +1138,7 @@ export default class AgencyContract { borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone, children: [ new TableCell({ - borders: ti !== arrt.length - 1 ? tableBorderInner : tableBorderInnerR, + borders: tableBorderInner, width: { size: 2000, type: WidthType.DXA }, verticalAlign: AlignmentType.CENTER, children: [ @@ -1137,7 +1149,7 @@ export default class AgencyContract { ], }), new TableCell({ - borders: ti !== arrt.length - 1 ? tableBorderInner : tableBorderInnerR, + borders: tableBorderInner, width: { size: 1000, type: WidthType.DXA }, verticalAlign: AlignmentType.CENTER, children: [ @@ -1148,7 +1160,7 @@ export default class AgencyContract { ], }), new TableCell({ - borders: ti !== arrt.length - 1 ? tableBorderInnerB : tableBorderNone, + borders: tableBorderInnerB, width: { size: 2400, type: WidthType.DXA }, verticalAlign: AlignmentType.CENTER, children: [ @@ -1170,15 +1182,78 @@ export default class AgencyContract { borders: tableBorderOne, verticalAlign: AlignmentType.LEFT, children: (agencyExtras[row.info?.id] || []).map( - (extra) => - new Paragraph({ - children: [ - new TextRun({ - text: `${extra.info.product_title}-${extra.info.product_type_name_txt}`, - bold: true, + (extra, ti, arrt) => + new Table({ + borders: tableBorderNone, + width: { + size: 100, + 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, + }), + ], + }), + ], + }) + )) + ], }), - ], - }) ), }), ], diff --git a/src/views/products/Print/AgencyPreview.jsx b/src/views/products/Print/AgencyPreview.jsx index 78d5771..17e136f 100644 --- a/src/views/products/Print/AgencyPreview.jsx +++ b/src/views/products/Print/AgencyPreview.jsx @@ -31,7 +31,7 @@ const AgencyPreview = ({ params, ...props }) => { const agencyExtras = await getAgencyAllExtrasAction(params); setExtras(agencyExtras); - // console.log(agencyExtras) + // console.log('agencyExtras', agencyExtras) // 只显示有产品的类型; 展开产品的价格表, 合并名称列; 转化为价格主表, 携带产品属性信息 const hasDataTypes = Object.keys(agencyProducts); @@ -870,17 +870,38 @@ const AgencyPreview = ({ params, ...props }) => { ), }, { - title: '特殊项目', + title: ( + <> + 特殊项目 +
+ - + 成人 + 儿童 +
+ + ), width: '9rem', key: 'extras', render: (_, r) => { const _extras = extras[r.info.id] || []; return ( -
+
{_extras.map((e) => ( +
{e.info.product_title}【{productsTypesMapVal[e.info.product_type_id]?.label || (e.info.product_type_name)}】
+ {e.info.product_type_id === '8' ? (e.quotation).map((ele, qi) => ( +
+
+ {formatGroupSize(ele.group_size_min, ele.group_size_max, true)} + {ele.unit_name} + {ele.adult_cost} + {ele.child_cost} +
+
+ )) : null} +
))}
);