PC/src/common/js/betCompute.js
li b7061d7a0d feat(chip): 筹码额度改为越南 K 格式显示
为越南客户优化筹码识别体验,将筹码数字格式从原有的中文万/千单位
改为国际通用的 K 格式:

- 筹码额度:10K, 20K, 50K, 100K, 200K, 500K, 1000K, 2000K, 5000K,
  10000K, 20000K, 50000K, 100000K
- 更新 play-chip.vue 和 multiple-tab.vue 筹码数据配置
- 更新 CSS 类名映射为 chip-10k, chip-20k 等格式
- 更新 betCompute.js 筹码堆叠计算逻辑
- 默认筹码值从 20 改为 10000
- 下注金额显示添加千位分隔符

注意:需要配合新的 chip.png 图片使用

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:23:45 +08:00

101 lines
5.7 KiB
JavaScript

var fn={};
fn.showChip=function(e,chiptype,downbet,gameId){
if(downbet==0){return false};
// 新的 K 格式筹码计算逻辑
var k100000 = parseInt(downbet / 100000000),
k50000 = parseInt((downbet - k100000 * 100000000) / 50000000),
k20000 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000) / 20000000),
k10000 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000) / 10000000),
k5000 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000) / 5000000),
k2000 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000) / 2000000),
k1000 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000) / 1000000),
k500 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000) / 500000),
k200 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000 - k500 * 500000) / 200000),
k100 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000 - k500 * 500000 - k200 * 200000) / 100000),
k50 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000 - k500 * 500000 - k200 * 200000 - k100 * 100000) / 50000),
k20 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000 - k500 * 500000 - k200 * 200000 - k100 * 100000 - k50 * 50000) / 20000),
k10 = parseInt((downbet - k100000 * 100000000 - k50000 * 50000000 - k20000 * 20000000 - k10000 * 10000000 - k5000 * 5000000 - k2000 * 2000000 - k1000 * 1000000 - k500 * 500000 - k200 * 200000 - k100 * 100000 - k50 * 50000 - k20 * 20000) / 10000);
var str='';
var stackCount = 0;
for (var a = 0; a < k100000; a++) {
str=str+'<i class="chip-100000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var b = 0; b < k50000; b++) {
str=str+'<i class="chip-50000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var c = 0; c < k20000; c++) {
str=str+'<i class="chip-20000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var d = 0; d < k10000; d++) {
str=str+'<i class="chip-10000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var f = 0; f < k5000; f++) {
str=str+'<i class="chip-5000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var g = 0; g < k2000; g++) {
str=str+'<i class="chip-2000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var h = 0; h < k1000; h++) {
str=str+'<i class="chip-1000k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var i = 0; i < k500; i++) {
str=str+'<i class="chip-500k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var j = 0; j < k200; j++) {
str=str+'<i class="chip-200k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var l = 0; l < k100; l++) {
str=str+'<i class="chip-100k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var m = 0; m < k50; m++) {
str=str+'<i class="chip-50k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var n = 0; n < k20; n++) {
str=str+'<i class="chip-20k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
for (var o = 0; o < k10; o++) {
str=str+'<i class="chip-10k" style="margin-bottom:' + stackCount * 2.5 + 'px"></i>';
stackCount++;
}
if (downbet > 0) {
// 格式化显示金额,添加千位分隔符
var displayBet = downbet.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
if(gameId==1||gameId==2){
str=str+'<strong class="money" style="margin-bottom:' + stackCount * 2.5 + 'px">' + displayBet + '</strong>'
}else if(gameId==4){
var index = chiptype.lastIndexOf("\_");
var times= chiptype.substring(index + 1, chiptype.length);
if(times=='double'){
str=str+'<strong class="money" style="margin-bottom:' + stackCount * 2.5 + 'px">' + displayBet + '<small class="smallfont">预扣:'+(downbet*4).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")+'</small></strong>'
}else if(times=='haploid'){
str=str+'<strong class="money" style="margin-bottom:' + stackCount * 2.5 + 'px">' + displayBet + '</strong>'
}
}
else if(gameId==5){
var index = chiptype.lastIndexOf("\_");
var times= chiptype.substring(index + 1, chiptype.length);
if(times=='double'){
str=str+'<strong class="money" style="margin-bottom:' + stackCount * 2.5 + 'px">' + displayBet + '<small class="smallfont">预扣:'+(downbet*19).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")+'</small></strong>'
}else if(times=='haploid'){
str=str+'<strong class="money" style="margin-bottom:' + stackCount * 2.5 + 'px">' + displayBet + '</strong>'
}
}
}
e.html[chiptype]=str
}
export default fn