feat: 配置提现管理预留标准 #247

Merged
yutu merged 2 commits from feature/92451-withdrawal-reserve-standards into main 2026-09-23 11:15:24 +08:00
5 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace App\Business;
final class WithdrawalReserveStandard
{
private const TMALL_HIGH_RESERVE_STORES = [
'天猫-亿家达旗舰店',
'天猫-欧意朗旗舰店',
'天猫-卓禾家具旗舰店',
];
private const PLATFORM_DEFAULTS = [
'天猫' => 20000,
'淘宝' => 10000,
'淘宝分销' => 10000,
'阿里巴巴' => 10000,
'京东' => 5000,
'京喜' => 5000,
'抖音' => 5000,
'拼多多' => 5000,
];
public static function amountFor(?string $platform, ?string $erpStoreName): ?int
{
$platform = trim((string) $platform);
$erpStoreName = trim((string) $erpStoreName);
if ($platform === '天猫' && in_array($erpStoreName, self::TMALL_HIGH_RESERVE_STORES, true)) {
return 50000;
}
return self::PLATFORM_DEFAULTS[$platform] ?? null;
}
}

View File

@ -10,6 +10,7 @@ use App\Business\TableRegistry;
use App\Business\UpstreamBusinessInformation;
use App\Business\StoreReceivingAccountTemplate;
use App\Business\StoreReceivingAccountWorkbookImporter;
use App\Business\WithdrawalReserveStandard;
use App\Models\Banking\MarketingAccountBill;
use App\Models\Business\CourierAgreementSignature;
use App\Models\Business\CourierQuoteSignature;
@ -940,6 +941,14 @@ class Pages extends Controller
$page,
['path' => request()->url(), 'query' => request()->except('page')],
);
$withdrawalReserveStandards = $withdrawalRows->getCollection()->mapWithKeys(
static fn (StoreReceivingAccount $row): array => [
(int) $row->id => WithdrawalReserveStandard::amountFor(
$row->store_platform,
$row->erp_store_name,
),
],
)->all();
return [
'view' => 'business.pages.fund-management.withdrawal-management',
@ -948,6 +957,7 @@ class Pages extends Controller
'withdrawalPlatforms' => $platforms,
'withdrawalPaths' => $withdrawalPaths,
'withdrawalBalances' => $withdrawalBalances,
'withdrawalReserveStandards' => $withdrawalReserveStandards,
'withdrawalBalanceSummary' => [
'source' => $this->jushuitanShopBalances->countForDate($balanceDate->toDateString()),
'matched' => (int) $balanceCounts->get('matched', 0),

View File

@ -85,6 +85,7 @@
$balanceTitle = $balanceMatch['status'] === 'matched'
? '聚水潭店铺:' . $balanceMatch['source_store_name'] . ';余额日期:' . $withdrawalBalanceDate
: '余额日期:' . $withdrawalBalanceDate;
$reserveStandard = $withdrawalReserveStandards[(int) $row->id] ?? null;
@endphp
<tr>
<td>{{ $row->store_platform ?: '未配置' }}</td>
@ -95,7 +96,7 @@
<td>{{ $row->withdrawal_account_name ?: '未配置' }}</td>
<td>{{ $bankCard }}</td>
<td class="num" title="{{ $balanceTitle }}">{{ $balanceText }}</td>
<td class="num">待配置</td>
<td class="num">{{ $reserveStandard === null ? '待配置' : number_format($reserveStandard, 2) }}</td>
<td class="num">待接入</td>
<td><span class="biz-badge biz-badge-no">待核验</span></td>
</tr>

View File

@ -131,6 +131,8 @@ class ManagementCrudTest extends FeatureTestCase
->assertSeeText('已显示余额 1 条')
->assertSeeText('余额状态')
->assertSeeText('预留标准')
->assertSeeText('20,000.00')
->assertSeeText('5,000.00')
->assertSeeText('提现金额')
->assertSeeText('是否达标')
->assertSeeText('待核验')

View File

@ -0,0 +1,43 @@
<?php
namespace Tests\Unit\Business;
use App\Business\WithdrawalReserveStandard;
use PHPUnit\Framework\TestCase;
class WithdrawalReserveStandardTest extends TestCase
{
public function test_special_tmall_stores_use_fifty_thousand_reserve(): void
{
foreach ([
'天猫-亿家达旗舰店',
'天猫-欧意朗旗舰店 ',
'天猫-卓禾家具旗舰店',
] as $storeName) {
$this->assertSame(50000, WithdrawalReserveStandard::amountFor('天猫', $storeName));
}
}
public function test_platform_defaults_are_applied(): void
{
$expected = [
'天猫' => 20000,
'淘宝' => 10000,
'淘宝分销' => 10000,
'阿里巴巴' => 10000,
'京东' => 5000,
'京喜' => 5000,
'抖音' => 5000,
'拼多多' => 5000,
];
foreach ($expected as $platform => $amount) {
$this->assertSame($amount, WithdrawalReserveStandard::amountFor($platform, '普通店铺'));
}
}
public function test_unconfigured_platform_has_no_invented_standard(): void
{
$this->assertNull(WithdrawalReserveStandard::amountFor('唯品会', '唯品会-测试店铺'));
}
}