This commit is contained in:
parent
d97a58ed53
commit
dfba786129
|
|
@ -2078,6 +2078,28 @@ async function fetchBmtRedeemConfigData(requestOptions) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeBmtRedeemConfig(data) {
|
||||||
|
return {
|
||||||
|
point: toNumber(data && data.point),
|
||||||
|
cPower: toNumber(data && data.c_power),
|
||||||
|
bmtr: toNumber(data && data.bmtr),
|
||||||
|
redeemNum: toNumber(data && data.redeem_num),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchBmtRedeemPowerRateNewData(requestOptions) {
|
||||||
|
return fetchPayload(
|
||||||
|
createRequestOptions(
|
||||||
|
{
|
||||||
|
url: serviceConfig.ENDPOINTS.bmtRedeemPowerRateNew,
|
||||||
|
method: "GET",
|
||||||
|
},
|
||||||
|
requestOptions,
|
||||||
|
),
|
||||||
|
"方案1配置加载失败",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchPowerExchangeMuitData(requestOptions) {
|
async function fetchPowerExchangeMuitData(requestOptions) {
|
||||||
return fetchPayload(
|
return fetchPayload(
|
||||||
createRequestOptions(
|
createRequestOptions(
|
||||||
|
|
@ -2909,21 +2931,25 @@ export async function fetchBmtExchangeDetail(requestOptions) {
|
||||||
fetchHomeBalanceData(requestOptions),
|
fetchHomeBalanceData(requestOptions),
|
||||||
fetchBmtRedeemConfigData(requestOptions),
|
fetchBmtRedeemConfigData(requestOptions),
|
||||||
fetchUserData(requestOptions),
|
fetchUserData(requestOptions),
|
||||||
|
fetchBmtRedeemPowerRateNewData(requestOptions).catch(function () {
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const ticker = getHomeTickerCache();
|
const ticker = getHomeTickerCache();
|
||||||
const balances = normalizeBalances(result[0]);
|
const balances = normalizeBalances(result[0]);
|
||||||
const exchangeConfig = {
|
const exchangeConfig = normalizeBmtRedeemConfig(result[1]);
|
||||||
point: toNumber(result[1] && result[1].point),
|
const schemeOneConfig = {
|
||||||
cPower: toNumber(result[1] && result[1].c_power),
|
power: toNumber(result[3] && result[3].power),
|
||||||
bmtr: toNumber(result[1] && result[1].bmtr),
|
bmtr: toNumber(result[3] && result[3].bmtr),
|
||||||
redeemNum: toNumber(result[1] && result[1].redeem_num),
|
|
||||||
};
|
};
|
||||||
const bmtr = pickFirstValue(result[2], ["bmtr"]);
|
const bmtr = pickFirstValue(result[2], ["bmtr"]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ticker: ticker,
|
ticker: ticker,
|
||||||
exchangeConfig: exchangeConfig,
|
exchangeConfig: exchangeConfig,
|
||||||
|
schemeOneConfig: schemeOneConfig,
|
||||||
|
schemeOneConfigLoaded: Boolean(result[3]),
|
||||||
balances: {
|
balances: {
|
||||||
points: balances.points,
|
points: balances.points,
|
||||||
power: balances.power,
|
power: balances.power,
|
||||||
|
|
@ -2933,16 +2959,32 @@ export async function fetchBmtExchangeDetail(requestOptions) {
|
||||||
coupon: balances.coupon,
|
coupon: balances.coupon,
|
||||||
},
|
},
|
||||||
tips: [
|
tips: [
|
||||||
`预估BMT数=输入可用积分数 ÷ ${exchangeConfig.point} × ${exchangeConfig.redeemNum}BMT个数。`,
|
`预估BMT数=(输入可用积分数 ÷ ${exchangeConfig.point},保留4位小数) × ${exchangeConfig.redeemNum},结果保留2位小数。`,
|
||||||
`兑换会同步消耗算力、BMTR、${exchangeConfig.point}点可用积分,需同步消耗${exchangeConfig.cPower}点算力和${exchangeConfig.bmtr}个BMTR`,
|
`兑换会同步消耗算力、BMTR、${exchangeConfig.point}点可用积分,需同步消耗${exchangeConfig.cPower}点算力和${exchangeConfig.bmtr}个BMTR`,
|
||||||
`仅支持100的正整数倍,不足100的可用积分无法发起兑换`,
|
`仅支持100的正整数倍,不足100的可用积分无法发起兑换`,
|
||||||
`凌晨00:00至02:00为积分维护时段,期间暂停兑换服务,请避开该时间段操作。`,
|
`凌晨00:00至02:00为积分维护时段,期间暂停兑换服务,请避开该时间段操作。`,
|
||||||
|
`平台可根据实际情况,对合成规则和系数进行调整。`,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function fetchBmtRedeemConfig(requestOptions) {
|
||||||
|
const data = await fetchBmtRedeemConfigData(requestOptions);
|
||||||
|
return normalizeBmtRedeemConfig(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchBmtRedeemPowerRateNew(requestOptions) {
|
||||||
|
const data = await fetchBmtRedeemPowerRateNewData(requestOptions);
|
||||||
|
|
||||||
|
return {
|
||||||
|
power: toNumber(data && data.power),
|
||||||
|
bmtr: toNumber(data && data.bmtr),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export async function submitAssetBmtExchange(payload, requestOptions) {
|
export async function submitAssetBmtExchange(payload, requestOptions) {
|
||||||
const amount = toNumber(payload && payload.amount);
|
const amount = toNumber(payload && payload.amount);
|
||||||
|
const type = Number(payload && payload.type) === 0 ? 0 : 1;
|
||||||
|
|
||||||
if (!amount) {
|
if (!amount) {
|
||||||
throw createError("请输入积分数量");
|
throw createError("请输入积分数量");
|
||||||
|
|
@ -2955,6 +2997,7 @@ export async function submitAssetBmtExchange(payload, requestOptions) {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
number: String(amount),
|
number: String(amount),
|
||||||
|
type: type,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
requestOptions,
|
requestOptions,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ const serviceConfig = {
|
||||||
bmtrExchangePercent: "/api/hn/redeem/getBmtrPercent",
|
bmtrExchangePercent: "/api/hn/redeem/getBmtrPercent",
|
||||||
powerExchangeMuit: "/api/hn/redeem/getMuit",
|
powerExchangeMuit: "/api/hn/redeem/getMuit",
|
||||||
bmtRedeemConfig: "/api/hn/redeem/getConfigSet",
|
bmtRedeemConfig: "/api/hn/redeem/getConfigSet",
|
||||||
|
bmtRedeemPowerRateNew: "/api/hn/redeem/getRedeemPowerRateNew",
|
||||||
bmtExchangeSubmit: "/api/hn/redeem/redeem_bmt",
|
bmtExchangeSubmit: "/api/hn/redeem/redeem_bmt",
|
||||||
getUser: "/api/mxj/api/get_user",
|
getUser: "/api/mxj/api/get_user",
|
||||||
transferFee: "/api/hn/transfer/getProp",
|
transferFee: "/api/hn/transfer/getProp",
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,23 @@
|
||||||
<text class="form-card__title-text">BMT兑换</text>
|
<text class="form-card__title-text">BMT兑换</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="scheme-tabs">
|
||||||
|
<view
|
||||||
|
class="scheme-tab"
|
||||||
|
:class="{ 'scheme-tab--active': redeemType === 0 }"
|
||||||
|
@click="selectRedeemType(0)"
|
||||||
|
>
|
||||||
|
<text>{{ loadingRedeemType === 0 ? "加载中..." : "方案1" }}</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="scheme-tab"
|
||||||
|
:class="{ 'scheme-tab--active': redeemType === 1 }"
|
||||||
|
@click="selectRedeemType(1)"
|
||||||
|
>
|
||||||
|
<text>{{ loadingRedeemType === 1 ? "加载中..." : "方案2" }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="form-input">
|
<view class="form-input">
|
||||||
<decimal-input
|
<decimal-input
|
||||||
v-model="form.points"
|
v-model="form.points"
|
||||||
|
|
@ -189,9 +206,13 @@ import AssetPageShell from "../../components/asset-page-shell.vue";
|
||||||
import DecimalInput from "../../components/DecimalInput/DecimalInput.vue";
|
import DecimalInput from "../../components/DecimalInput/DecimalInput.vue";
|
||||||
import {
|
import {
|
||||||
fetchBmtExchangeDetail,
|
fetchBmtExchangeDetail,
|
||||||
|
fetchBmtRedeemConfig,
|
||||||
|
fetchBmtRedeemPowerRateNew,
|
||||||
submitAssetBmtExchange,
|
submitAssetBmtExchange,
|
||||||
} from "../../api/assets";
|
} from "../../api/assets";
|
||||||
|
|
||||||
|
const REDEEM_POINT_STEP = 100;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AssetConfirmPopup,
|
AssetConfirmPopup,
|
||||||
|
|
@ -204,6 +225,7 @@ export default {
|
||||||
ticker: {},
|
ticker: {},
|
||||||
balances: {},
|
balances: {},
|
||||||
exchangeConfig: {},
|
exchangeConfig: {},
|
||||||
|
schemeOneConfig: {},
|
||||||
tips: [],
|
tips: [],
|
||||||
},
|
},
|
||||||
hasShown: false,
|
hasShown: false,
|
||||||
|
|
@ -212,6 +234,9 @@ export default {
|
||||||
},
|
},
|
||||||
confirmVisible: false,
|
confirmVisible: false,
|
||||||
submitting: false,
|
submitting: false,
|
||||||
|
redeemType: 0,
|
||||||
|
schemeOneConfigLoaded: false,
|
||||||
|
loadingRedeemType: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
@ -241,47 +266,94 @@ export default {
|
||||||
redeemNumNumber() {
|
redeemNumNumber() {
|
||||||
return Number(this.detail.exchangeConfig.redeemNum || 0);
|
return Number(this.detail.exchangeConfig.redeemNum || 0);
|
||||||
},
|
},
|
||||||
estimateBmt() {
|
schemeOnePowerNumber() {
|
||||||
if (!this.pointsValue) {
|
return Number(this.detail.schemeOneConfig.power || 0);
|
||||||
return "0";
|
},
|
||||||
}
|
schemeOneBmtrNumber() {
|
||||||
const price = this.priceNumber;
|
return Number(this.detail.schemeOneConfig.bmtr || 0);
|
||||||
if (!price) {
|
},
|
||||||
return "0";
|
activePowerCostPerPoint() {
|
||||||
|
if (this.redeemType === 0) {
|
||||||
|
return this.schemeOnePowerNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.formatAmount(this.pointsValue / price, 2);
|
if (!this.configPointNumber) {
|
||||||
},
|
|
||||||
powerCost() {
|
|
||||||
if (!this.pointsValue || !this.configPointNumber) {
|
|
||||||
return "0.00";
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
(this.pointsValue / this.configPointNumber) * this.configPowerNumber
|
|
||||||
).toFixed(2);
|
|
||||||
},
|
|
||||||
bmtrCostNumber() {
|
|
||||||
if (!this.pointsValue || !this.configPointNumber) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return this.configPowerNumber / this.configPointNumber;
|
||||||
(this.pointsValue / this.configPointNumber) * this.configBmtrNumber
|
},
|
||||||
);
|
activeBmtrCostPerPoint() {
|
||||||
|
if (this.redeemType === 0) {
|
||||||
|
return this.schemeOneBmtrNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.configPointNumber) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.configBmtrNumber / this.configPointNumber;
|
||||||
|
},
|
||||||
|
canCalculateBmt() {
|
||||||
|
return this.redeemType === 0
|
||||||
|
? this.priceNumber > 0
|
||||||
|
: this.configPointNumber > 0 && this.redeemNumNumber > 0;
|
||||||
|
},
|
||||||
|
estimateBmt() {
|
||||||
|
if (!this.pointsValue || !this.canCalculateBmt) {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.formatAmount(this.calculateBmt(this.pointsValue), 2);
|
||||||
|
},
|
||||||
|
powerCostNumber() {
|
||||||
|
if (!this.pointsValue || !this.activePowerCostPerPoint) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.pointsValue * this.activePowerCostPerPoint;
|
||||||
|
},
|
||||||
|
powerCost() {
|
||||||
|
return this.formatTruncatedAmount(this.powerCostNumber, 2);
|
||||||
|
},
|
||||||
|
bmtrCostNumber() {
|
||||||
|
if (!this.pointsValue || !this.activeBmtrCostPerPoint) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.pointsValue * this.activeBmtrCostPerPoint;
|
||||||
},
|
},
|
||||||
bmtrCost() {
|
bmtrCost() {
|
||||||
return this.formatAmount(this.bmtrCostNumber, 4);
|
return this.formatTruncatedAmount(this.bmtrCostNumber, 2);
|
||||||
},
|
},
|
||||||
allEstimateBmt() {
|
allEstimateBmt() {
|
||||||
const points = Number(this.detail.balances.points || 0);
|
const points = Number(this.detail.balances.points || 0);
|
||||||
const price = this.priceNumber;
|
|
||||||
|
|
||||||
if (!price) {
|
if (!this.canCalculateBmt) {
|
||||||
return "0.00";
|
return "0.00";
|
||||||
}
|
}
|
||||||
|
|
||||||
const truncatedBmt = Math.floor((points / price) * 100) / 100;
|
let exchangeablePoints = points;
|
||||||
|
const power = Number(this.detail.balances.power || 0);
|
||||||
|
const bmtr = Number(this.detail.balances.bmtr || 0);
|
||||||
|
|
||||||
|
if (this.activePowerCostPerPoint > 0) {
|
||||||
|
exchangeablePoints = Math.min(
|
||||||
|
exchangeablePoints,
|
||||||
|
power / this.activePowerCostPerPoint,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.activeBmtrCostPerPoint > 0) {
|
||||||
|
exchangeablePoints = Math.min(
|
||||||
|
exchangeablePoints,
|
||||||
|
bmtr / this.activeBmtrCostPerPoint,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const truncatedBmt =
|
||||||
|
Math.floor(this.calculateBmt(Math.max(0, exchangeablePoints)) * 100) /
|
||||||
|
100;
|
||||||
return this.formatAmount(truncatedBmt, 2);
|
return this.formatAmount(truncatedBmt, 2);
|
||||||
},
|
},
|
||||||
priceNumber() {
|
priceNumber() {
|
||||||
|
|
@ -299,26 +371,55 @@ export default {
|
||||||
return this.detail.balances.points;
|
return this.detail.balances.points;
|
||||||
},
|
},
|
||||||
displayBmtr() {
|
displayBmtr() {
|
||||||
return this.formatAmount(this.detail.balances.bmtr, 4);
|
return this.formatAmount(this.detail.balances.bmtr, 2);
|
||||||
},
|
},
|
||||||
displayPrice() {
|
displayPrice() {
|
||||||
return this.priceNumber ? this.priceNumber : "0.00";
|
return this.priceNumber ? this.priceNumber : "0.00";
|
||||||
},
|
},
|
||||||
normalizedTips() {
|
normalizedTips() {
|
||||||
if (this.detail.tips && this.detail.tips.length) {
|
const tips =
|
||||||
return this.detail.tips;
|
this.detail.tips && this.detail.tips.length
|
||||||
}
|
? this.detail.tips.slice()
|
||||||
|
: [
|
||||||
return [
|
`预估BMT数=输入可用积分数÷${this.configPointNumber}×${this.redeemNumNumber}。`,
|
||||||
"BMT=积分-BMT实时价格;",
|
"",
|
||||||
`消耗算力=输入可用积分数÷${this.configPointNumber}×${this.configPowerNumber};`,
|
`只能兑换${REDEEM_POINT_STEP}的整数倍,小于${REDEEM_POINT_STEP}积分不可兑换;`,
|
||||||
`消耗BMTR=输入可用积分数÷${this.configPointNumber}×${this.configBmtrNumber};`,
|
|
||||||
`只能兑换${this.redeemNumNumber}的整数倍,小于${this.redeemNumNumber}积分不可兑换;`,
|
|
||||||
"凌晨0点-凌晨1点积分系统维护不可兑换;",
|
"凌晨0点-凌晨1点积分系统维护不可兑换;",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
tips[1] =
|
||||||
|
this.redeemType === 0
|
||||||
|
? `方案1消耗算力=输入可用积分数×${this.schemeOnePowerNumber},消耗BMTR=输入可用积分数×${this.schemeOneBmtrNumber};`
|
||||||
|
: `方案2消耗算力=输入可用积分数÷${this.configPointNumber}×${this.configPowerNumber},消耗BMTR=输入可用积分数÷${this.configPointNumber}×${this.configBmtrNumber};`;
|
||||||
|
tips[0] =
|
||||||
|
this.redeemType === 0
|
||||||
|
? "方案1预估BMT数=输入可用积分数÷BMT实时价格。"
|
||||||
|
: `方案2预估BMT数=(输入可用积分数÷${this.configPointNumber},保留4位小数)×${this.redeemNumNumber},结果保留2位小数。`;
|
||||||
|
|
||||||
|
return tips;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
calculateBmt(points) {
|
||||||
|
const pointAmount = Number(points || 0);
|
||||||
|
|
||||||
|
if (!pointAmount) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.redeemType === 0) {
|
||||||
|
return this.priceNumber ? pointAmount / this.priceNumber : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.configPointNumber || !this.redeemNumNumber) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const convertedPoints = Number(
|
||||||
|
(pointAmount / this.configPointNumber).toFixed(4),
|
||||||
|
);
|
||||||
|
return convertedPoints * this.redeemNumNumber;
|
||||||
|
},
|
||||||
pageIcon(type) {
|
pageIcon(type) {
|
||||||
const iconMap = {
|
const iconMap = {
|
||||||
power: "https://imgs.agrimedia.cn/bm-bmt/s.png",
|
power: "https://imgs.agrimedia.cn/bm-bmt/s.png",
|
||||||
|
|
@ -349,6 +450,18 @@ export default {
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
},
|
},
|
||||||
|
formatTruncatedAmount(value, digits) {
|
||||||
|
const number = Number(value || 0);
|
||||||
|
const precision = Number(digits || 0);
|
||||||
|
|
||||||
|
if (!Number.isFinite(number)) {
|
||||||
|
return precision > 0 ? Number(0).toFixed(precision) : "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
const factor = Math.pow(10, precision);
|
||||||
|
const truncated = Math.floor(Math.max(0, number) * factor) / factor;
|
||||||
|
return this.formatAmount(truncated, precision);
|
||||||
|
},
|
||||||
async loadPage(showLoading) {
|
async loadPage(showLoading) {
|
||||||
try {
|
try {
|
||||||
this.detail = await fetchBmtExchangeDetail(
|
this.detail = await fetchBmtExchangeDetail(
|
||||||
|
|
@ -359,6 +472,9 @@ export default {
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
|
this.schemeOneConfigLoaded = Boolean(
|
||||||
|
this.detail.schemeOneConfigLoaded,
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || "页面加载失败",
|
title: error.message || "页面加载失败",
|
||||||
|
|
@ -366,6 +482,40 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async selectRedeemType(type) {
|
||||||
|
const nextType = Number(type) === 0 ? 0 : 1;
|
||||||
|
|
||||||
|
if (nextType === this.redeemType || this.loadingRedeemType !== null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadingRedeemType = nextType;
|
||||||
|
try {
|
||||||
|
const configResult = await Promise.all([
|
||||||
|
fetchBmtRedeemConfig({
|
||||||
|
showLoading: true,
|
||||||
|
loadingText: "刷新兑换配置",
|
||||||
|
}),
|
||||||
|
fetchBmtRedeemPowerRateNew({
|
||||||
|
showLoading: true,
|
||||||
|
loadingText: "刷新兑换配置",
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.detail.exchangeConfig = configResult[0];
|
||||||
|
this.detail.schemeOneConfig = configResult[1];
|
||||||
|
this.schemeOneConfigLoaded = true;
|
||||||
|
|
||||||
|
this.redeemType = nextType;
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || "兑换方案配置加载失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
this.loadingRedeemType = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
openConfirm() {
|
openConfirm() {
|
||||||
if (this.submitting || this.confirmVisible) {
|
if (this.submitting || this.confirmVisible) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -394,17 +544,17 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.redeemNumNumber && this.pointsValue < this.redeemNumNumber) {
|
if (this.pointsValue < REDEEM_POINT_STEP) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `小于${this.redeemNumNumber}积分不可兑换`,
|
title: `小于${REDEEM_POINT_STEP}积分不可兑换`,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.redeemNumNumber && this.pointsValue % this.redeemNumNumber !== 0) {
|
if (this.pointsValue % REDEEM_POINT_STEP !== 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `只能兑换${this.redeemNumNumber}的整数倍`,
|
title: `只能兑换${REDEEM_POINT_STEP}的整数倍`,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -418,7 +568,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number(this.powerCost) > Number(this.detail.balances.power || 0)) {
|
if (this.powerCostNumber > Number(this.detail.balances.power || 0)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "可用算力不足",
|
title: "可用算力不足",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
|
@ -439,6 +589,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
await submitAssetBmtExchange({
|
await submitAssetBmtExchange({
|
||||||
amount: this.pointsValue,
|
amount: this.pointsValue,
|
||||||
|
type: this.redeemType,
|
||||||
}, {
|
}, {
|
||||||
showLoading: true,
|
showLoading: true,
|
||||||
loadingText: "兑换中",
|
loadingText: "兑换中",
|
||||||
|
|
@ -641,6 +792,32 @@ export default {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scheme-tabs {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
padding: 6rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
background: #191e32;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheme-tab {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
height: 64rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(177, 187, 214, 0.76);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheme-tab--active {
|
||||||
|
background: #20b6f5;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
.form-input {
|
.form-input {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ export default {
|
||||||
return this.formatAmount(this.detail.balances.coupon, 2);
|
return this.formatAmount(this.detail.balances.coupon, 2);
|
||||||
},
|
},
|
||||||
displayBmtr() {
|
displayBmtr() {
|
||||||
return this.formatAmount(this.detail.balances.bmtr, 4);
|
return this.formatAmount(this.detail.balances.bmtr, 2);
|
||||||
},
|
},
|
||||||
displayPrice() {
|
displayPrice() {
|
||||||
return this.priceNumber ? this.priceNumber : "0.00";
|
return this.priceNumber ? this.priceNumber : "0.00";
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,11 @@
|
||||||
<view class="asset-mini-card__head">
|
<view class="asset-mini-card__head">
|
||||||
<text class="asset-mini-card__label">{{ item.title }}</text>
|
<text class="asset-mini-card__label">{{ item.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="asset-mini-card__value asset-number-font">{{ formatAssetValue(item.value) }}</text>
|
<text class="asset-mini-card__value asset-number-font">{{
|
||||||
|
item.key === "bmtr"
|
||||||
|
? formatBmtrValue(item.value)
|
||||||
|
: formatAssetValue(item.value)
|
||||||
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -163,6 +167,10 @@ export default {
|
||||||
formatAssetValue(value) {
|
formatAssetValue(value) {
|
||||||
return truncateToTwo(value);
|
return truncateToTwo(value);
|
||||||
},
|
},
|
||||||
|
formatBmtrValue(value) {
|
||||||
|
const number = Number(value || 0);
|
||||||
|
return Number.isFinite(number) ? number.toFixed(2) : "0.00";
|
||||||
|
},
|
||||||
async loadPage(options = {}) {
|
async loadPage(options = {}) {
|
||||||
if (this.isFetchingHome) {
|
if (this.isFetchingHome) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -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)'))
|
<!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.19c00be4.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.47f364de.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
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
Loading…
Reference in New Issue