BMT兑换下限恢复100;积分转赠下限改1并接入DecimalInput;首页资产数值0时显示0.00

This commit is contained in:
yankang 2026-07-30 10:45:44 +08:00
parent b91481ce9d
commit ee88485316
17 changed files with 63 additions and 21 deletions

View File

@ -274,7 +274,7 @@ function buildTransferTips(feePercent) {
return {
points: [
"只能转赠100的整数倍",
"只能转赠1的整数倍",
"凌晨00:00至02:00为系统维护时段不可赠送",
"转赠系统会扣除" + percentText + "%的手续费",
],
@ -2104,7 +2104,7 @@ export async function fetchBmtExchangeDetail(requestOptions) {
tips: [
"预估 BMT数= 输入可用积分数÷BMT 实时价格。",
`兑换会同步消耗算力, 1 点可用积分,需同步消耗${powerRate}点算力。`,
"不足 1 的可用积分无法发起兑换。",
"仅支持 100 的正整数倍, 不足 100的可用积分无法发起兑换。",
"凌晨00:00至02:00为积分维护时段期间暂停兑换服务请避开该时间段操作。",
],
};

View File

@ -254,7 +254,7 @@ export default {
return [
"1.BMT=积分-BMT实时价格",
"2.小于1积分不可兑换",
"2.只能兑换100的整数倍小于100积分不可兑换;",
"3.凌晨0点-凌晨1点积分系统维护不可兑换",
"4.可用积分不足可以将释放中的积分转换成可用积分0。",
];
@ -320,9 +320,17 @@ export default {
return;
}
if (this.pointsValue < 1) {
if (this.pointsValue < 100) {
uni.showToast({
title: "小于1积分不可兑换",
title: "小于100积分不可兑换",
icon: "none",
});
return;
}
if (this.pointsValue % 100 !== 0) {
uni.showToast({
title: "只能兑换100的整数倍",
icon: "none",
});
return;

View File

@ -29,12 +29,12 @@
</view>
<view class="input-bar">
<input
<decimal-input
v-model="form.amount"
class="input-bar__field asset-number-font"
type="number"
:digit="0"
:placeholder="amountPlaceholder"
placeholder-class="input-bar__placeholder"
placeholder-style="color: rgba(170, 179, 204, 0.66);"
/>
<text class="input-bar__action" @click="fillAll">全部赠送</text>
</view>
@ -182,6 +182,7 @@
<script>
import AssetConfirmPopup from "../../components/asset-confirm-popup.vue";
import AssetPageShell from "../../components/asset-page-shell.vue";
import DecimalInput from "../../components/DecimalInput/DecimalInput.vue";
import {
fetchTransferDetail,
searchTransferUser,
@ -192,6 +193,7 @@ export default {
components: {
AssetConfirmPopup,
AssetPageShell,
DecimalInput,
},
data() {
return {
@ -255,7 +257,7 @@ export default {
}
return [
"只能转赠100的整数倍",
"只能转赠1的整数倍",
"凌晨0点-凌晨01点系统维护不可赠送",
"转赠系统会扣除" + this.feePercent + "%的手续费",
];
@ -276,9 +278,7 @@ export default {
return this.formatAmount(received, 2);
},
amountPlaceholder() {
return this.activeTab === "power"
? "请输入1的整数倍"
: "请输入100的整数倍";
return "请输入1的整数倍";
},
},
methods: {
@ -394,9 +394,9 @@ export default {
return;
}
if (this.activeTab === "points" && this.amountValue % 100 !== 0) {
if (this.activeTab === "points" && !Number.isInteger(this.amountValue)) {
uni.showToast({
title: "积分只能转赠100的整数倍",
title: "积分只能转赠1的整数倍",
icon: "none",
});
return;

View File

@ -89,7 +89,7 @@
<view class="asset-mini-card__head">
<text class="asset-mini-card__label">{{ item.title }}</text>
</view>
<text class="asset-mini-card__value asset-number-font">{{ item.value }}</text>
<text class="asset-mini-card__value asset-number-font">{{ formatAssetValue(item.value) }}</text>
</view>
</view>
</view>
@ -131,6 +131,7 @@ import {
fetchVoucherBrokerLinkData,
} from "../../api/assets";
import serviceConfig from "../../config/service";
import { truncateToTwo } from "../../utils/index.js";
export default {
data() {
@ -161,6 +162,9 @@ export default {
});
},
methods: {
formatAssetValue(value) {
return truncateToTwo(value);
},
async loadPage(options = {}) {
if (this.isFetchingHome) {
return;

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.149e085d.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.e13b4a2c.js></script><script src=/bmt/static/js/index.68f4d562.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.149e085d.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.e13b4a2c.js></script><script src=/bmt/static/js/index.5ae5da78.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

View File

@ -54,3 +54,32 @@ export function limitDecimal(val, digit = 2, allowNegative = false) {
return result;
}
/**
* 数值展示格式化 0 时返回 "0.00" 0 时原样展示
* @param {number|string} num - 原始数值支持正负值
* @returns {string}
*
* 规则
* 1. 传入值为 0或空值非法值返回 "0.00"
* 2. 传入值不为 0无论正负原样返回该值的字符串形式不做任何截取
*
* 示例
* truncateToTwo(0) // '0.00'
* truncateToTwo('0.0000') // '0.00'
* truncateToTwo(null) // '0.00'
* truncateToTwo('11.0000') // '11.0000'
* truncateToTwo(11.2942) // '11.2942'
* truncateToTwo(-1.239) // '-1.239'
*/
export function truncateToTwo(num) {
const value = Number(num);
// 0、空值、非法值统一返回 0.00
if (!Number.isFinite(value) || value === 0) {
return "0.00";
}
return String(num);
}