|
|
@@ -0,0 +1,139 @@
|
|
|
+@extends('base.base')
|
|
|
+@section('base')
|
|
|
+<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
|
+<div class="container-fluid">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-12">
|
|
|
+ <div class="card">
|
|
|
+ <div class="card-header d-flex align-items-center justify-content-between">
|
|
|
+ <h3 class="card-title mb-0">公用配置管理</h3>
|
|
|
+ <small class="text-muted">编辑 5 档参数并一键保存</small>
|
|
|
+ </div>
|
|
|
+ <div class="card-body">
|
|
|
+ @php
|
|
|
+ $configData = $configs[0]['config'] ? $configs[0]['config'] : [
|
|
|
+ "0" => ["FreeWinMax" => 1000, "TaxPercent" => 100, "RechargeMaxPercent" => 0, "RechargeMin" => 0, "RechargeMax" => 1],
|
|
|
+ "1" => ["FreeWinMax" => 20, "TaxPercent" => 100, "RechargeMaxPercent" => 80, "RechargeMin" => 1, "RechargeMax" => 101],
|
|
|
+ "2" => ["FreeWinMax" => 100, "TaxPercent" => 95, "RechargeMaxPercent" => 70, "RechargeMin" => 101, "RechargeMax" => 501],
|
|
|
+ "3" => ["FreeWinMax" => 400, "TaxPercent" => 90, "RechargeMaxPercent" => 60, "RechargeMin" => 501, "RechargeMax" => 1001],
|
|
|
+ "4" => ["FreeWinMax" => 8000, "TaxPercent" => 85, "RechargeMaxPercent" => 55, "RechargeMin" => 1001,"RechargeMax" => 10001],
|
|
|
+ "5" => ["FreeWinMax" => 0,"TaxPercent" => 80, "RechargeMaxPercent" => 50, "RechargeMin" => 10001,"RechargeMax" => 99999999]
|
|
|
+ ];
|
|
|
+ @endphp
|
|
|
+
|
|
|
+ <div class="table-responsive">
|
|
|
+ <table class="table table-striped table-hover align-middle mb-0" style="min-width: 900px;">
|
|
|
+ <thead class="thead-light">
|
|
|
+ <tr>
|
|
|
+ <th style="width:82px;">档位</th>
|
|
|
+ <th style="width:180px;">充值区间下限 (RechargeMin)</th>
|
|
|
+ <th style="width:180px;">充值区间上限 (RechargeMax)</th>
|
|
|
+ <th style="width:180px;">固定值 (FreeWinMax)</th>
|
|
|
+ <th style="width:180px;">充值最大百分比 (RechargeMaxPercent)</th>
|
|
|
+ <th style="width:160px;">税收系数比例 (TaxPercent)</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody class="config-form">
|
|
|
+ @foreach([0,1,2,3,4,5] as $level)
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ <span class="badge badge-primary">等级{{ $level }}</span>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input type="number" class="form-control form-control-sm"
|
|
|
+ name="level[{{ $level }}][RechargeMin]"
|
|
|
+ value="{{ $configData[$level]['RechargeMin'] ?? 0 }}" />
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input type="number" class="form-control form-control-sm"
|
|
|
+ name="level[{{ $level }}][RechargeMax]"
|
|
|
+ value="{{ $configData[$level]['RechargeMax'] ?? 0 }}" />
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input type="number" class="form-control form-control-sm"
|
|
|
+ name="level[{{ $level }}][FreeWinMax]"
|
|
|
+ value="{{ $configData[$level]['FreeWinMax'] ?? 0 }}" />
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <input type="number" class="form-control"
|
|
|
+ name="level[{{ $level }}][RechargeMaxPercent]"
|
|
|
+ value="{{ $configData[$level]['RechargeMaxPercent'] ?? 0 }}" />
|
|
|
+ <div class="input-group-append"><span class="input-group-text">%</span></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <div class="input-group input-group-sm">
|
|
|
+ <input type="number" class="form-control"
|
|
|
+ name="level[{{ $level }}][TaxPercent]"
|
|
|
+ value="{{ $configData[$level]['TaxPercent'] ?? 0 }}" />
|
|
|
+ <div class="input-group-append"><span class="input-group-text">%</span></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ @endforeach
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="d-flex align-items-center mt-4">
|
|
|
+ <button class="btn btn-gradient-primary btn-sm save-config">
|
|
|
+ <i class="mdi mdi-content-save"></i> 保存配置
|
|
|
+ </button>
|
|
|
+ <span class="save-status ml-3"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+$(function() {
|
|
|
+ $('.save-config').click(function(event) {
|
|
|
+ const $form = $('.config-form');
|
|
|
+ const $btn = $(this);
|
|
|
+ const $status = $('.save-status');
|
|
|
+ $btn.prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> 保存中...');
|
|
|
+ $status.html('').removeClass('text-success text-danger');
|
|
|
+
|
|
|
+ let configObj = {"0":{},"1":{},"2":{},"3":{},"4":{},"5":{}};
|
|
|
+ $form.find('input').each(function() {
|
|
|
+ const name = this.name; // level[1][RechargeMin]
|
|
|
+ const val = this.value;
|
|
|
+ const m = name.match(/level\[(\d+)\]\[([^\]]+)\]/);
|
|
|
+ if (m) {
|
|
|
+ const lvl = m[1];
|
|
|
+ const key = m[2];
|
|
|
+ let num = (key === 'RechargeMaxPercent' || key === 'TaxPercent') ? parseInt(val || 0) : parseFloat(val || 0);
|
|
|
+ if (isNaN(num)) num = 0;
|
|
|
+ configObj[lvl][key] = num;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $.post("{{ url('/admin/common-config/update') }}", {
|
|
|
+ config: JSON.stringify(configObj),
|
|
|
+ _token: "{{ csrf_token() }}"
|
|
|
+ }).done(function(res){
|
|
|
+ $btn.prop('disabled', false).html('<i class="mdi mdi-content-save"></i> 保存配置');
|
|
|
+ if (res.status === 'success') {
|
|
|
+ $status.text('更新成功').addClass('text-success');
|
|
|
+ } else {
|
|
|
+ $status.text(res.message || '更新失败').addClass('text-danger');
|
|
|
+ }
|
|
|
+ setTimeout(function(){ $status.fadeOut(function(){ $(this).text('').show().removeClass('text-success text-danger'); }); }, 3000);
|
|
|
+ }).fail(function(){
|
|
|
+ $btn.prop('disabled', false).html('<i class="mdi mdi-content-save"></i> 保存配置');
|
|
|
+ $status.text('系统错误').addClass('text-danger');
|
|
|
+ });
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+.table thead th { white-space: nowrap; }
|
|
|
+.table tbody td { vertical-align: middle; }
|
|
|
+.input-group-text { min-width: 34px; justify-content: center; }
|
|
|
+.badge { font-size: .85rem; padding: .5em .6em; }
|
|
|
+</style>
|
|
|
+@endsection
|