From 7c07b846eb42962867d7c9815c84f1235158eca0 Mon Sep 17 00:00:00 2001 From: mayf <m13160102112@163.com> Date: 星期四, 12 九月 2024 17:36:38 +0800 Subject: [PATCH] 订单打印增加总金额 --- static/print/custom.css | 4 ++++ components/order/print-list.vue | 14 ++++++-------- pages/order/list/index.vue | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/components/order/print-list.vue b/components/order/print-list.vue index 2d44324..2e270b4 100644 --- a/components/order/print-list.vue +++ b/components/order/print-list.vue @@ -34,7 +34,7 @@ </el-row> <el-table-print :data="item.items" - :summary-method="getSummaries" + :summary-method="getSummaries.bind(this, item.totalAmount)" show-summary border style="width: 100%" @@ -107,17 +107,15 @@ } } }, - getSummaries(param) { + getSummaries(totalAmount, param) { const { columns, data } = param const sums = [] columns.forEach((column, index) => { if (index === 0) { - sums[index] = - '总扎数合计:' + - data.reduce((total, current) => { - total += current.num - return total - }, 0) + sums[index] = `总扎数合计:${data.reduce((total, current) => { + total += current.num + return total + }, 0)} 总金额:¥${totalAmount}` } else { sums[index] = '' } diff --git a/pages/order/list/index.vue b/pages/order/list/index.vue index b82b88e..e370220 100644 --- a/pages/order/list/index.vue +++ b/pages/order/list/index.vue @@ -200,7 +200,7 @@ for (const tr of trs) { const tds = tr.querySelectorAll('td') if (tds && tds.length > 0) { - tds[0].colSpan = 7 + tds[0].colSpan = 8 tds[0].style.textAlign = 'center' } } diff --git a/static/print/custom.css b/static/print/custom.css index e339bfa..3d4deb3 100644 --- a/static/print/custom.css +++ b/static/print/custom.css @@ -18,6 +18,10 @@ font-weight: bold; } +.el-table__footer-wrapper td .cell { + white-space: pre-wrap; +} + .area-text { text-align: center; font-size: 18px; -- Gitblit v1.9.3