From 666efc26b6f5a1dd84cd7ec17e8d7098a6030c2d Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Tue, 29 Sep 2026 10:15:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=94=AF=E5=93=81=E4=BC=9AMP=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95=E7=BB=93=E7=AE=97=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 唯品会MP账户账单在「订单签收或退款时间」后新增「订单结算时间」,取账单结算期间(YYYY-MM,当前系统内全部为 2026-08);列定义与导出共用 AccountBillColumns。现网 913 行的 payload 已补 settle_period=2026-08(先备份原 payload,校验无冲突后按 JSON_SET 更新,笔数与金额不变),并补齐 MP 页签的功能测试。 --- .../EcommerceFinance/AccountBillColumns.php | 1 + .../Business/VipshopMpReceivingBillsTest.php | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/Feature/Business/VipshopMpReceivingBillsTest.php diff --git a/modules/EcommerceFinance/AccountBillColumns.php b/modules/EcommerceFinance/AccountBillColumns.php index fa3cb0e4..b577370e 100644 --- a/modules/EcommerceFinance/AccountBillColumns.php +++ b/modules/EcommerceFinance/AccountBillColumns.php @@ -65,6 +65,7 @@ class AccountBillColumns ['店铺ID', 'payload.shop_id', 'num'], ['店铺名称', 'store_name', 'text'], ['订单签收或退款时间', 'occurred_at', 'date'], + ['订单结算时间', 'payload.settle_period', 'date'], ['订单类型名称', 'bill_item', 'text'], ['行类型名称', 'payload.vip_5', 'text'], ['售后类型名称', 'payload.vip_6', 'text'], diff --git a/tests/Feature/Business/VipshopMpReceivingBillsTest.php b/tests/Feature/Business/VipshopMpReceivingBillsTest.php new file mode 100644 index 00000000..a331180f --- /dev/null +++ b/tests/Feature/Business/VipshopMpReceivingBillsTest.php @@ -0,0 +1,59 @@ +allowPage(); + $this->bill('vipshop', '2761547331', '销售订单', '2026-07-31 20:38:40', 39.00, 0.00); + $this->bill('vipshop', '2761292184', '订单退款', '2026-07-31 19:34:32', 0.00, 20.00); + $this->bill('vipshop-jx', '4675', '差异详情-处罚款', '2026-07-16 00:00:00', 0.00, 8.00); + + $response = $this->loginAs() + ->getJson(route('ecommerce-finance.account-bills.index', ['bill_type' => 'vipshop', 'limit' => 20])) + ->assertOk() + ->assertJsonPath('columns.title', '唯品会MP账户') + ->assertJsonPath('total', 2) + ->assertJsonPath('data.0.payload.settle_period', '2026-08') + ->assertJsonPath('data.1.payload.settle_period', '2026-08'); + + $this->assertSame( + ['全局ID', '店铺ID', '店铺名称', '订单签收或退款时间', '订单结算时间', '订单类型名称'], + array_slice(array_column($response->json('columns.columns'), 'label'), 0, 6), + ); + } + + private function bill(string $billType, string $recordCode, string $item, string $occurredAt, float $income, float $expense): void + { + AccountBill::create([ + 'company_id' => $this->company->id, + 'bill_type' => $billType, + 'record_code' => $recordCode, + 'store_name' => $billType === 'vipshop' ? '卓禾家具特卖旗舰店' : '唯品会JITX_亿家达', + 'order_no' => '26072734938113', + 'amount' => $income - $expense, + 'bill_item' => $item, + 'occurred_at' => $occurredAt, + 'income' => $income, + 'expense' => $expense, + // 现财务系统中唯品会MP账户的订单结算时间均为 2026-08。 + 'payload' => ['shop_id' => 'ST64055434', 'settle_period' => '2026-08'], + ]); + } + + private function allowPage(): void + { + $this->user->attachPermission( + Permission::where('name', 'read-admin-panel')->firstOrFail() + ); + } +}