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.value }} + {{ card.value }} --

{{ 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