@php $tab = $courierTab ?? 'express'; $filters = $courierFilters ?? []; $rows = $courierRows ?? null; $sync = $courierSyncStatus ?? ['code' => 'unavailable', 'lag_minutes' => null]; $state = $courierState ?? null; $statusLabels = [ 'healthy' => '同步正常', 'delayed' => '同步延迟', 'syncing' => '增量同步中', 'reconciling' => '全量校准中', 'initializing' => '首次同步中', 'initial_failed' => '首次同步失败', 'failed' => '同步失败', 'pending' => '等待首次同步', 'unavailable' => '镜像未建立', ]; $statusClass = in_array($sync['code'] ?? '', ['healthy'], true) ? 'is-success' : (in_array($sync['code'] ?? '', ['failed', 'initial_failed', 'unavailable'], true) ? 'is-danger' : 'is-warning'); $date = static function ($value): string { if ($value === null || $value === '') { return '-'; } try { return \Illuminate\Support\Carbon::parse((string) $value)->format('Y-m-d'); } catch (\Throwable) { return (string) $value; } }; $datetime = static function ($value): string { if ($value === null || $value === '') { return '-'; } try { return \Illuminate\Support\Carbon::parse((string) $value)->format('Y-m-d H:i'); } catch (\Throwable) { return (string) $value; } }; $bool = static function ($value): string { return in_array(strtolower((string) $value), ['1', 'true', 'yes', 'y'], true) || $value === true ? '是' : '否'; }; $tabUrl = static function (string $targetTab) use ($filters): string { return route('business.pages.show', array_merge( ['section' => 'courier-payables', 'page' => 'courier-information', 'courier_tab' => $targetTab], array_filter($filters, static fn ($value) => $value !== '' && $value !== null), )); }; $displayRows = $courierDisplayRows ?? []; $detail = $courierDetail ?? null; $selectedCode = (string) ($detail['code'] ?? ''); $selectedRow = $detail['row'] ?? null; $selectUrl = static function (string $code, array $extra = []) use ($filters): string { $page = (int) request('page', 1); return route('business.pages.show', array_merge( ['section' => 'courier-payables', 'page' => 'courier-information', 'courier_tab' => 'express'], array_filter($filters, static fn ($value) => $value !== '' && $value !== null), $page > 1 ? ['page' => $page] : [], ['selected' => $code], $extra, )); }; @endphp
{{ $statusLabels[$sync['code'] ?? 'unavailable'] ?? '镜像状态未知' }}
@if (!empty($state['last_succeeded_at'])) 最近同步 {{ $datetime($state['last_succeeded_at']) }} @endif @if (($sync['lag_minutes'] ?? null) !== null) 数据延迟 {{ number_format((int) $sync['lag_minutes']) }} 分钟 @endif @if (isset($state['mirror_row_count'])) 主表 {{ number_format((int) $state['mirror_row_count']) }} 条 @endif @if ($rows && !$courierError) 当前结果 {{ number_format($rows->total()) }} 条 @endif
@if ($tab === 'express')
导出 重置 @if ($selectedRow) 编辑 @else @endif
@else
重置
@endif @if ($courierError) @elseif ($courierPending)
首次全量同步完成后刷新本页,即可查询工作平台中的快递资料。
@endif @if ($tab === 'express')
@forelse ($displayRows as $row) @php $code = (string) ($row->expcode ?? ''); $onlyOnboarding = ! empty($row->_onboarding_only); $overridden = $row->_overridden ?? []; $cell = static fn (string $field): string => in_array($field, $overridden, true) ? 'is-overridden' : ''; $enabled = $bool($row->status ?? null) === '是'; $isSelected = $code !== '' && strcasecmp($code, $selectedCode) === 0; @endphp @include('business.pages.courier-payables.partials.courier-onboarding-cells', ['info' => $row->_info ?? null, 'platformName' => $row->expname ?? null, 'platformCode' => $row->expcode ?? null]) @empty @endforelse
ID快递公司代码快递公司名称外部编码杉橙快递代码运费打款方式 是否启用可达服务是否快运自动寻号配货单号寻号数量拆单重量0寻号 停运时间合同开始时间合同结束时间联系人联系电话自定义1自定义2自定义3 体积0寻号手工单号解密电子签章经办人最后修改 入驻单号入驻状态ERP 开通入驻主体 证照生效报价
{{ $row->Id ?? '-' }} @if ($code !== '') {{ $code }} @else 未填代码 @endif {{ $row->expname ?? '-' }} {{ $row->outcode ?? '-' }} {{ $row->scexpcode ?? '-' }} {{ $row->paymethod ?? '-' }} {{ $enabled ? '是' : '否' }} {{ $onlyOnboarding ? '-' : $bool($row->addvalidsgn ?? null) }} {{ $bool($row->kuaiyunsgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->autonosgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->packnosgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->skucountsplitsgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->weight0sgn ?? null) }} {{ $date($row->stopdate ?? null) }} {{ $date($row->tradebtime ?? null) }} {{ $date($row->tradeetime ?? null) }} {{ $row->linker ?? '-' }} {{ $row->linkmobile ?? '-' }} {{ $row->undefined1 ?? '-' }} {{ $row->undefined2 ?? '-' }} {{ $row->undefined3 ?? '-' }} {{ $onlyOnboarding ? '-' : $bool($row->volume0sgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->handnosgn ?? null) }} {{ $onlyOnboarding ? '-' : $bool($row->decryptsgn ?? null) }} {{ $row->dzqzjbr ?? '-' }} {{ $datetime($row->modified ?? null) }}
{{ $courierError ? '数据暂时不可用。' : '当前筛选条件下没有快递资料。' }}
@if ($rows && !$courierError) @endif
@if ($detail) @include('business.pages.courier-payables.partials.courier-information-detail', ['detail' => $detail]) @endif @elseif ($tab === 'networks')
@include('business.pages.courier-payables.partials.courier-network-table', ['networkRows' => $rows ?? [], 'emptyText' => $courierError ? '数据暂时不可用。' : '当前筛选条件下没有网点资料。'])
@if ($rows && !$courierError) @endif
@elseif ($tab === 'accounts') @php $tabOldAccounts = collect($courierFinanceAccounts ?? []) ->map(static fn (array $account): array => ['type' => $account['type'], 'name' => $account['name'], 'number' => $account['number'], 'bank' => $account['bank'], 'source' => $account['source']]) ->merge(($filters['expcode'] ?? '') !== '' && $rows ? collect($rows->items())->map(static fn ($account): array => ['type' => in_array($account->accountType ?? '', ['对公', '对私'], true) ? $account->accountType : '', 'name' => $account->accountName ?? '', 'number' => $account->account ?? '', 'bank' => $account->accountkhh ?? '', 'source' => '工作平台']) : []) ->filter(static fn (array $account): bool => filled($account['number']) && ($filters['expcode'] ?? '') !== '') ->unique('number') ->values(); @endphp
@if ($errors->any() && in_array((string) old('form'), ['add', 'change'], true)) @endif @include('business.pages.courier-payables.partials.courier-payment-account-forms', ['code' => null, 'prefillCode' => $filters['expcode'] ?? '', 'oldAccounts' => $tabOldAccounts])
@include('business.pages.courier-payables.partials.courier-account-table', ['financeAccounts' => $courierFinanceAccounts ?? [], 'platformAccounts' => $rows ?? [], 'showCourier' => true, 'rowActions' => true, 'emptyText' => '当前筛选条件下没有打款信息。'])
@if ($rows && !$courierError) @endif
@else
@include('business.pages.courier-payables.partials.courier-log-table', ['financeEvents' => $courierFinanceEvents ?? collect(), 'platformLogs' => $rows ?? [], 'showCourier' => true, 'emptyText' => '当前筛选条件下没有操作日志。'])
@if ($rows && !$courierError) @endif
@endif