feat: 精简安装明细筛选区并增加生效条件标签 #602
@ -212,16 +212,39 @@ class InstallationDetailMirrorRepository
|
||||
public static function requestFilters(): array
|
||||
{
|
||||
$rules = [];
|
||||
$rules['time_scope'] = ['nullable', 'in:created,customer_review,finance_review'];
|
||||
$rules['date_from'] = ['nullable', 'date_format:Y-m-d'];
|
||||
$rules['date_to'] = ['nullable', 'date_format:Y-m-d'];
|
||||
if (request()->filled('date_from')) $rules['date_to'][] = 'after_or_equal:date_from';
|
||||
foreach (['created', 'customer_review', 'finance_review'] as $prefix) {
|
||||
$rules[$prefix . '_from'] = ['nullable', 'date_format:Y-m-d'];
|
||||
$rules[$prefix . '_to'] = ['nullable', 'date_format:Y-m-d'];
|
||||
if (request()->filled($prefix . '_from')) $rules[$prefix . '_to'][] = 'after_or_equal:' . $prefix . '_from';
|
||||
}
|
||||
foreach (['push_status','order_no','customer_review','finance_review','quote_status','arranged_status','fee_payer','completed_status','shop_name','delete_status','installation_company','installation_no','order_type','product_id'] as $key) {
|
||||
foreach (['push_status','order_no','customer_review','finance_review','quote_status','arranged_status','fee_payer','completed_status','shop_name','shop_code','delete_status','installation_company','installation_no','order_type','product_id'] as $key) {
|
||||
$rules[$key] = ['nullable', 'string', 'max:191'];
|
||||
}
|
||||
foreach (['customer_review', 'finance_review', 'arranged_status', 'completed_status', 'delete_status'] as $key) $rules[$key][] = 'in:0,1';
|
||||
return validator(request()->only(array_keys($rules)), $rules)->validate();
|
||||
$filters = validator(request()->only(array_keys($rules)), $rules)->validate();
|
||||
if (! array_key_exists('time_scope', $filters)
|
||||
&& ! array_key_exists('date_from', $filters)
|
||||
&& ! array_key_exists('date_to', $filters)) {
|
||||
return $filters;
|
||||
}
|
||||
|
||||
$scope = (string) ($filters['time_scope'] ?? 'customer_review');
|
||||
$prefix = match ($scope) {
|
||||
'created' => 'created',
|
||||
'finance_review' => 'finance_review',
|
||||
default => 'customer_review',
|
||||
};
|
||||
foreach (['created', 'customer_review', 'finance_review'] as $legacyPrefix) {
|
||||
unset($filters[$legacyPrefix . '_from'], $filters[$legacyPrefix . '_to']);
|
||||
}
|
||||
$filters[$prefix . '_from'] = $filters['date_from'] ?? null;
|
||||
$filters[$prefix . '_to'] = $filters['date_to'] ?? null;
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
private function applyFilters($query, array $filters, string $itemTable): void
|
||||
@ -230,7 +253,7 @@ class InstallationDetailMirrorRepository
|
||||
if (!empty($filters[$prefix.'_from'])) $query->where('v.'.$column, '>=', $filters[$prefix.'_from']);
|
||||
if (!empty($filters[$prefix.'_to'])) $query->where('v.'.$column, '<', \Illuminate\Support\Carbon::parse($filters[$prefix.'_to'])->addDay()->toDateString());
|
||||
}
|
||||
foreach (['push_status'=>'apistatus','order_no'=>'OrderNum','quote_status'=>'BidStatus','fee_payer'=>'costtaker','shop_name'=>'shop_name','installation_company'=>'installCompanyName','installation_no'=>'ordernum_id','order_type'=>'TypeDto'] as $key=>$column) {
|
||||
foreach (['push_status'=>'apistatus','order_no'=>'OrderNum','quote_status'=>'BidStatus','fee_payer'=>'costtaker','shop_name'=>'shop_name','shop_code'=>'shopcode','installation_company'=>'installCompanyName','installation_no'=>'ordernum_id','order_type'=>'TypeDto'] as $key=>$column) {
|
||||
if (isset($filters[$key]) && $filters[$key] !== '') $query->where('v.'.$column, $filters[$key]);
|
||||
}
|
||||
foreach (['customer_review'=>'kfsh','finance_review'=>'cwsh','completed_status'=>'installComplete','delete_status'=>'Delete'] as $key=>$column) {
|
||||
|
||||
@ -286,6 +286,7 @@
|
||||
});
|
||||
|
||||
input.addEventListener('click', open);
|
||||
input.addEventListener('input', syncClear);
|
||||
input.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown') {
|
||||
event.preventDefault();
|
||||
|
||||
@ -381,8 +381,8 @@
|
||||
var dialog = document.getElementById('installation-fee-dialog');
|
||||
if (!form || !card || !dialog) { return; }
|
||||
|
||||
var fromInput = form.elements.namedItem('customer_review_from');
|
||||
var toInput = form.elements.namedItem('customer_review_to');
|
||||
var fromInput = form.elements.namedItem('date_from');
|
||||
var toInput = form.elements.namedItem('date_to');
|
||||
var cardTotal = card.querySelector('[data-installation-fee-total]');
|
||||
var status = document.querySelector('[data-installation-fee-status]');
|
||||
var subtitle = dialog.querySelector('[data-installation-fee-subtitle]');
|
||||
|
||||
@ -0,0 +1,320 @@
|
||||
@php
|
||||
$installationTimeScopes = [
|
||||
'created' => '创建时间',
|
||||
'customer_review' => '客服审核时间',
|
||||
'finance_review' => '财务审核时间',
|
||||
];
|
||||
$installationTimePrefixes = [
|
||||
'created' => 'created',
|
||||
'customer_review' => 'customer_review',
|
||||
'finance_review' => 'finance_review',
|
||||
];
|
||||
$usesUnifiedTime = request()->hasAny(['time_scope', 'date_from', 'date_to']);
|
||||
$installationTimeScope = (string) request('time_scope', '');
|
||||
if (! array_key_exists($installationTimeScope, $installationTimeScopes)) {
|
||||
$installationTimeScope = request()->filled('created_from') || request()->filled('created_to')
|
||||
? 'created'
|
||||
: (request()->filled('finance_review_from') || request()->filled('finance_review_to')
|
||||
? 'finance_review'
|
||||
: 'customer_review');
|
||||
}
|
||||
$installationTimePrefix = $installationTimePrefixes[$installationTimeScope];
|
||||
$installationDateFrom = $usesUnifiedTime
|
||||
? (string) request('date_from', '')
|
||||
: (string) request($installationTimePrefix . '_from', '');
|
||||
$installationDateTo = $usesUnifiedTime
|
||||
? (string) request('date_to', '')
|
||||
: (string) request($installationTimePrefix . '_to', '');
|
||||
$installationStore = (string) request('shop_name', '');
|
||||
$installationCompleted = (string) request('completed_status', '');
|
||||
$installationMoreFields = [
|
||||
'shop_code' => ['label' => '店铺 ID', 'placeholder' => '按店铺编码精确查询'],
|
||||
'order_no' => ['label' => '订单编号', 'placeholder' => '按原值精确查询'],
|
||||
'installation_no' => ['label' => '安装单号', 'placeholder' => '按原值精确查询'],
|
||||
'installation_company' => ['label' => '安装公司', 'placeholder' => '按原值精确查询'],
|
||||
'push_status' => ['label' => '推送状态', 'placeholder' => '按原值精确查询'],
|
||||
'quote_status' => ['label' => '报价状态', 'placeholder' => '按原值精确查询'],
|
||||
'fee_payer' => ['label' => '安装费承担方', 'placeholder' => '按原值精确查询'],
|
||||
'order_type' => ['label' => '订单类型', 'placeholder' => '按原值精确查询'],
|
||||
'product_id' => ['label' => '商品 ID', 'placeholder' => '按原值精确查询'],
|
||||
'customer_review' => ['label' => '客服审核', 'options' => ['0' => '未审核', '1' => '已审核']],
|
||||
'finance_review' => ['label' => '财务审核', 'options' => ['0' => '未审核', '1' => '已审核']],
|
||||
'arranged_status' => ['label' => '是否安排', 'options' => ['0' => '未安排', '1' => '已安排']],
|
||||
'delete_status' => ['label' => '删除状态', 'options' => ['0' => '未删除', '1' => '已删除']],
|
||||
];
|
||||
$installationActiveMore = collect($installationMoreFields)
|
||||
->filter(static fn (array $field, string $name): bool => request()->filled($name))
|
||||
->map(static fn (array $field, string $name): array => $field + [
|
||||
'name' => $name,
|
||||
'value' => (string) request($name, ''),
|
||||
])
|
||||
->all();
|
||||
$installationMoreCount = count($installationActiveMore);
|
||||
$installationQuery = request()->query();
|
||||
$installationRemoveUrl = static function (array $keys) use ($installationQuery): string {
|
||||
unset($installationQuery['page']);
|
||||
foreach ($keys as $key) {
|
||||
unset($installationQuery[$key]);
|
||||
}
|
||||
|
||||
$query = \Illuminate\Support\Arr::query($installationQuery);
|
||||
|
||||
return request()->url() . ($query !== '' ? '?' . $query : '');
|
||||
};
|
||||
$installationDateChip = trim($installationDateFrom . ' 至 ' . $installationDateTo, ' 至');
|
||||
@endphp
|
||||
|
||||
<form method="GET" id="installationFilterForm" action="{{ request()->url() }}" class="installation-filter-bar installation-filter-compact" aria-label="安装明细筛选查询栏" autocomplete="off">
|
||||
<div class="installation-filter-primary">
|
||||
<div class="installation-filter-time">
|
||||
<label class="installation-filter-control">
|
||||
<span>时间口径</span>
|
||||
<select id="installationTimeScope" name="time_scope">
|
||||
@foreach ($installationTimeScopes as $value => $label)
|
||||
<option value="{{ $value }}" @selected($installationTimeScope === $value)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
<div class="installation-filter-control installation-filter-range">
|
||||
<span>日期区间</span>
|
||||
<div class="upstream-data-date-range">
|
||||
<span class="upstream-data-date" data-date-picker>
|
||||
<input id="date_from" type="text" name="date_from" value="{{ $installationDateFrom }}" readonly autocomplete="off" placeholder="开始日期" aria-label="开始日期" aria-describedby="installationDateRangeError" data-date-input>
|
||||
<button type="button" class="upstream-data-date__clear" data-date-clear hidden aria-label="清除开始日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button type="button" class="upstream-data-date__pick" data-date-toggle aria-label="选择开始日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
<div class="upstream-data-calendar" role="dialog" aria-label="开始日期日历" data-date-calendar hidden></div>
|
||||
</span>
|
||||
<b class="upstream-data-date-range__sep">至</b>
|
||||
<span class="upstream-data-date" data-date-picker>
|
||||
<input id="date_to" type="text" name="date_to" value="{{ $installationDateTo }}" readonly autocomplete="off" placeholder="结束日期" aria-label="结束日期" aria-describedby="installationDateRangeError" data-date-input>
|
||||
<button type="button" class="upstream-data-date__clear" data-date-clear hidden aria-label="清除结束日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button type="button" class="upstream-data-date__pick" data-date-toggle aria-label="选择结束日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
<div class="upstream-data-calendar" role="dialog" aria-label="结束日期日历" data-date-calendar hidden></div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="installation-filter-control">
|
||||
<span>店铺</span>
|
||||
<input id="installationShopName" type="search" name="shop_name" value="{{ $installationStore }}" placeholder="输入完整店铺名称">
|
||||
</label>
|
||||
|
||||
<label class="installation-filter-control">
|
||||
<span>安装状态</span>
|
||||
<select name="completed_status">
|
||||
<option value="">全部</option>
|
||||
<option value="0" @selected($installationCompleted === '0')>未完工</option>
|
||||
<option value="1" @selected($installationCompleted === '1')>已完工</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div class="installation-filter-actions">
|
||||
<button type="submit" class="biz-btn biz-btn-primary">
|
||||
<span class="material-icons-outlined" aria-hidden="true">search</span>
|
||||
<span>查询</span>
|
||||
</button>
|
||||
<button type="button" class="biz-btn biz-btn-ghost installation-more-toggle" data-installation-more-toggle aria-expanded="{{ $installationMoreCount > 0 ? 'true' : 'false' }}" aria-controls="installationMoreFilters">
|
||||
<span class="material-icons-outlined" aria-hidden="true">tune</span>
|
||||
<span>更多筛选</span>
|
||||
@if ($installationMoreCount > 0)
|
||||
<b data-installation-more-count>{{ $installationMoreCount }}</b>
|
||||
@endif
|
||||
</button>
|
||||
<a href="{{ request()->url() }}" class="biz-btn biz-btn-ghost">清除</a>
|
||||
<a href="{{ route('business.installation-details.export', request()->query()) }}" class="biz-btn biz-btn-ghost">
|
||||
<span class="material-icons-outlined" aria-hidden="true">download</span>
|
||||
<span>导出</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="installation-filter-context">
|
||||
<div class="installation-quick-ranges" role="group" aria-label="快捷日期区间">
|
||||
<span>快捷区间</span>
|
||||
@foreach (['today' => '今天', 'this_week' => '本周', 'this_month' => '本月', 'last_month' => '上月', 'last_30_days' => '近30天'] as $value => $label)
|
||||
<button type="button" class="installation-quick-range" data-installation-quick-range="{{ $value }}">{{ $label }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="installation-active-filters" aria-label="当前生效的筛选条件">
|
||||
@if ($installationDateFrom !== '' || $installationDateTo !== '')
|
||||
<a class="installation-filter-chip" href="{{ $installationRemoveUrl(['time_scope', 'date_from', 'date_to', 'created_from', 'created_to', 'customer_review_from', 'customer_review_to', 'finance_review_from', 'finance_review_to']) }}" aria-label="删除「{{ $installationTimeScopes[$installationTimeScope] }}」条件">
|
||||
<span>{{ $installationTimeScopes[$installationTimeScope] }}</span>
|
||||
<strong>{{ $installationDateChip }}</strong>
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</a>
|
||||
@endif
|
||||
@if ($installationStore !== '')
|
||||
<a class="installation-filter-chip" href="{{ $installationRemoveUrl(['shop_name']) }}" aria-label="删除「店铺」条件">
|
||||
<span>店铺</span><strong>{{ $installationStore }}</strong>
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</a>
|
||||
@endif
|
||||
@if ($installationCompleted !== '')
|
||||
<a class="installation-filter-chip" href="{{ $installationRemoveUrl(['completed_status']) }}" aria-label="删除「安装状态」条件">
|
||||
<span>安装状态</span><strong>{{ $installationCompleted === '1' ? '已完工' : '未完工' }}</strong>
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</a>
|
||||
@endif
|
||||
@foreach ($installationActiveMore as $field)
|
||||
@php
|
||||
$displayValue = isset($field['options'])
|
||||
? ($field['options'][$field['value']] ?? $field['value'])
|
||||
: $field['value'];
|
||||
@endphp
|
||||
<a class="installation-filter-chip" href="{{ $installationRemoveUrl([$field['name']]) }}" aria-label="删除「{{ $field['label'] }}」条件">
|
||||
<span>{{ $field['label'] }}</span><strong>{{ $displayValue }}</strong>
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="installationDateRangeError" class="installation-date-range-error" role="alert" hidden>结束日期不能早于开始日期。</p>
|
||||
|
||||
<div id="installationMoreFilters" class="installation-more-panel" @if ($installationMoreCount === 0) hidden @endif>
|
||||
<div class="installation-more-head">
|
||||
<strong>更多筛选</strong>
|
||||
<span>低频条件仅在展开后显示,已生效条件会保留在下方标签中。</span>
|
||||
</div>
|
||||
<div class="installation-more-grid">
|
||||
@foreach ($installationMoreFields as $name => $field)
|
||||
<label class="installation-filter-control">
|
||||
<span>{{ $field['label'] }}</span>
|
||||
@if (isset($field['options']))
|
||||
<select name="{{ $name }}">
|
||||
<option value="">全部</option>
|
||||
@foreach ($field['options'] as $value => $label)
|
||||
<option value="{{ $value }}" @selected((string) request($name) === (string) $value)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<input id="installation-more-{{ $name }}" type="text" name="{{ $name }}" value="{{ request($name) }}" placeholder="{{ $field['placeholder'] }}">
|
||||
@endif
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var form = document.getElementById('installationFilterForm');
|
||||
if (!form) { return; }
|
||||
|
||||
if (window.CaiWuDatePicker) {
|
||||
window.CaiWuDatePicker.setup(form);
|
||||
}
|
||||
|
||||
var fromInput = form.elements.namedItem('date_from');
|
||||
var toInput = form.elements.namedItem('date_to');
|
||||
var error = document.getElementById('installationDateRangeError');
|
||||
var moreToggle = form.querySelector('[data-installation-more-toggle]');
|
||||
var morePanel = document.getElementById('installationMoreFilters');
|
||||
var quickButtons = Array.from(form.querySelectorAll('[data-installation-quick-range]'));
|
||||
|
||||
function pad2(number) {
|
||||
return (number < 10 ? '0' : '') + number;
|
||||
}
|
||||
|
||||
function isoDate(date) {
|
||||
return date.getFullYear() + '-' + pad2(date.getMonth() + 1) + '-' + pad2(date.getDate());
|
||||
}
|
||||
|
||||
function startOfWeek(date) {
|
||||
var start = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
var offset = (start.getDay() + 6) % 7;
|
||||
start.setDate(start.getDate() - offset);
|
||||
return start;
|
||||
}
|
||||
|
||||
function quickRange(name) {
|
||||
var today = new Date();
|
||||
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
var from;
|
||||
var to = today;
|
||||
|
||||
if (name === 'this_week') {
|
||||
from = startOfWeek(today);
|
||||
} else if (name === 'this_month') {
|
||||
from = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
} else if (name === 'last_month') {
|
||||
from = new Date(today.getFullYear(), today.getMonth() - 1, 1);
|
||||
to = new Date(today.getFullYear(), today.getMonth(), 0);
|
||||
} else if (name === 'last_30_days') {
|
||||
from = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 29);
|
||||
} else {
|
||||
from = today;
|
||||
}
|
||||
|
||||
return { from: isoDate(from), to: isoDate(to) };
|
||||
}
|
||||
|
||||
function syncQuickState() {
|
||||
quickButtons.forEach(function (button) {
|
||||
var value = quickRange(button.getAttribute('data-installation-quick-range'));
|
||||
var selected = fromInput.value === value.from && toInput.value === value.to;
|
||||
button.classList.toggle('is-active', selected);
|
||||
button.setAttribute('aria-pressed', selected ? 'true' : 'false');
|
||||
});
|
||||
}
|
||||
|
||||
function setRange(from, to) {
|
||||
fromInput.value = from;
|
||||
toInput.value = to;
|
||||
[fromInput, toInput].forEach(function (input) {
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
input.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
});
|
||||
syncQuickState();
|
||||
form.querySelector('button[type="submit"]')?.focus();
|
||||
}
|
||||
|
||||
moreToggle?.addEventListener('click', function () {
|
||||
var open = morePanel.hasAttribute('hidden');
|
||||
morePanel.toggleAttribute('hidden', !open);
|
||||
moreToggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
});
|
||||
|
||||
quickButtons.forEach(function (button) {
|
||||
button.addEventListener('click', function () {
|
||||
var value = quickRange(button.getAttribute('data-installation-quick-range'));
|
||||
setRange(value.from, value.to);
|
||||
});
|
||||
});
|
||||
|
||||
[fromInput, toInput].forEach(function (input) {
|
||||
input.addEventListener('change', syncQuickState);
|
||||
input.addEventListener('input', syncQuickState);
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
var invalid = Boolean(fromInput.value && toInput.value && fromInput.value > toInput.value);
|
||||
fromInput.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
||||
toInput.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
||||
error.hidden = !invalid;
|
||||
if (invalid) {
|
||||
event.preventDefault();
|
||||
toInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
Array.from(form.querySelectorAll('input[name], select[name]')).forEach(function (control) {
|
||||
if (!control.disabled && String(control.value || '').trim() === '') {
|
||||
control.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
syncQuickState();
|
||||
})();
|
||||
</script>
|
||||
@ -203,12 +203,10 @@
|
||||
}
|
||||
|
||||
.installation-filter-bar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(12rem, 1fr));
|
||||
gap: 0.65rem 1rem;
|
||||
padding: 1rem 1.5rem;
|
||||
border-bottom: 1px solid #f3f4f6;
|
||||
background: #fcfbf8;
|
||||
padding: 0.7rem 1.25rem 0.75rem;
|
||||
border-bottom: 1px solid #e8e2d8;
|
||||
background: #fffdf8;
|
||||
color: #595959;
|
||||
}
|
||||
|
||||
.installation-filter-field {
|
||||
@ -238,34 +236,207 @@
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.installation-date-filter {
|
||||
display: flex;
|
||||
grid-column: span 2;
|
||||
.installation-filter-compact {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.installation-filter-primary {
|
||||
display: grid;
|
||||
grid-template-columns:
|
||||
minmax(28rem, 1.55fr)
|
||||
minmax(10.5rem, 0.62fr)
|
||||
minmax(8.5rem, 0.42fr)
|
||||
auto;
|
||||
gap: 0.6rem;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.installation-filter-time {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(7rem, 0.45fr) minmax(17rem, 1.4fr);
|
||||
gap: 0.55rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.installation-filter-control {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 0.22rem;
|
||||
color: #595959;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.installation-filter-control > span {
|
||||
height: 0.95rem;
|
||||
overflow: hidden;
|
||||
color: #595959;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 500;
|
||||
line-height: 0.95rem;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.installation-date-filter__label {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.installation-date-filter__range {
|
||||
flex: 1 1 auto;
|
||||
.installation-filter-control input,
|
||||
.installation-filter-control select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.installation-date-filter .upstream-data-date input {
|
||||
height: 2.1rem;
|
||||
height: 2rem;
|
||||
padding: 0 0.55rem;
|
||||
border: 1px solid #d8d2c7;
|
||||
border-radius: 0.45rem;
|
||||
background: #ffffff;
|
||||
color: #171717;
|
||||
font: inherit;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.installation-filter-control input:focus,
|
||||
.installation-filter-control select:focus {
|
||||
border-color: #856632;
|
||||
box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.16);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.installation-filter-range .upstream-data-date-range {
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.installation-filter-range .upstream-data-date input {
|
||||
height: 2rem;
|
||||
border: 1px solid #d8d2c7;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.installation-filter-range .upstream-data-date__clear,
|
||||
.installation-filter-range .upstream-data-date__pick {
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.installation-filter-actions {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-end;
|
||||
gap: 0.35rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.installation-filter-actions .biz-btn {
|
||||
height: 2rem;
|
||||
gap: 0.25rem;
|
||||
padding: 0 0.62rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.installation-filter-actions .material-icons-outlined {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.installation-more-toggle b {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1.05rem;
|
||||
height: 1.05rem;
|
||||
padding: 0 0.2rem;
|
||||
border-radius: 999px;
|
||||
background: #856632;
|
||||
color: #ffffff;
|
||||
font-size: 0.625rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.installation-more-toggle b[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.installation-filter-context {
|
||||
display: flex;
|
||||
min-height: 1.65rem;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 0.55rem;
|
||||
}
|
||||
|
||||
.installation-quick-ranges,
|
||||
.installation-active-filters {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.installation-quick-ranges > span {
|
||||
color: #595959;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.installation-quick-range {
|
||||
height: 1.55rem;
|
||||
padding: 0 0.55rem;
|
||||
border: 1px solid #ddd6ca;
|
||||
border-radius: 999px;
|
||||
background: #ffffff;
|
||||
color: #595959;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-size: 0.6875rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.installation-quick-range:hover,
|
||||
.installation-quick-range:focus-visible,
|
||||
.installation-quick-range.is-active {
|
||||
border-color: #b9954f;
|
||||
background: #f7f0de;
|
||||
color: #856632;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.installation-active-filters {
|
||||
min-width: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.installation-filter-chip {
|
||||
display: inline-flex;
|
||||
max-width: 24rem;
|
||||
min-height: 1.55rem;
|
||||
align-items: center;
|
||||
gap: 0.28rem;
|
||||
padding: 0.08rem 0.35rem 0.08rem 0.55rem;
|
||||
border: 1px solid #e2d6bb;
|
||||
border-radius: 999px;
|
||||
background: #f7f0de;
|
||||
color: #6a5129;
|
||||
font-size: 0.6875rem;
|
||||
line-height: 1.2;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.installation-filter-chip:hover,
|
||||
.installation-filter-chip:focus-visible {
|
||||
border-color: #b9954f;
|
||||
background: #f2e7c5;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.installation-filter-chip strong {
|
||||
overflow: hidden;
|
||||
max-width: 15rem;
|
||||
font-weight: 500;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.installation-filter-chip .material-icons-outlined {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.installation-date-range-error {
|
||||
grid-column: 1 / -1;
|
||||
margin: 0;
|
||||
margin: 0.4rem 0 0;
|
||||
color: #b80000;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
@ -274,22 +445,92 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.installation-filter-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
.installation-more-panel {
|
||||
margin-top: 0.6rem;
|
||||
padding: 0.65rem 0.75rem 0.75rem;
|
||||
border: 1px solid #e7dfd1;
|
||||
border-radius: 0.55rem;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.installation-filter-bar { grid-template-columns: repeat(2, minmax(14rem, 1fr)); }
|
||||
.installation-date-filter { grid-column: 1 / -1; }
|
||||
.installation-more-panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.installation-more-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.55rem;
|
||||
}
|
||||
|
||||
.installation-more-head strong {
|
||||
color: #171717;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.installation-more-head span {
|
||||
color: #595959;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.installation-more-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(9rem, 1fr));
|
||||
gap: 0.55rem 0.75rem;
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.installation-filter-primary {
|
||||
grid-template-columns: minmax(27rem, 1fr) minmax(10rem, 0.55fr) minmax(8rem, 0.4fr);
|
||||
}
|
||||
.installation-filter-actions {
|
||||
grid-column: 1 / -1;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.installation-more-grid {
|
||||
grid-template-columns: repeat(3, minmax(9rem, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.installation-filter-primary {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(11rem, 0.55fr);
|
||||
}
|
||||
.installation-filter-time {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.installation-filter-actions {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.installation-more-grid {
|
||||
grid-template-columns: repeat(2, minmax(9rem, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 650px) {
|
||||
.installation-filter-bar { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
|
||||
.installation-date-filter {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0.25rem;
|
||||
.installation-filter-bar {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
.installation-filter-primary,
|
||||
.installation-filter-time {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.installation-filter-time,
|
||||
.installation-filter-actions {
|
||||
grid-column: auto;
|
||||
}
|
||||
.installation-filter-actions {
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.installation-active-filters {
|
||||
margin-left: 0;
|
||||
}
|
||||
.installation-more-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -773,102 +1014,7 @@
|
||||
<div class="biz-card mt-6">
|
||||
@if ($page['slug'] === 'installation-details')
|
||||
@include('business.pages.partials.date-range-picker')
|
||||
<form method="GET" id="installationFilterForm" action="{{ request()->url() }}" class="installation-filter-bar" aria-label="安装明细筛选查询栏" autocomplete="off">
|
||||
@php
|
||||
$dateRangeFilters = [
|
||||
['from' => 'created_from', 'to' => 'created_to', 'label' => '创建日期:', 'aria' => '创建日期'],
|
||||
['from' => 'customer_review_from', 'to' => 'customer_review_to', 'label' => '客服审核时间:', 'aria' => '客服审核时间'],
|
||||
['from' => 'finance_review_from', 'to' => 'finance_review_to', 'label' => '财务审核时间:', 'aria' => '财务审核时间'],
|
||||
];
|
||||
$filterFields = [
|
||||
['name' => 'push_status', 'label' => '推送状态:'], ['name' => 'order_no', 'label' => '订单编号:'],
|
||||
['name' => 'customer_review', 'label' => '客服审核:', 'options' => ['0'=>'未审核','1'=>'已审核']], ['name' => 'finance_review', 'label' => '财务审核:', 'options' => ['0'=>'未审核','1'=>'已审核']],
|
||||
['name' => 'quote_status', 'label' => '报价状态:'], ['name' => 'arranged_status', 'label' => '是否安排:', 'options' => ['0'=>'未安排','1'=>'已安排']],
|
||||
['name' => 'fee_payer', 'label' => '安装费承担方:'], ['name' => 'completed_status', 'label' => '是否完工:', 'options' => ['0'=>'未完工','1'=>'已完工']],
|
||||
['name' => 'shop_name', 'label' => '选择店铺:'], ['name' => 'delete_status', 'label' => '选择删除:', 'options' => ['0'=>'未删除','1'=>'已删除']],
|
||||
['name' => 'installation_company', 'label' => '安装公司:'], ['name' => 'installation_no', 'label' => '安装单号:'],
|
||||
['name' => 'order_type', 'label' => '订单类型:'], ['name' => 'product_id', 'label' => '商品ID:'],
|
||||
];
|
||||
@endphp
|
||||
@foreach ($dateRangeFilters as $dateRange)
|
||||
<div class="installation-date-filter">
|
||||
<span class="installation-date-filter__label">{{ $dateRange['label'] }}</span>
|
||||
<div class="upstream-data-date-range installation-date-filter__range">
|
||||
<span class="upstream-data-date" data-date-picker>
|
||||
<input id="{{ $dateRange['from'] }}" type="text" name="{{ $dateRange['from'] }}" value="{{ request($dateRange['from']) }}" readonly autocomplete="off" placeholder="开始日期" aria-label="{{ $dateRange['aria'] }}开始日期" aria-describedby="installationDateRangeError" data-date-input>
|
||||
<button type="button" class="upstream-data-date__clear" data-date-clear hidden aria-label="清除{{ $dateRange['aria'] }}开始日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button type="button" class="upstream-data-date__pick" data-date-toggle aria-label="选择{{ $dateRange['aria'] }}开始日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
<div class="upstream-data-calendar" role="dialog" aria-label="{{ $dateRange['aria'] }}开始日期日历" data-date-calendar hidden></div>
|
||||
</span>
|
||||
<b class="upstream-data-date-range__sep">至</b>
|
||||
<span class="upstream-data-date" data-date-picker>
|
||||
<input id="{{ $dateRange['to'] }}" type="text" name="{{ $dateRange['to'] }}" value="{{ request($dateRange['to']) }}" readonly autocomplete="off" placeholder="结束日期" aria-label="{{ $dateRange['aria'] }}结束日期" aria-describedby="installationDateRangeError" data-date-input>
|
||||
<button type="button" class="upstream-data-date__clear" data-date-clear hidden aria-label="清除{{ $dateRange['aria'] }}结束日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button type="button" class="upstream-data-date__pick" data-date-toggle aria-label="选择{{ $dateRange['aria'] }}结束日期">
|
||||
<span class="material-icons-outlined" aria-hidden="true">calendar_today</span>
|
||||
</button>
|
||||
<div class="upstream-data-calendar" role="dialog" aria-label="{{ $dateRange['aria'] }}结束日期日历" data-date-calendar hidden></div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach ($filterFields as $filter)
|
||||
<label class="installation-filter-field">
|
||||
<span>{{ $filter['label'] }}</span>
|
||||
@if (isset($filter['options']))
|
||||
<select name="{{ $filter['name'] }}"><option value="">全部</option>@foreach ($filter['options'] as $value => $label)<option value="{{ $value }}" @selected((string) request($filter['name']) === (string) $value)>{{ $label }}</option>@endforeach</select>
|
||||
@else
|
||||
<input type="{{ $filter['type'] ?? 'text' }}" name="{{ $filter['name'] }}" value="{{ request($filter['name']) }}" @if (($filter['type'] ?? '') !== 'date') placeholder="按原值精确查询" @endif>
|
||||
@endif
|
||||
</label>
|
||||
@endforeach
|
||||
<p id="installationDateRangeError" class="installation-date-range-error" role="alert" hidden>结束日期不能早于开始日期。</p>
|
||||
<div class="installation-filter-actions">
|
||||
<button type="submit" class="biz-btn biz-btn-primary">查询</button>
|
||||
<a href="{{ request()->url() }}" class="biz-btn biz-btn-ghost">清除</a>
|
||||
<a href="{{ route('business.installation-details.export', request()->query()) }}" class="biz-btn biz-btn-ghost">导出</a>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
(function () {
|
||||
var form = document.getElementById('installationFilterForm');
|
||||
if (!form) { return; }
|
||||
|
||||
if (window.CaiWuDatePicker) {
|
||||
window.CaiWuDatePicker.setup(form);
|
||||
}
|
||||
|
||||
var error = document.getElementById('installationDateRangeError');
|
||||
var ranges = [
|
||||
['created_from', 'created_to'],
|
||||
['customer_review_from', 'customer_review_to'],
|
||||
['finance_review_from', 'finance_review_to']
|
||||
];
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
var invalidEnd = null;
|
||||
ranges.forEach(function (names) {
|
||||
var from = form.elements.namedItem(names[0]);
|
||||
var to = form.elements.namedItem(names[1]);
|
||||
var invalid = Boolean(from && to && from.value && to.value && from.value > to.value);
|
||||
if (from) { from.setAttribute('aria-invalid', invalid ? 'true' : 'false'); }
|
||||
if (to) { to.setAttribute('aria-invalid', invalid ? 'true' : 'false'); }
|
||||
if (invalid && !invalidEnd) { invalidEnd = to; }
|
||||
});
|
||||
error.hidden = !invalidEnd;
|
||||
if (invalidEnd) {
|
||||
event.preventDefault();
|
||||
invalidEnd.focus();
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@include('business.pages.partials.installation-filters')
|
||||
@include('business.pages.partials.installation-fee-summary')
|
||||
@endif
|
||||
<div class="biz-card-head">
|
||||
|
||||
@ -244,25 +244,37 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
->assertSeeText('安装单号')
|
||||
->assertSeeText('申请总金额')
|
||||
->assertSeeText('商品名称(1)')
|
||||
->assertSeeText('创建日期:')
|
||||
->assertSeeText('客服审核时间:')
|
||||
->assertSeeText('财务审核时间:')
|
||||
->assertSeeText('推送状态:')
|
||||
->assertSeeText('选择店铺:')
|
||||
->assertSeeText('选择删除:')
|
||||
->assertSeeText('订单类型:')
|
||||
->assertSeeText('商品ID:')
|
||||
->assertSeeText('时间口径')
|
||||
->assertSeeText('日期区间')
|
||||
->assertSeeText('店铺')
|
||||
->assertSeeText('安装状态')
|
||||
->assertSeeText('更多筛选')
|
||||
->assertSeeText('今天')
|
||||
->assertSeeText('本周')
|
||||
->assertSeeText('本月')
|
||||
->assertSeeText('上月')
|
||||
->assertSeeText('近30天')
|
||||
->assertSeeText('推送状态')
|
||||
->assertSeeText('订单编号')
|
||||
->assertSeeText('店铺 ID')
|
||||
->assertSeeText('安装公司')
|
||||
->assertSeeText('商品 ID')
|
||||
->assertSeeText('导出')
|
||||
->assertSee('id="installationFilterForm"', false)
|
||||
->assertSee('name="created_from"', false)
|
||||
->assertSee('name="created_to"', false)
|
||||
->assertSee('name="customer_review_from"', false)
|
||||
->assertSee('name="customer_review_to"', false)
|
||||
->assertSee('name="finance_review_from"', false)
|
||||
->assertSee('name="finance_review_to"', false)
|
||||
->assertSee('name="time_scope"', false)
|
||||
->assertSee('name="date_from"', false)
|
||||
->assertSee('name="date_to"', false)
|
||||
->assertSee('name="shop_name"', false)
|
||||
->assertSee('name="completed_status"', false)
|
||||
->assertSee('id="installationMoreFilters"', false)
|
||||
->assertSee('id="installationMoreFilters" class="installation-more-panel" hidden', false)
|
||||
->assertSee('data-installation-more-toggle', false)
|
||||
->assertSee('data-installation-quick-range="today"', false)
|
||||
->assertSee('data-installation-quick-range="last_30_days"', false)
|
||||
->assertSee('data-date-picker', false)
|
||||
->assertSee('data-date-calendar', false)
|
||||
->assertSee("window.CaiWuDatePicker.setup(form)", false)
|
||||
->assertSee("input.addEventListener('input', syncClear)", false)
|
||||
->assertSee('结束日期不能早于开始日期。')
|
||||
->assertSee('data-installation-fee-open', false)
|
||||
->assertSee('id="installation-fee-dialog"', false)
|
||||
@ -307,6 +319,58 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
$this->assertStringContainsString('INSTALL-EXPORT-001', $response->streamedContent());
|
||||
}
|
||||
|
||||
public function testInstallationDetailsUnifiedFiltersRenderActiveChipsAndKeepLowFrequencyFieldsInMorePanel(): void
|
||||
{
|
||||
$mirror = Mockery::mock(InstallationDetailMirrorRepository::class);
|
||||
$mirror->shouldReceive('paginate')->once()->andReturn([
|
||||
'ready' => true,
|
||||
'total' => 1,
|
||||
'data' => [array_replace(array_fill_keys(array_keys(InstallationDetail::columnLabels()), null), [
|
||||
'id' => 9,
|
||||
'installation_no' => 'INSTALL-CHIP-001',
|
||||
'installation_company' => '测试安装公司',
|
||||
'store_name' => '测试店铺',
|
||||
'requested_amount' => '120.50',
|
||||
'settled_amount' => '100.00',
|
||||
'related_guid' => 'guid-install-chip',
|
||||
])],
|
||||
]);
|
||||
$this->app->instance(InstallationDetailMirrorRepository::class, $mirror);
|
||||
|
||||
$url = route('business.pages.show', [
|
||||
'section' => 'financial-operations',
|
||||
'page' => 'installation-details',
|
||||
]) . '?' . http_build_query([
|
||||
'time_scope' => 'customer_review',
|
||||
'date_from' => '2026-09-01',
|
||||
'date_to' => '2026-09-30',
|
||||
'shop_name' => '测试店铺',
|
||||
'completed_status' => '1',
|
||||
'shop_code' => 'SHOP-001',
|
||||
'push_status' => 'PUSHED',
|
||||
'order_no' => 'ORDER-CHIP-001',
|
||||
]);
|
||||
|
||||
$this->loginAs()
|
||||
->get($url)
|
||||
->assertOk()
|
||||
->assertSeeText('客服审核时间')
|
||||
->assertSeeText('2026-09-01 至 2026-09-30')
|
||||
->assertSeeText('测试店铺')
|
||||
->assertSeeText('已完工')
|
||||
->assertSeeText('SHOP-001')
|
||||
->assertSeeText('PUSHED')
|
||||
->assertSeeText('ORDER-CHIP-001')
|
||||
->assertSee('aria-label="删除「客服审核时间」条件"', false)
|
||||
->assertSee('aria-label="删除「店铺」条件"', false)
|
||||
->assertSee('aria-label="删除「安装状态」条件"', false)
|
||||
->assertSee('aria-label="删除「店铺 ID」条件"', false)
|
||||
->assertSee('aria-label="删除「推送状态」条件"', false)
|
||||
->assertSee('aria-label="删除「订单编号」条件"', false)
|
||||
->assertSee('data-installation-more-count>3</b>', false)
|
||||
->assertDontSee('id="installationMoreFilters" class="installation-more-panel" hidden', false);
|
||||
}
|
||||
|
||||
public function testInstallationDetailsEndpointReturnsChildItemsForMainRecord(): void
|
||||
{
|
||||
$mirror = Mockery::mock(InstallationDetailMirrorRepository::class);
|
||||
|
||||
@ -32,7 +32,7 @@ class InstallationDetailMirrorRepositoryTest extends TestCase
|
||||
$schema->create('business_mirror_table_states',function(Blueprint $t){$t->string('dataset_key')->primary();$t->dateTime('initial_completed_at')->nullable();});
|
||||
$schema->create('fixture_install',function(Blueprint $t){
|
||||
$t->integer('Id');
|
||||
foreach(['SourceGuid','OrderNum','ordernum_id','shop_name','SubmitTime','ShipTIme','kfshTime','cwshTime','apistatus','kfsh','cwsh','BidStatus','costtaker','costWay','installComplete','Delete','installCompanyName','TypeDto'] as $c) $t->string($c)->nullable();
|
||||
foreach(['SourceGuid','OrderNum','ordernum_id','shop_name','shopcode','SubmitTime','ShipTIme','kfshTime','cwshTime','apistatus','kfsh','cwsh','BidStatus','costtaker','costWay','installComplete','Delete','installCompanyName','TypeDto'] as $c) $t->string($c)->nullable();
|
||||
$t->integer('StatusId')->nullable()->default(0);
|
||||
foreach(['installcost','settleAmount','acceptAmount'] as $c) $t->decimal($c,14,2)->default(0);
|
||||
});
|
||||
@ -48,7 +48,7 @@ class InstallationDetailMirrorRepositoryTest extends TestCase
|
||||
foreach(array_keys($definitions) as $key) DB::connection('business_mirror')->table('business_mirror_table_states')->insert(['dataset_key'=>$key,'initial_completed_at'=>'2026-08-01']);
|
||||
DB::connection('business_mirror')->table('fixture_install')->insert([
|
||||
['Id'=>1,'SourceGuid'=>'A','OrderNum'=>'OLD','shop_name'=>'旧店','SubmitTime'=>'2026-08-01','ShipTIme'=>'2026-08-02','installcost'=>500],
|
||||
['Id'=>2,'SourceGuid'=>'A','OrderNum'=>'NEW','shop_name'=>'测试店','SubmitTime'=>'2026-08-20 23:59:59','ShipTIme'=>'2026-08-21','installcost'=>20],
|
||||
['Id'=>2,'SourceGuid'=>'A','OrderNum'=>'NEW','shop_name'=>'测试店','shopcode'=>'SHOP-A','SubmitTime'=>'2026-08-20 23:59:59','ShipTIme'=>'2026-08-21','installcost'=>20],
|
||||
['Id'=>3,'SourceGuid'=>'B','OrderNum'=>'OTHER','shop_name'=>'其他店','SubmitTime'=>'2026-08-20','ShipTIme'=>'2026-08-21','installcost'=>30],
|
||||
['Id'=>4,'SourceGuid'=>'C','OrderNum'=>'NEXT','shop_name'=>'测试店','SubmitTime'=>'2026-08-21','ShipTIme'=>'2026-08-22','installcost'=>40],
|
||||
['Id'=>5,'SourceGuid'=>'D','OrderNum'=>'PRE-2026','shop_name'=>'测试店','SubmitTime'=>'2026-08-21','ShipTIme'=>'2025-12-31 23:59:59','installcost'=>999],
|
||||
@ -71,6 +71,7 @@ class InstallationDetailMirrorRepositoryTest extends TestCase
|
||||
$this->assertSame(1,$this->repository->paginate(1,50,$filters)['total']);
|
||||
$this->assertSame(20.0,$this->repository->summary($filters)['requested']);
|
||||
$this->assertSame(0,$this->repository->paginate(1,50,['shop_name'=>"' OR 1=1 --"])['total']);
|
||||
$this->assertSame(1,$this->repository->paginate(1,50,['shop_code'=>'SHOP-A'])['total']);
|
||||
}
|
||||
|
||||
public function test_product_filter_does_not_multiply_main_rows(): void
|
||||
@ -223,4 +224,27 @@ class InstallationDetailMirrorRepositoryTest extends TestCase
|
||||
$this->expectException(\Illuminate\Validation\ValidationException::class);
|
||||
InstallationDetailMirrorRepository::requestFilters();
|
||||
}
|
||||
|
||||
public function test_unified_time_scope_maps_to_the_selected_legacy_date_range(): void
|
||||
{
|
||||
request()->merge([
|
||||
'time_scope' => 'finance_review',
|
||||
'date_from' => '2026-08-01',
|
||||
'date_to' => '2026-08-31',
|
||||
'created_from' => '2026-07-01',
|
||||
'created_to' => '2026-07-31',
|
||||
'shop_name' => '测试店',
|
||||
]);
|
||||
|
||||
$filters = InstallationDetailMirrorRepository::requestFilters();
|
||||
|
||||
$this->assertSame('finance_review', $filters['time_scope']);
|
||||
$this->assertSame('2026-08-01', $filters['date_from']);
|
||||
$this->assertSame('2026-08-31', $filters['date_to']);
|
||||
$this->assertSame('2026-08-01', $filters['finance_review_from']);
|
||||
$this->assertSame('2026-08-31', $filters['finance_review_to']);
|
||||
$this->assertSame('测试店', $filters['shop_name']);
|
||||
$this->assertArrayNotHasKey('created_from', $filters);
|
||||
$this->assertArrayNotHasKey('created_to', $filters);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user