|
|
@@ -23,29 +23,86 @@
|
|
|
<div class="card">
|
|
|
<div class="card-body">
|
|
|
<h4 class="card-title">{{ __('auto.查看渠道') }}</h4>
|
|
|
+ <div class="mb-2">
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-secondary" id="toggle-closed-btn">
|
|
|
+ 显示已关闭渠道
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
|
|
|
- <form action="" method="post" class="form-inline form-ajax">
|
|
|
+ <form action="" method="post" class="form-ajax">
|
|
|
{!! csrf_field() !!}
|
|
|
- @foreach($list as $k => $v)
|
|
|
- <div style="margin: 5px 0; width: 100%;">
|
|
|
- <div class="form-group">
|
|
|
- <label for="">{{ __('auto.权重') }}:</label>
|
|
|
- <input class="form-control" type="text"
|
|
|
- name="config[{{$v->id}}][sort]" value="{{$v->sort}}">
|
|
|
- <label for="">{{ __('auto.渠道名称') }}:</label>
|
|
|
- <input class="form-control" type="text" disabled value="{{ $v->name }}">
|
|
|
- <label for="">{{ __('auto.当前状态') }}:</label>
|
|
|
- @component('components.select', [
|
|
|
- 'name' => "config[{$v->id}][status]",
|
|
|
- 'class' => $v->status == 1 ? 'btn-primary' : 'btn-danger',
|
|
|
- 'options' => [1 => __('auto.开启'), -1 => __('auto.关闭')],
|
|
|
- 'default' => $v->status])
|
|
|
- @endcomponent
|
|
|
- </div>
|
|
|
-
|
|
|
- </div>
|
|
|
- @endforeach
|
|
|
- <div>
|
|
|
+ <div class="table-responsive">
|
|
|
+ <table class="table table-bordered table-striped">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th style="min-width: 80px;">ID</th>
|
|
|
+ <th style="min-width: 180px;">{{ __('auto.渠道名称') }}</th>
|
|
|
+ <th style="min-width: 120px;">Cash(1)</th>
|
|
|
+ <th style="min-width: 120px;">PayPal(2)</th>
|
|
|
+ <th style="min-width: 120px;">Apple(4)</th>
|
|
|
+ <th style="min-width: 120px;">Google(8)</th>
|
|
|
+ <th style="min-width: 150px;">{{ __('auto.当前状态') }}</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ @foreach($list as $k => $v)
|
|
|
+ @php
|
|
|
+ $remarks = [];
|
|
|
+ if (!empty($v->remarks)) {
|
|
|
+ $decoded = \GuzzleHttp\json_decode($v->remarks, true);
|
|
|
+ if (is_array($decoded)) {
|
|
|
+ $remarks = $decoded;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $weights = $remarks['weight'] ?? ($remarks['weights'] ?? []);
|
|
|
+ $payTypes = (int)($v->pay_types ?? 0);
|
|
|
+ @endphp
|
|
|
+ <tr data-status="{{ (int)$v->status }}">
|
|
|
+ <td>{{ $v->id }}</td>
|
|
|
+ <td>{{ $v->name }}</td>
|
|
|
+ <input type="hidden" name="config[{{$v->id}}][sort]" value="{{$v->sort}}">
|
|
|
+ <td>
|
|
|
+ <input class="form-control form-control-sm" type="number" min="0"
|
|
|
+ name="config[{{$v->id}}][weight][1]"
|
|
|
+ value="{{ $weights['type_1'] ?? '' }}"
|
|
|
+ placeholder="{{ (($payTypes & 1) === 1) ? '0' : 'N/A' }}"
|
|
|
+ {{ (($payTypes & 1) === 1) ? '' : 'disabled' }}>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input class="form-control form-control-sm" type="number" min="0"
|
|
|
+ name="config[{{$v->id}}][weight][2]"
|
|
|
+ value="{{ $weights['type_2'] ?? '' }}"
|
|
|
+ placeholder="{{ (($payTypes & 2) === 2) ? '0' : 'N/A' }}"
|
|
|
+ {{ (($payTypes & 2) === 2) ? '' : 'disabled' }}>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input class="form-control form-control-sm" type="number" min="0"
|
|
|
+ name="config[{{$v->id}}][weight][4]"
|
|
|
+ value="{{ $weights['type_4'] ?? '' }}"
|
|
|
+ placeholder="{{ (($payTypes & 4) === 4) ? '0' : 'N/A' }}"
|
|
|
+ {{ (($payTypes & 4) === 4) ? '' : 'disabled' }}>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input class="form-control form-control-sm" type="number" min="0"
|
|
|
+ name="config[{{$v->id}}][weight][8]"
|
|
|
+ value="{{ $weights['type_8'] ?? '' }}"
|
|
|
+ placeholder="{{ (($payTypes & 8) === 8) ? '0' : 'N/A' }}"
|
|
|
+ {{ (($payTypes & 8) === 8) ? '' : 'disabled' }}>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ @component('components.select', [
|
|
|
+ 'name' => "config[{$v->id}][status]",
|
|
|
+ 'class' => $v->status == 1 ? 'btn-primary' : 'btn-danger',
|
|
|
+ 'options' => [1 => __('auto.开启'), -1 => __('auto.关闭')],
|
|
|
+ 'default' => $v->status])
|
|
|
+ @endcomponent
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ @endforeach
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="mt-3">
|
|
|
<button class="btn btn-sm btn-primary">{{ __('auto.提交') }}</button>
|
|
|
</div>
|
|
|
</form>
|
|
|
@@ -55,4 +112,32 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <script>
|
|
|
+ (function () {
|
|
|
+ var showClosed = false;
|
|
|
+ var btn = document.getElementById('toggle-closed-btn');
|
|
|
+ if (!btn) return;
|
|
|
+
|
|
|
+ function renderRows() {
|
|
|
+ var rows = document.querySelectorAll('tr[data-status]');
|
|
|
+ for (var i = 0; i < rows.length; i++) {
|
|
|
+ var row = rows[i];
|
|
|
+ var status = parseInt(row.getAttribute('data-status') || '0', 10);
|
|
|
+ if (!showClosed && status === -1) {
|
|
|
+ row.style.display = 'none';
|
|
|
+ } else {
|
|
|
+ row.style.display = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ btn.textContent = showClosed ? '隐藏已关闭渠道' : '显示已关闭渠道';
|
|
|
+ }
|
|
|
+
|
|
|
+ btn.addEventListener('click', function () {
|
|
|
+ showClosed = !showClosed;
|
|
|
+ renderRows();
|
|
|
+ });
|
|
|
+
|
|
|
+ renderRows();
|
|
|
+ })();
|
|
|
+ </script>
|
|
|
@endsection
|