This commit is contained in:
whitechiina 2026-05-11 16:29:13 +08:00
parent 977c1026fc
commit ed9eaaa47b
19 changed files with 116 additions and 24 deletions

View File

@ -1853,7 +1853,7 @@ export async function fetchPowerExchangeDetail(requestOptions) {
balances: {
coupon: toFixedNumber(balances.coupon, 2),
voucher: toFixedNumber(balances.voucher, 2),
power: toFixedNumber(balances.power, 0),
power: toFixedNumber(balances.power, 2),
},
tips: [
"算力 = 抵用券或消费券 ÷ BMT实时价格 × 兑换倍率;",

View File

@ -454,7 +454,7 @@ export default {
.hero-card__value {
margin-top: 8rpx;
font-size: 32rpx;
font-size: 48rpx;
font-weight: 800;
color: #ffffff;
line-height: 1.1;

View File

@ -423,7 +423,7 @@ export default {
.hero-card__value {
max-width: 360rpx;
font-size: 58rpx;
font-size: 48rpx;
font-weight: 800;
line-height: 1.05;
color: #ffffff;

View File

@ -497,7 +497,7 @@ export default {
.hero-card__value {
margin-top: 8rpx;
font-size: 32rpx;
font-size: 48rpx;
font-weight: 800;
line-height: 1.1;
font-family: var(--asset-number-font-family);

View File

@ -35,11 +35,13 @@
<view class="amount-input">
<input
v-model="form.amount"
:value="form.amount"
class="amount-input__field asset-number-font"
type="number"
placeholder="请输入提取数量"
placeholder-class="amount-input__placeholder"
@input="handleAmountInput"
@blur="handleAmountBlur"
/>
<text class="amount-input__action" @click="fillAll">全部提取</text>
</view>
@ -197,7 +199,7 @@ export default {
return Number(this.form.amount || 0);
},
amountDisplay() {
return this.formatAmount(this.amountValue, 2);
return this.formatAmount(this.amountValue, 0);
},
feeText() {
const fee = (this.amountValue * this.withdrawRateNumber) / 100;
@ -291,6 +293,88 @@ export default {
return number.toFixed(4).replace(/\.?0+$/, "");
},
getInputValue(event) {
return event && event.detail ? event.detail.value : event && event.target
? event.target.value
: "";
},
normalizeIntegerString(value) {
const text = String(value === undefined || value === null ? "" : value).trim();
if (!text) {
return "";
}
if (!/^\d+$/.test(text)) {
return "";
}
const integerValue = Number(text);
if (!Number.isFinite(integerValue) || integerValue < 0) {
return "";
}
return String(Math.floor(integerValue));
},
floorIntegerString(value) {
const number = Number(value || 0);
if (!Number.isFinite(number) || number <= 0) {
return "";
}
return String(Math.floor(number));
},
validateIntegerAmount(value) {
const text = String(value === undefined || value === null ? "" : value).trim();
if (!text) {
return {
valid: false,
normalized: "",
isEmpty: true,
};
}
const normalized = this.normalizeIntegerString(text);
if (!normalized) {
return {
valid: false,
normalized: "",
isEmpty: false,
};
}
return {
valid: true,
normalized,
isEmpty: false,
};
},
handleAmountInput(event) {
this.form.amount = this.getInputValue(event);
},
handleAmountBlur(event) {
const { valid, normalized, isEmpty } = this.validateIntegerAmount(
this.getInputValue(event),
);
if (isEmpty) {
this.form.amount = "";
return;
}
if (!valid) {
this.form.amount = "";
uni.showToast({
title: "提取数量只能输入整数",
icon: "none",
});
return;
}
this.form.amount = normalized;
},
async loadPage(showLoading) {
try {
this.detail = await fetchWithdrawDetail(
@ -310,7 +394,7 @@ export default {
}
},
fillAll() {
this.form.amount = this.detail.withdrawableBmt || "0";
this.form.amount = this.floorIntegerString(this.detail.withdrawableBmt);
},
toggleWalletVisible() {
this.walletVisible = !this.walletVisible;
@ -332,17 +416,21 @@ export default {
});
},
openConfirm() {
if (!this.detail.defaultWallet) {
const amountCheck = this.validateIntegerAmount(this.form.amount);
if (!amountCheck.valid) {
this.form.amount = "";
uni.showToast({
title: "请先添加钱包地址",
title: amountCheck.isEmpty ? "请输入提取数量" : "提取数量只能输入整数",
icon: "none",
});
return;
}
if (!this.amountValue) {
this.form.amount = amountCheck.normalized;
if (!this.detail.defaultWallet) {
uni.showToast({
title: "请输入提取数量",
title: "请先添加钱包地址",
icon: "none",
});
return;
@ -363,17 +451,21 @@ export default {
return;
}
if (!this.detail.defaultWallet) {
const amountCheck = this.validateIntegerAmount(this.form.amount);
if (!amountCheck.valid) {
this.form.amount = "";
uni.showToast({
title: "请先添加钱包地址",
title: amountCheck.isEmpty ? "请输入提取数量" : "提取数量只能输入整数",
icon: "none",
});
return;
}
if (!this.amountValue) {
this.form.amount = amountCheck.normalized;
if (!this.detail.defaultWallet) {
uni.showToast({
title: "请输入提取数量",
title: "请先添加钱包地址",
icon: "none",
});
return;
@ -491,7 +583,7 @@ export default {
.hero-card__value {
margin-top: 8rpx;
font-size: 42rpx;
font-size: 48rpx;
font-weight: 800;
line-height: 1.1;
color: #ffffff;

Binary file not shown.

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>白马交易所</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/bmt/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.a58c62f3.js></script><script src=/bmt/static/js/index.fd295262.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/bmt/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.a58c62f3.js></script><script src=/bmt/static/js/index.31d8a946.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long