优化下注金额
This commit is contained in:
@@ -49,6 +49,10 @@ class BaccaratController extends Controller
|
||||
->where('user_id', $user->id)
|
||||
->first();
|
||||
|
||||
$config = GameConfig::forGame('baccarat')?->params ?? [];
|
||||
$minBet = (int) ($config['min_bet'] ?? 100);
|
||||
$maxBet = (int) ($config['max_bet'] ?? 50000);
|
||||
|
||||
return response()->json([
|
||||
'round' => [
|
||||
'id' => $round->id,
|
||||
@@ -61,6 +65,8 @@ class BaccaratController extends Controller
|
||||
'bet_count_big' => $round->bet_count_big,
|
||||
'bet_count_small' => $round->bet_count_small,
|
||||
'bet_count_triple' => $round->bet_count_triple,
|
||||
'min_bet' => $minBet,
|
||||
'max_bet' => $maxBet,
|
||||
'my_bet' => $myBet ? [
|
||||
'bet_type' => $myBet->bet_type,
|
||||
'amount' => $myBet->amount,
|
||||
|
||||
@@ -89,6 +89,9 @@ class HorseRaceController extends Controller
|
||||
? $basePool + array_sum(array_values($horsePools))
|
||||
: $basePool;
|
||||
|
||||
$minBet = (int) ($config['min_bet'] ?? 100);
|
||||
$maxBet = (int) ($config['max_bet'] ?? 100000);
|
||||
|
||||
return response()->json([
|
||||
'race' => [
|
||||
'id' => $race->id,
|
||||
@@ -99,6 +102,8 @@ class HorseRaceController extends Controller
|
||||
: 0,
|
||||
'horses' => $horsesWithBets,
|
||||
'total_pool' => $displayTotalPool,
|
||||
'min_bet' => $minBet,
|
||||
'max_bet' => $maxBet,
|
||||
'my_bet' => $myBet ? [
|
||||
'horse_id' => $myBet->horse_id,
|
||||
'amount' => $myBet->amount,
|
||||
|
||||
@@ -191,14 +191,14 @@
|
||||
|
||||
{{-- 快捷金额 --}}
|
||||
<div style="display:grid; grid-template-columns:repeat(5,1fr); gap:6px; margin-bottom:10px;">
|
||||
<template x-for="preset in [100, 500, 1000, 5000, 10000]" :key="preset">
|
||||
<template x-for="preset in quickBetAmounts" :key="preset">
|
||||
<button x-on:click="betAmount = preset"
|
||||
style="border-radius:20px; padding:8px 2px; font-size:13px; font-weight:bold;
|
||||
cursor:pointer; transition:all .15s; font-family:inherit; text-align:center;"
|
||||
:style="betAmount === preset ?
|
||||
'background:#336699; color:#fff; border:none; box-shadow:0 3px 10px rgba(51,102,153,.35); transform:translateY(-1px);' :
|
||||
'background:#fff; color:#336699; border:1.5px solid #c0d8ef;'"
|
||||
x-text="preset >= 1000 ? (preset/1000)+'k' : preset">
|
||||
x-text="preset >= 10000 ? (preset/1000)+'k' : (preset >= 1000 ? (preset/1000)+'k' : preset)">
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
@@ -463,6 +463,8 @@
|
||||
// 下注表单
|
||||
selectedType: '',
|
||||
betAmount: 100,
|
||||
minBet: 100,
|
||||
maxBet: 50000,
|
||||
submitting: false,
|
||||
|
||||
// 结算结果
|
||||
@@ -481,6 +483,24 @@
|
||||
autoCloseTimer: null,
|
||||
autoCloseCountdown: 0,
|
||||
|
||||
/**
|
||||
* 获取快捷下注金额数组
|
||||
*/
|
||||
get quickBetAmounts() {
|
||||
const min = this.minBet || 100;
|
||||
const max = this.maxBet || 50000;
|
||||
|
||||
// 默认比例:1x, 5x, 10x, 50x, 100x (基于最小下注)
|
||||
// 同时确保不超过最大下注
|
||||
return [
|
||||
min,
|
||||
Math.min(min * 5, max),
|
||||
Math.min(min * 10, max),
|
||||
Math.min(min * 50, max),
|
||||
Math.min(min * 100, max)
|
||||
].filter((v, i, a) => a.indexOf(v) === i); // 去重
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置为未开局空状态
|
||||
*/
|
||||
@@ -552,6 +572,8 @@
|
||||
this.betCountBig = data.round.bet_count_big;
|
||||
this.betCountSmall = data.round.bet_count_small;
|
||||
this.betCountTriple = data.round.bet_count_triple;
|
||||
this.minBet = data.round.min_bet || 100;
|
||||
this.maxBet = data.round.max_bet || 50000;
|
||||
if (data.round.my_bet) {
|
||||
this.myBet = true;
|
||||
this.myBetType = data.round.my_bet.bet_type;
|
||||
|
||||
@@ -148,14 +148,14 @@
|
||||
<div x-show="!myBet">
|
||||
{{-- 快捷金额 --}}
|
||||
<div style="display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin-bottom:14px;">
|
||||
<template x-for="preset in [100, 500, 1000, 5000, 10000]" :key="preset">
|
||||
<template x-for="preset in quickBetAmounts" :key="preset">
|
||||
<button @click="betAmount = preset"
|
||||
style="position:relative; overflow:hidden; border:1px solid #d6e5f6; border-radius:16px; padding:12px 0;
|
||||
font-size:16px; font-weight:900; letter-spacing:.01em; cursor:pointer; transition:all .18s ease; text-shadow:0 1px 0 rgba(255,255,255,.45);"
|
||||
:style="betAmount === preset ?
|
||||
'background:linear-gradient(180deg,#4f89c0 0%,#2d6297 52%,#214f7a 100%); color:#fff; border-color:#1c486f; box-shadow:0 12px 20px rgba(35,89,138,.30), inset 0 1px 0 rgba(255,255,255,.18); transform:translateY(-2px) scale(1.01); text-shadow:none;' :
|
||||
'background:linear-gradient(180deg,#ffffff 0%,#f3f8ff 65%,#e8f1fb 100%); color:#2f6498; box-shadow:0 6px 12px rgba(76,122,172,.10), inset 0 1px 0 rgba(255,255,255,.92);'"
|
||||
x-text="preset >= 1000 ? (preset/1000)+'k' : preset"></button>
|
||||
x-text="preset >= 10000 ? (preset/1000)+'k' : (preset >= 1000 ? (preset/1000)+'k' : preset)"></button>
|
||||
</template>
|
||||
</div>
|
||||
<input type="number" x-model.number="betAmount" min="100" placeholder="自定义金额"
|
||||
@@ -406,6 +406,8 @@
|
||||
// 下注表单
|
||||
selectedHorse: null,
|
||||
betAmount: 100,
|
||||
minBet: 100,
|
||||
maxBet: 100000,
|
||||
submitting: false,
|
||||
|
||||
// 结算结果
|
||||
@@ -426,6 +428,21 @@
|
||||
return h ? h.emoji + h.name : '';
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取快捷下注金额数组
|
||||
*/
|
||||
get quickBetAmounts() {
|
||||
const min = this.minBet || 100;
|
||||
const max = this.maxBet || 100000;
|
||||
return [
|
||||
min,
|
||||
Math.min(min * 5, max),
|
||||
Math.min(min * 10, max),
|
||||
Math.min(min * 50, max),
|
||||
Math.min(min * 100, max)
|
||||
].filter((v, i, a) => a.indexOf(v) === i);
|
||||
},
|
||||
|
||||
/**
|
||||
* 开赛:填充场次数据并开始倒计时
|
||||
*/
|
||||
@@ -461,6 +478,8 @@
|
||||
if (data.race) {
|
||||
this.horses = data.race.horses || this.horses;
|
||||
this.totalPool = data.race.total_pool || 0;
|
||||
this.minBet = data.race.min_bet || 100;
|
||||
this.maxBet = data.race.max_bet || 100000;
|
||||
if (data.race.my_bet) {
|
||||
this.myBet = true;
|
||||
this.myBetHorseId = data.race.my_bet.horse_id;
|
||||
@@ -633,6 +652,8 @@
|
||||
this.raceId = race.id;
|
||||
this.horses = race.horses || [];
|
||||
this.totalPool = race.total_pool || 0;
|
||||
this.minBet = race.min_bet || 100;
|
||||
this.maxBet = race.max_bet || 100000;
|
||||
|
||||
// 更新本人下注状态
|
||||
if (race.my_bet) {
|
||||
|
||||
Reference in New Issue
Block a user