From e4289f4a5a36a6ced7787ec047b77c1a9c9c99bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Tue, 20 Oct 2026 16:45:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BB=B7=E6=A0=BC=E6=98=8E=E7=BB=86=E6=AD=A3=E8=B4=9F?= =?UTF-8?q?=E5=8F=B7=E7=BB=9F=E4=B8=80=E7=BD=AE=E4=BA=8E=E8=B4=A7=E5=B8=81?= =?UTF-8?q?=E7=AC=A6=E5=8F=B7=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/order/detail/PriceDetail.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/uni-app/src/dynamic-pages/components/order/detail/PriceDetail.vue b/frontend/uni-app/src/dynamic-pages/components/order/detail/PriceDetail.vue index 0e6158ff1..5a368bf22 100644 --- a/frontend/uni-app/src/dynamic-pages/components/order/detail/PriceDetail.vue +++ b/frontend/uni-app/src/dynamic-pages/components/order/detail/PriceDetail.vue @@ -17,13 +17,13 @@ class="info-value" :class="isDiscount(item.value) ? 'discount' : ''" > - {{ isDiscount(item.value) ? '' : '¥' }}{{ item.value }} + {{ formatMoney(item.value) }} {{ $t('实付款') }}: - ¥{{ payPrice || '0.00' }} + {{ formatMoney(payPrice) }} @@ -32,7 +32,7 @@ /** * 价格明细卡片组件 * 展示多行金额明细和实付款总额 - * 折扣类金额(以"-"开头)显示为折扣样式,不带¥符号 + * 正负号统一显示在货币符号前面,例如 +¥2.70、-¥1.00 * 通过 componentKey='price_detail' 匹配 section.component */ export default { @@ -68,6 +68,18 @@ function isDiscount(val) { if (val === null || val === undefined) return false; return String(val).indexOf('-') === 0; } + +/** + * 统一金额显示格式,避免出现 ¥+2.70 这类符号顺序错误 + * @param {string|number} val 金额值 + * @return {string} 带货币符号的金额 + */ +function formatMoney(val) { + const text = String(val === null || val === undefined || val === '' ? '0.00' : val); + const sign = text[0] === '+' || text[0] === '-' ? text[0] : ''; + const amount = sign ? text.slice(1) : text; + return `${sign}¥${amount}`; +}