From d9d6cdad9bc47ce5921001dfe29fa66f5bb7f2e3 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Mon, 9 Nov 2026 19:28:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B4=A6=E6=88=B7=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=80=BB=E8=A7=88=E6=94=B9=E4=B8=BA=E4=B8=87=E5=85=83=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=20(#1021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 账户余额总览四项汇总改为万元展示,并保留精确元金额提示 --- .../StoreReceivingBalanceOverview.vue | 29 +++++++++++++++---- .../StoreReceivingBalanceOverviewTest.php | 7 +++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/components/business/StoreReceivingBalanceOverview.vue b/resources/assets/js/components/business/StoreReceivingBalanceOverview.vue index d3cabfb3..f09a4942 100644 --- a/resources/assets/js/components/business/StoreReceivingBalanceOverview.vue +++ b/resources/assets/js/components/business/StoreReceivingBalanceOverview.vue @@ -4,7 +4,7 @@
店铺收款账户
聚合 8 个收款平台的月度期初、收入与支出
+聚合 8 个收款平台的月度期初、收入与支出(单位:万元)
{{ card.note }}
@@ -107,28 +107,32 @@ export default { { key: 'opening_balance', label: '期初余额合计', - value: this.money(this.summary.opening_balance), + value: this.moneyWan(this.summary.opening_balance), + title: this.yuanTitle(this.summary.opening_balance), note: '8 个平台上月期末余额', className: '', }, { key: 'income', label: '收入合计', - value: this.money(this.summary.income), + value: this.moneyWan(this.summary.income), + title: this.yuanTitle(this.summary.income), note: '各平台当月收入', className: 'is-income', }, { key: 'expense', label: '支出合计', - value: this.money(this.summary.expense), + value: this.moneyWan(this.summary.expense), + title: this.yuanTitle(this.summary.expense), note: '各平台当月支出', className: 'is-expense', }, { key: 'balance', label: '期末余额合计', - value: this.money(this.summary.balance), + value: this.moneyWan(this.summary.balance), + title: this.yuanTitle(this.summary.balance), note: '期初余额 + 收入合计 - 支出合计', className: 'is-balance', }, @@ -178,6 +182,19 @@ export default { maximumFractionDigits: 2, })}`; }, + moneyWan(value) { + if (value === null || value === undefined || !Number.isFinite(Number(value))) return '—'; + + return `¥${(Number(value) / 10000).toLocaleString('zh-CN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })}万`; + }, + yuanTitle(value) { + const amount = this.money(value); + + return amount === '—' ? '' : `原值:${amount}`; + }, }, }; diff --git a/tests/Unit/View/StoreReceivingBalanceOverviewTest.php b/tests/Unit/View/StoreReceivingBalanceOverviewTest.php index 9f6bfecc..836fb9dd 100644 --- a/tests/Unit/View/StoreReceivingBalanceOverviewTest.php +++ b/tests/Unit/View/StoreReceivingBalanceOverviewTest.php @@ -23,6 +23,13 @@ class StoreReceivingBalanceOverviewTest extends TestCase $this->assertStringContainsString('params: { month: this.month }', $source); $this->assertStringContainsString('暂不展示不完整合计', $source); $this->assertStringContainsString(':aria-busy="loading', $source); + $this->assertStringContainsString('(单位:万元)', $source); + $this->assertStringContainsString('value: this.moneyWan(this.summary.opening_balance)', $source); + $this->assertStringContainsString('value: this.moneyWan(this.summary.income)', $source); + $this->assertStringContainsString('value: this.moneyWan(this.summary.expense)', $source); + $this->assertStringContainsString('value: this.moneyWan(this.summary.balance)', $source); + $this->assertStringContainsString('}万`;', $source); + $this->assertStringContainsString(':title="card.title"', $source); } public function test_overview_tab_is_placed_before_taobao_alipay_navigation(): void