This commit is contained in:
parent
f18abcc19b
commit
6918f6ca90
|
|
@ -1859,6 +1859,18 @@ async function fetchTransferBmtrBalanceData(requestOptions) {
|
|||
);
|
||||
}
|
||||
|
||||
async function fetchBmtrExchangePercentData(requestOptions) {
|
||||
return fetchPayload(
|
||||
createRequestOptions(
|
||||
{
|
||||
url: serviceConfig.ENDPOINTS.bmtrExchangePercent,
|
||||
},
|
||||
requestOptions,
|
||||
),
|
||||
"BMTR兑换手续费比例加载失败",
|
||||
);
|
||||
}
|
||||
|
||||
async function fetchWithdrawRateData(requestOptions) {
|
||||
return fetchPayload(
|
||||
createRequestOptions(
|
||||
|
|
@ -1881,6 +1893,7 @@ function resolvePercentRate(data) {
|
|||
"feeRate",
|
||||
"withdraw_rate",
|
||||
"withdrawRate",
|
||||
"percent",
|
||||
"prop",
|
||||
"value",
|
||||
"num",
|
||||
|
|
@ -2509,9 +2522,18 @@ export async function fetchBmtFlashExchangeDetail(requestOptions) {
|
|||
const result = await Promise.all([
|
||||
fetchPriceData(requestOptions),
|
||||
fetchHomeBalanceData(requestOptions),
|
||||
fetchUserData(requestOptions).catch(function () {
|
||||
return null;
|
||||
}),
|
||||
fetchBmtrExchangePercentData(requestOptions).catch(function () {
|
||||
return null;
|
||||
}),
|
||||
]);
|
||||
const ticker = normalizeTicker(result[0]);
|
||||
const balances = normalizeBalances(result[1]);
|
||||
const bmtr = pickFirstValue(result[2], ["bmtr"]);
|
||||
const bmtrPercent = result[3] ? resolvePercentRate(result[3]) : "";
|
||||
const bmtrRatio = result[3] ? pickFirstValue(result[3], ["bl"]) : "";
|
||||
|
||||
setHomeTickerCache(ticker);
|
||||
|
||||
|
|
@ -2522,7 +2544,10 @@ export async function fetchBmtFlashExchangeDetail(requestOptions) {
|
|||
coupon: toFixedNumber(balances.coupon, 2),
|
||||
voucher: toFixedNumber(balances.voucher, 2),
|
||||
brokerage_price: toFixedNumber(balances.balance, 2),
|
||||
bmtr: toFixedNumber(bmtr, 4),
|
||||
},
|
||||
bmtrPercent: bmtrPercent || "",
|
||||
bmtrRatio: bmtrRatio === "" ? "" : String(bmtrRatio),
|
||||
tips: [
|
||||
"BMT闪兑 = 输入数量 ÷ BMT实时价格",
|
||||
"BMT闪兑时所需的抵用券、消费券、余额。必须大于10的倍数。",
|
||||
|
|
@ -2532,10 +2557,13 @@ export async function fetchBmtFlashExchangeDetail(requestOptions) {
|
|||
}
|
||||
|
||||
export async function submitAssetBmtFlashExchange(payload, requestOptions) {
|
||||
const rawMode = payload && payload.mode;
|
||||
const mode =
|
||||
payload && payload.mode === "coupon"
|
||||
rawMode === "bmtr"
|
||||
? "bmtr"
|
||||
: rawMode === "coupon"
|
||||
? "coupon"
|
||||
: payload && payload.mode === "balance"
|
||||
: rawMode === "balance"
|
||||
? "balance"
|
||||
: "voucher";
|
||||
const amount = toNumber(payload && payload.amount);
|
||||
|
|
@ -2544,13 +2572,24 @@ export async function submitAssetBmtFlashExchange(payload, requestOptions) {
|
|||
throw createError("请输入闪兑数量");
|
||||
}
|
||||
|
||||
if (mode === "bmtr" && amount < 0.01) {
|
||||
throw createError("BMTR闪兑最小数量为0.01");
|
||||
}
|
||||
|
||||
await fetchPayload(
|
||||
createRequestOptions(
|
||||
{
|
||||
url: serviceConfig.ENDPOINTS.bmtFlashExchangeSubmit,
|
||||
method: "POST",
|
||||
data: {
|
||||
type: mode === "coupon" ? 1 : mode === "balance" ? 2 : 0,
|
||||
type:
|
||||
mode === "coupon"
|
||||
? 1
|
||||
: mode === "balance"
|
||||
? 2
|
||||
: mode === "bmtr"
|
||||
? 3
|
||||
: 0,
|
||||
number: String(amount),
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ const serviceConfig = {
|
|||
spreadCommission: "/api/spread/commission",
|
||||
powerExchangeSubmit: "/api/hn/redeem/power",
|
||||
bmtFlashExchangeSubmit: "/api/hn/redeem/justRedeem",
|
||||
bmtrExchangePercent: "/api/hn/redeem/getBmtrPercent",
|
||||
powerExchangeMuit: "/api/hn/redeem/getMuit",
|
||||
bmtRedeemPowerRate: "/api/hn/redeem/getRedeemPowerRate",
|
||||
bmtExchangeSubmit: "/api/hn/redeem/redeem_bmt",
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
"devServer" : {
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
"target" : "https__UNI__B250220",
|
||||
"target" : "https://tpoint.agrimedia.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</view>
|
||||
<text class="hero-card__coin-text">BMT</text>
|
||||
</view>
|
||||
<text class="hero-card__label">可用1BMT:</text>
|
||||
<text class="hero-card__label">可用BMT:</text>
|
||||
<text class="hero-card__value asset-number-font">{{ displayBmt }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@
|
|||
<text class="hero-card__label">可用BMT数量:</text>
|
||||
<text class="hero-card__value asset-number-font">{{ displayBmt }}</text>
|
||||
</view>
|
||||
<view class="hero-card__price">
|
||||
<text class="hero-card__price-label">BMT实时价格</text>
|
||||
<view class="hero-card__price-row">
|
||||
<text class="hero-card__price-value asset-number-font">{{ displayPrice }}</text>
|
||||
<text class="hero-card__price-unit">BMT/CNY</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="panel-card info-card">
|
||||
|
|
@ -61,18 +68,15 @@
|
|||
<view class="info-row__left">
|
||||
<image
|
||||
class="info-row__icon"
|
||||
:src="pageIcon('bmt')"
|
||||
:src="pageIcon('bmtr')"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="info-row__label">BMT实时价格</text>
|
||||
</view>
|
||||
<view class="info-row__price">
|
||||
<text class="info-row__value asset-number-font">{{ displayPrice }}</text>
|
||||
<text class="info-row__unit">BMT/CNY</text>
|
||||
<text class="info-row__label">BMTR数量</text>
|
||||
</view>
|
||||
<text class="info-row__value asset-number-font">{{ displayBmtr }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-card__estimate">
|
||||
<view v-if="!isBmtrMode" class="info-card__estimate">
|
||||
<text>全部闪兑预估可得</text>
|
||||
<text class="info-card__estimate-value asset-number-font">{{ allEstimateBmt }}</text>
|
||||
<text>BMT</text>
|
||||
|
|
@ -175,10 +179,13 @@ export default {
|
|||
{ label: "抵用券闪兑", value: "voucher" },
|
||||
{ label: "消费券闪兑", value: "coupon" },
|
||||
{ label: "余额闪兑", value: "balance" },
|
||||
{ label: "BMTR闪兑", value: "bmtr" },
|
||||
],
|
||||
detail: {
|
||||
ticker: {},
|
||||
balances: {},
|
||||
bmtrPercent: "",
|
||||
bmtrRatio: "",
|
||||
tips: [],
|
||||
},
|
||||
hasShown: false,
|
||||
|
|
@ -216,6 +223,10 @@ export default {
|
|||
return Number(this.form.amount || 0);
|
||||
},
|
||||
currentModeLabel() {
|
||||
if (this.form.mode === "bmtr") {
|
||||
return "BMTR";
|
||||
}
|
||||
|
||||
if (this.form.mode === "coupon") {
|
||||
return "消费券";
|
||||
}
|
||||
|
|
@ -227,6 +238,10 @@ export default {
|
|||
return "抵用券";
|
||||
},
|
||||
currentModeBalance() {
|
||||
if (this.form.mode === "bmtr") {
|
||||
return Number(this.detail.balances.bmtr || 0);
|
||||
}
|
||||
|
||||
if (this.form.mode === "coupon") {
|
||||
return Number(this.detail.balances.coupon || 0);
|
||||
}
|
||||
|
|
@ -240,14 +255,68 @@ export default {
|
|||
priceNumber() {
|
||||
return Number(this.detail.ticker.close || this.detail.ticker.cnyPrice || 0);
|
||||
},
|
||||
isBmtrMode() {
|
||||
return this.form.mode === "bmtr";
|
||||
},
|
||||
bmtrPercentNumber() {
|
||||
const percent = Number(this.detail.bmtrPercent);
|
||||
return Number.isFinite(percent) && percent > 0 ? percent : 0;
|
||||
},
|
||||
hasBmtrPercent() {
|
||||
return this.bmtrPercentNumber > 0;
|
||||
},
|
||||
bmtrRatioNumber() {
|
||||
const ratio = Number(this.detail.bmtrRatio);
|
||||
return Number.isFinite(ratio) && ratio > 0 ? ratio : 0;
|
||||
},
|
||||
hasBmtrRatio() {
|
||||
return this.bmtrRatioNumber > 0;
|
||||
},
|
||||
bmtrExchangeRate() {
|
||||
return Math.max(0, (100 - this.bmtrPercentNumber) / 100);
|
||||
},
|
||||
displayBmtrRatio() {
|
||||
if (!this.hasBmtrRatio) {
|
||||
return "--";
|
||||
}
|
||||
|
||||
return String(this.detail.bmtrRatio);
|
||||
},
|
||||
displayBmtrPercent() {
|
||||
if (!this.hasBmtrPercent) {
|
||||
return "--";
|
||||
}
|
||||
|
||||
const value = this.bmtrPercentNumber;
|
||||
return Number.isInteger(value) ? String(value) : String(value);
|
||||
},
|
||||
estimateBmt() {
|
||||
if (!this.amountValue || !this.priceNumber) {
|
||||
if (!this.amountValue) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
if (this.isBmtrMode) {
|
||||
if (!this.hasBmtrPercent || !this.hasBmtrRatio) {
|
||||
return "--";
|
||||
}
|
||||
|
||||
return this.formatAmount(
|
||||
this.amountValue * this.bmtrRatioNumber * this.bmtrExchangeRate,
|
||||
2,
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.priceNumber) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
return this.formatAmount(this.amountValue / this.priceNumber, 2);
|
||||
},
|
||||
allEstimateBmt() {
|
||||
if (this.isBmtrMode) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
if (!this.priceNumber) {
|
||||
return "0";
|
||||
}
|
||||
|
|
@ -271,19 +340,36 @@ export default {
|
|||
displayCoupon() {
|
||||
return this.formatAmount(this.detail.balances.coupon, 2);
|
||||
},
|
||||
displayBmtr() {
|
||||
return this.formatAmount(this.detail.balances.bmtr, 4);
|
||||
},
|
||||
displayPrice() {
|
||||
return this.priceNumber ? this.priceNumber : "0.00";
|
||||
},
|
||||
displayInputAmount() {
|
||||
return this.formatAmount(this.amountValue, this.isBmtrMode ? 2 : 0);
|
||||
},
|
||||
normalizedTips() {
|
||||
if (this.detail.tips && this.detail.tips.length) {
|
||||
return this.detail.tips;
|
||||
}
|
||||
|
||||
return [
|
||||
const tips =
|
||||
this.detail.tips && this.detail.tips.length
|
||||
? this.detail.tips
|
||||
: [
|
||||
"BMT闪兑 = 输入数量 ÷ BMT实时价格",
|
||||
"BMT闪兑时所需的抵用券、消费券、余额。必须大于10的倍数。",
|
||||
"闪兑成功后数量将直接结算到可用BMT。",
|
||||
];
|
||||
|
||||
if (!this.isBmtrMode) {
|
||||
return tips;
|
||||
}
|
||||
|
||||
return tips.concat([
|
||||
"BMTR兑换BMT1:" +
|
||||
this.displayBmtrRatio +
|
||||
"兑换,按兑换数量扣除" +
|
||||
this.displayBmtrPercent +
|
||||
"%手续费,兑换最小数量必须是10的倍数",
|
||||
]);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -297,6 +383,7 @@ export default {
|
|||
voucher: "https://imgs.agrimedia.cn/bm-bmt/quan-icon-g%20%281%29.png",
|
||||
points: "https://imgs.agrimedia.cn/bm-bmt/j.png",
|
||||
coupon: "https://imgs.agrimedia.cn/bm-bmt/xiaofei-icon-o.png",
|
||||
bmtr: "https://imgs.agrimedia.cn/webimg/202607171808386371853.svg",
|
||||
};
|
||||
|
||||
return iconMap[type] || "";
|
||||
|
|
@ -375,7 +462,16 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.amountValue < 10) {
|
||||
if (this.isBmtrMode && this.amountValue < 0.01) {
|
||||
this.openResultDialog(
|
||||
"error",
|
||||
"闪兑失败!",
|
||||
"BMTR闪兑最小数量为0.01。",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isBmtrMode && this.amountValue < 10) {
|
||||
this.openResultDialog(
|
||||
"error",
|
||||
"闪兑失败!",
|
||||
|
|
@ -397,7 +493,7 @@ export default {
|
|||
title: "确认闪兑",
|
||||
message:
|
||||
"确认使用" +
|
||||
this.formatAmount(this.amountValue, 0) +
|
||||
this.displayInputAmount +
|
||||
this.currentModeLabel +
|
||||
"闪兑BMT?",
|
||||
description: "预估可得 " + this.estimateBmt + " BMT",
|
||||
|
|
@ -491,6 +587,7 @@ export default {
|
|||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 360rpx;
|
||||
}
|
||||
|
||||
.hero-card__coin-row {
|
||||
|
|
@ -532,6 +629,43 @@ export default {
|
|||
font-weight: 800;
|
||||
line-height: 1.1;
|
||||
color: #ffffff;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.hero-card__price {
|
||||
position: absolute;
|
||||
right: 36rpx;
|
||||
top: 104rpx;
|
||||
z-index: 2;
|
||||
min-width: 220rpx;
|
||||
padding: 18rpx 22rpx;
|
||||
border-radius: 10rpx;
|
||||
background: rgba(28, 35, 61, 0.82);
|
||||
box-shadow: 0 14rpx 30rpx rgba(6, 10, 24, 0.24);
|
||||
}
|
||||
|
||||
.hero-card__price-label {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: rgba(225, 232, 255, 0.86);
|
||||
}
|
||||
|
||||
.hero-card__price-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.hero-card__price-value {
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.hero-card__price-unit {
|
||||
margin-left: 10rpx;
|
||||
font-size: 20rpx;
|
||||
color: rgba(225, 232, 255, 0.72);
|
||||
}
|
||||
|
||||
.panel-card {
|
||||
|
|
@ -581,17 +715,6 @@ export default {
|
|||
color: #ffffff;
|
||||
}
|
||||
|
||||
.info-row__price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.info-row__unit {
|
||||
margin-left: 10rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(184, 193, 218, 0.88);
|
||||
}
|
||||
|
||||
.info-card__estimate {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
|
@ -633,7 +756,7 @@ export default {
|
|||
|
||||
.mode-tabs {
|
||||
display: flex;
|
||||
width: 600rpx;
|
||||
width: 100%;
|
||||
margin: 26rpx auto 0;
|
||||
padding: 4rpx;
|
||||
border-radius: 999rpx;
|
||||
|
|
@ -648,8 +771,9 @@ export default {
|
|||
flex: 1;
|
||||
height: 60rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 28rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
color: rgba(210, 219, 242, 0.72);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.c4c7e156.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.ba479755.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
Loading…
Reference in New Issue