This commit is contained in:
whitechiina 2026-05-20 10:37:44 +08:00
parent 7dbdef08a3
commit dabe02c671
20 changed files with 98 additions and 32 deletions

View File

@ -146,6 +146,7 @@ function normalizeBalances(data) {
withdrawableBmt: toNumber(data && data.bmt_num), withdrawableBmt: toNumber(data && data.bmt_num),
voucher: toNumber(data && data.coin), voucher: toNumber(data && data.coin),
coupon: toNumber(data && data.diamond_balance), coupon: toNumber(data && data.diamond_balance),
balance: toNumber(data && data.brokerage_price),
}; };
} }
@ -161,6 +162,7 @@ function buildHomeOverview(balanceData, tickerData) {
const balances = normalizeBalances(balanceData); const balances = normalizeBalances(balanceData);
const ticker = normalizeTicker(tickerData); const ticker = normalizeTicker(tickerData);
const rawQuickAssets = { const rawQuickAssets = {
balance: toRawDisplayValue(balanceData && balanceData.brokerage_price),
points: toRawDisplayValue(balanceData && balanceData.point), points: toRawDisplayValue(balanceData && balanceData.point),
voucher: toRawDisplayValue(balanceData && balanceData.coin), voucher: toRawDisplayValue(balanceData && balanceData.coin),
coupon: toRawDisplayValue(balanceData && balanceData.diamond_balance), coupon: toRawDisplayValue(balanceData && balanceData.diamond_balance),
@ -193,24 +195,31 @@ function buildHomeOverview(balanceData, tickerData) {
value: rawQuickAssets.points, value: rawQuickAssets.points,
accent: "gold", accent: "gold",
}, },
{
key: "power",
title: "算力",
value: rawQuickAssets.power,
accent: "violet",
},
{
key: "coupon",
title: "消费券",
value: rawQuickAssets.coupon,
accent: "teal",
},
{ {
key: "voucher", key: "voucher",
title: "抵用券", title: "抵用券",
value: rawQuickAssets.voucher, value: rawQuickAssets.voucher,
accent: "rose", accent: "rose",
}, },
{ {
key: "coupon", key: "balance",
title: "消费券", title: "余额",
value: rawQuickAssets.coupon, value: rawQuickAssets.balance,
accent: "teal", accent: "blue",
}, },
{
key: "power",
title: "算力",
value: rawQuickAssets.power,
accent: "violet",
},
], ],
features: [ features: [
{ {
@ -1854,17 +1863,23 @@ export async function fetchPowerExchangeDetail(requestOptions) {
coupon: toFixedNumber(balances.coupon, 2), coupon: toFixedNumber(balances.coupon, 2),
voucher: toFixedNumber(balances.voucher, 2), voucher: toFixedNumber(balances.voucher, 2),
power: toFixedNumber(balances.power, 2), power: toFixedNumber(balances.power, 2),
brokerage_price: toFixedNumber(balances.balance, 2),
}, },
tips: [ tips: [
"算力 = 抵用券或消费券 ÷ BMT实时价格", "算力 = 输入数量 ÷ BMT实时价格",
"抵用券和消费券总数小于10的倍数不可兑换", "输入兑换数量小于10的倍数不可兑换",
"算力用于兑换BMT使用。", "算力用于兑换BMT使用。",
], ],
}; };
} }
export async function submitAssetPowerExchange(payload, requestOptions) { export async function submitAssetPowerExchange(payload, requestOptions) {
const mode = payload && payload.mode === "coupon" ? "coupon" : "voucher"; const mode =
payload && payload.mode === "coupon"
? "coupon"
: payload && payload.mode === "balance"
? "balance"
: "voucher";
const amount = toNumber(payload && payload.amount); const amount = toNumber(payload && payload.amount);
if (!amount) { if (!amount) {
@ -1876,7 +1891,7 @@ export async function submitAssetPowerExchange(payload, requestOptions) {
url: serviceConfig.ENDPOINTS.powerExchangeSubmit, url: serviceConfig.ENDPOINTS.powerExchangeSubmit,
method: "POST", method: "POST",
data: { data: {
type: mode === "coupon" ? 1 : 0, type: mode === "coupon" ? 1 : mode === "balance" ? 2 : 0,
number: String(amount), number: String(amount),
}, },
}, requestOptions), }, requestOptions),
@ -1963,6 +1978,7 @@ export async function fetchWithdrawDetail(requestOptions) {
balances: { balances: {
voucher: balances.voucher, voucher: balances.voucher,
coupon: balances.coupon, coupon: balances.coupon,
brokerage_price: toFixedNumber(balances.balance, 2),
}, },
wallets: walletPayload.wallets, wallets: walletPayload.wallets,
defaultWallet: walletPayload.wallets[0] || null, defaultWallet: walletPayload.wallets[0] || null,

View File

@ -1,5 +1,5 @@
// const HOST_URL = "https://tpoint.agrimedia.cn"; const HOST_URL = "https://tpoint.agrimedia.cn";
const HOST_URL = window.location.protocol + "//" + window.location.host; // const HOST_URL = window.location.protocol + "//" + window.location.host;
const serviceConfig = { const serviceConfig = {

View File

@ -72,7 +72,7 @@
"h5" : { "h5" : {
"router" : { "router" : {
"base" : "/bmt/", "base" : "/bmt/",
"mode" : "history" "mode" : "hash"
} }
} }
} }

View File

@ -210,7 +210,7 @@ export default {
{ {
key: "500-plus", key: "500-plus",
label: "500以上", label: "500以上",
interval: "500,10000", interval: "500,10000000",
}, },
]; ];
}, },

View File

@ -22,6 +22,18 @@
<view class="panel-card info-card"> <view class="panel-card info-card">
<view class="info-row"> <view class="info-row">
<view class="info-row__left">
<image
class="info-row__icon"
:src="pageIcon('yue')"
mode="aspectFit"
></image>
<text class="info-row__label">我的余额</text>
</view>
<text class="info-row__value asset-number-font">{{ disbrokerageprice }}</text>
</view>
<view class="info-row">
<view class="info-row__left"> <view class="info-row__left">
<image <image
class="info-row__icon" class="info-row__icon"
@ -96,6 +108,7 @@
type="number" type="number"
:placeholder="'请输入' + currentModeLabel + '数量'" :placeholder="'请输入' + currentModeLabel + '数量'"
placeholder-class="form-input__placeholder" placeholder-class="form-input__placeholder"
@wheel.prevent="preventAmountWheelChange"
/> />
<text class="form-input__suffix">{{ currentModeLabel }}</text> <text class="form-input__suffix">{{ currentModeLabel }}</text>
</view> </view>
@ -161,6 +174,7 @@ export default {
modeList: [ modeList: [
{ label: "抵用券兑换", value: "voucher" }, { label: "抵用券兑换", value: "voucher" },
{ label: "消费券兑换", value: "coupon" }, { label: "消费券兑换", value: "coupon" },
{ label: "余额兑换", value: "balance" },
], ],
detail: { detail: {
ticker: {}, ticker: {},
@ -203,13 +217,25 @@ export default {
return Number(this.form.amount || 0); return Number(this.form.amount || 0);
}, },
currentModeLabel() { currentModeLabel() {
return this.form.mode === "coupon" ? "消费券" : "抵用券"; if (this.form.mode === "coupon") {
return "消费券";
}
if (this.form.mode === "balance") {
return "余额";
}
return "抵用券";
}, },
currentModeBalance() { currentModeBalance() {
if (this.form.mode === "coupon") { if (this.form.mode === "coupon") {
return Number(this.detail.balances.coupon || 0); return Number(this.detail.balances.coupon || 0);
} }
if (this.form.mode === "balance") {
return Number(this.detail.balances.brokerage_price || 0);
}
return Number(this.detail.balances.voucher || 0); return Number(this.detail.balances.voucher || 0);
}, },
priceNumber() { priceNumber() {
@ -238,7 +264,8 @@ export default {
const totalTickets = const totalTickets =
Number(this.detail.balances.voucher || 0) + Number(this.detail.balances.voucher || 0) +
Number(this.detail.balances.coupon || 0); Number(this.detail.balances.coupon || 0) +
Number(this.detail.balances.brokerage_price || 0);
return this.formatAmount( return this.formatAmount(
totalTickets / this.priceNumber * this.exchangeMultiplierNumber, totalTickets / this.priceNumber * this.exchangeMultiplierNumber,
@ -251,6 +278,9 @@ export default {
displayVoucher() { displayVoucher() {
return this.formatAmount(this.detail.balances.voucher, 2); return this.formatAmount(this.detail.balances.voucher, 2);
}, },
disbrokerageprice() {
return this.formatAmount(this.detail.balances.brokerage_price, 2);
},
displayCoupon() { displayCoupon() {
return this.formatAmount(this.detail.balances.coupon, 2); return this.formatAmount(this.detail.balances.coupon, 2);
}, },
@ -272,6 +302,7 @@ export default {
methods: { methods: {
pageIcon(type) { pageIcon(type) {
const iconMap = { const iconMap = {
yue: 'https://imgs.agrimedia.cn/bm-bmt/qianbao-icon.png',
power: "https://imgs.agrimedia.cn/bm-bmt/s.png", power: "https://imgs.agrimedia.cn/bm-bmt/s.png",
bmt: "https://imgs.agrimedia.cn/bm-bmt/b.png", bmt: "https://imgs.agrimedia.cn/bm-bmt/b.png",
transfer: "https://imgs.agrimedia.cn/bm-bmt/z.png", transfer: "https://imgs.agrimedia.cn/bm-bmt/z.png",
@ -300,6 +331,16 @@ export default {
.toString() .toString()
.replace(/\B(?=(\d{3})+(?!\d))/g, ","); .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}, },
preventAmountWheelChange(event) {
if (event && typeof event.preventDefault === "function") {
event.preventDefault();
}
const target = event && event.target;
if (target && typeof target.blur === "function") {
target.blur();
}
},
async loadPage(showLoading) { async loadPage(showLoading) {
try { try {
this.detail = await fetchPowerExchangeDetail( this.detail = await fetchPowerExchangeDetail(
@ -351,7 +392,7 @@ export default {
this.openResultDialog( this.openResultDialog(
"error", "error",
"兑换失败!", "兑换失败!",
"抵用券和消费券总数小于10的倍数不可兑换", "兑换数量小于10的倍数不可用",
); );
return; return;
} }
@ -603,7 +644,7 @@ export default {
.mode-tabs { .mode-tabs {
display: flex; display: flex;
width: 400rpx; width: 600rpx;
margin: 26rpx auto 0; margin: 26rpx auto 0;
padding: 4rpx; padding: 4rpx;
border-radius: 999rpx; border-radius: 999rpx;

View File

@ -387,6 +387,7 @@ export default {
); );
this.walletVisible = false; this.walletVisible = false;
} catch (error) { } catch (error) {
console.log(error)
uni.showToast({ uni.showToast({
title: error.message || "页面加载失败", title: error.message || "页面加载失败",
icon: "none", icon: "none",

View File

@ -29,7 +29,7 @@
<view class="home-skeleton__section"> <view class="home-skeleton__section">
<view class="home-skeleton__title skeleton-block"></view> <view class="home-skeleton__title skeleton-block"></view>
<view class="home-skeleton__asset-grid"> <view class="home-skeleton__asset-grid">
<view v-for="index in 4" :key="'home-skeleton-asset-' + index" class="home-skeleton__asset-card skeleton-card"> <view v-for="index in 5" :key="'home-skeleton-asset-' + index" class="home-skeleton__asset-card skeleton-card">
<view class="home-skeleton__line home-skeleton__line--asset-label skeleton-block"></view> <view class="home-skeleton__line home-skeleton__line--asset-label skeleton-block"></view>
<view class="home-skeleton__line home-skeleton__line--asset-value skeleton-block"></view> <view class="home-skeleton__line home-skeleton__line--asset-value skeleton-block"></view>
</view> </view>
@ -225,6 +225,7 @@ export default {
}, },
quickAssetBg(key) { quickAssetBg(key) {
const bgMap = { const bgMap = {
balance: "https://imgs.agrimedia.cn/bm-bmt/brokerage-icon.png",
points: "https://imgs.agrimedia.cn/bm-bmt/jifen-bg.png", points: "https://imgs.agrimedia.cn/bm-bmt/jifen-bg.png",
voucher: "https://imgs.agrimedia.cn/bm-bmt/quan-bg.png", voucher: "https://imgs.agrimedia.cn/bm-bmt/quan-bg.png",
coupon: "https://imgs.agrimedia.cn/bm-bmt/xiaofei-bg.png", coupon: "https://imgs.agrimedia.cn/bm-bmt/xiaofei-bg.png",
@ -282,6 +283,13 @@ export default {
}); });
}, },
openQuickAsset(item) { openQuickAsset(item) {
if (item && item.key === "balance") {
this.navigateToExternalUrl(
serviceConfig.HTTP_REQUEST_URL + "/JXH5/pages/users/user_spread_money/index?type=2",
);
return;
}
if (item && item.key === "voucher") { if (item && item.key === "voucher") {
this.openVoucherBroker(); this.openVoucherBroker();
return; return;

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)')) <!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.9c0fcdbd.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.b0a1322e.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