From 21b4cf58d21ef51bc910d449d6e4c00f329e5d68 Mon Sep 17 00:00:00 2001 From: qiuxiang <394405259@qq.com> Date: Tue, 27 Oct 2026 16:42:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E8=B4=B9=E8=90=A5=E9=94=80=E8=B4=A6=E6=88=B7=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E4=B8=8E=E5=BA=97=E9=93=BA=E6=98=8E=E7=BB=86=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在店铺收款账户账单中新增推广费(营销账户)页签和第五个指标卡;点击查看明细可打开店铺明细弹窗,固定展示店铺名称、交易时间、备注和支出金额。补充前后端契约与导航测试,当前取数源保持待接入状态。 --- config/business_navigation.php | 1 + .../Http/Controllers/AccountBills.php | 76 +++++++++ .../js/components/business/AccountBills.vue | 160 +++++++++++++++++- resources/assets/js/views/business/pages.js | 6 +- routes/admin.php | 2 + .../PromotionMarketingAccountBillsTest.php | 61 +++++++ tests/Unit/View/AccountBillsTableTest.php | 21 ++- 7 files changed, 314 insertions(+), 13 deletions(-) create mode 100644 tests/Feature/Business/PromotionMarketingAccountBillsTest.php diff --git a/config/business_navigation.php b/config/business_navigation.php index 88ae629f..3e517fb9 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -554,6 +554,7 @@ $navigation = [ ['slug' => 'dewu', 'title' => '得物账户'], ['slug' => 'vipshop', 'title' => '唯品会MP账户'], ['slug' => 'vipshop-jx', 'title' => '唯品会JX账户'], + ['slug' => 'promotion-marketing', 'title' => '推广费(营销账户)'], ], ], [ diff --git a/modules/EcommerceFinance/Http/Controllers/AccountBills.php b/modules/EcommerceFinance/Http/Controllers/AccountBills.php index 1386aa87..795c1315 100644 --- a/modules/EcommerceFinance/Http/Controllers/AccountBills.php +++ b/modules/EcommerceFinance/Http/Controllers/AccountBills.php @@ -40,6 +40,10 @@ class AccountBills extends Controller $billType = $bill_type; + if ($billType === 'promotion-marketing') { + return $this->promotionMarketingIndex($request); + } + if (! AccountBillColumns::has($billType)) { abort(404, '未知的账户类型。'); } @@ -109,6 +113,78 @@ class AccountBills extends Controller return response()->json($this->withLedgerRemarks($data, $billType)); } + /** + * 推广费(营销账户)页签的固定响应结构。 + * + * 各平台取数口径尚未配置,先返回明确的空结果与店铺明细列定义;后续接入时 + * 只替换这里的数据来源,不改页签、卡片和弹窗契约。 + */ + private function promotionMarketingIndex(Request $request) + { + $page = max(1, (int) $request->get('page', 1)); + $limit = min(max((int) $request->get('limit', 10), 1), 100); + + return response()->json([ + 'data' => [], + 'total' => 0, + 'current_page' => $page, + 'last_page' => 1, + 'per_page' => $limit, + 'summary' => [ + 'income' => 0, + 'expense' => 0, + 'balance' => 0, + 'count' => 0, + ], + 'columns' => [ + 'title' => '推广费(营销账户)', + 'groups' => [], + 'columns' => self::promotionExpenseDetailColumns(), + ], + ]); + } + + /** + * 推广费(营销账户)的店铺明细。当前先提供统一空结果,待逐平台取数口径 + * 确定后由专用 Repository 填充;筛选参数与主账单页保持一致。 + */ + public function promotionExpenseDetails(Request $request, string $bill_type) + { + abort_unless($bill_type === 'promotion-marketing', 404); + $this->authorizeStoreReceivingBills(); + + $request->validate([ + 'store_name' => ['nullable', 'string', 'max:255'], + 'ledger_remark' => ['nullable', 'string', 'max:191'], + 'bill_item' => ['nullable', 'string', 'max:255'], + 'start' => ['nullable', 'date_format:Y-m-d'], + 'end' => ['nullable', 'date_format:Y-m-d', 'after_or_equal:start'], + 'keyword' => ['nullable', 'string', 'max:255'], + ]); + + return response()->json([ + 'data' => [], + 'total' => 0, + 'summary' => [ + 'expense' => 0, + 'count' => 0, + ], + 'columns' => self::promotionExpenseDetailColumns(), + 'message' => '推广费数据源尚未配置,接入后将按当前筛选显示店铺明细。', + ]); + } + + /** @return array */ + private static function promotionExpenseDetailColumns(): array + { + return [ + ['label' => '店铺名称', 'field' => 'store_name', 'kind' => 'text'], + ['label' => '交易时间', 'field' => 'occurred_at', 'kind' => 'date'], + ['label' => '备注', 'field' => 'notes', 'kind' => 'text'], + ['label' => '支出金额', 'field' => 'expense', 'kind' => 'money'], + ]; + } + public function export(Request $request, string $bill_type) { $this->authorizeStoreReceivingBills(); diff --git a/resources/assets/js/components/business/AccountBills.vue b/resources/assets/js/components/business/AccountBills.vue index 7307cba6..cbbef0b4 100644 --- a/resources/assets/js/components/business/AccountBills.vue +++ b/resources/assets/js/components/business/AccountBills.vue @@ -1,7 +1,80 @@