矿机租赁项目 用户选择支付 平台换算浮动价格版本

This commit is contained in:
2025-11-04 14:52:19 +08:00
parent a2fc94b402
commit ccf22ff707
12 changed files with 70 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ import './utils/loginInfo.js';
// 全局输入防表情守卫(极简、无侵入) // 全局输入防表情守卫(极简、无侵入)
import { initNoEmojiGuard } from './utils/noEmojiGuard.js'; import { initNoEmojiGuard } from './utils/noEmojiGuard.js';
console.log = ()=>{} //全局关闭打印 // console.log = ()=>{} //全局关闭打印
Vue.config.productionTip = false Vue.config.productionTip = false

View File

@@ -204,7 +204,16 @@ export default {
}); });
return return
} }
try { this.$router.push(`/account/order-detail/${id}`) } catch (e) { try {
const curPath = (this.$route && this.$route.path) || ''
const from = curPath.indexOf('/account/orders') === 0 ? 'buyer' : (curPath.indexOf('/account/seller-orders') === 0 ? 'seller' : '')
try { if (from) sessionStorage.setItem('orderDetailFrom', from) } catch (e) {}
if (from) {
this.$router.push({ path: `/account/order-detail/${id}`, query: { from } })
} else {
this.$router.push(`/account/order-detail/${id}`)
}
} catch (e) {
this.$message({ this.$message({
message: '无法跳转到详情页', message: '无法跳转到详情页',
type: 'error', type: 'error',

View File

@@ -139,6 +139,20 @@ export default {
*/ */
setActiveRoleByRoute() { setActiveRoleByRoute() {
const path = (this.$route && this.$route.path) || '' const path = (this.$route && this.$route.path) || ''
// 详情页:根据来源 from=buyer/seller 判定(优先 query其次 sessionStorage
if (path.indexOf('/account/order-detail') === 0) {
const qFrom = (this.$route && this.$route.query && this.$route.query.from) || ''
let from = qFrom
if (!from) {
try { from = sessionStorage.getItem('orderDetailFrom') || '' } catch (e) { from = '' }
}
const role = from === 'buyer' ? 'buyer' : (from === 'seller' ? 'seller' : this.activeRole)
if (this.activeRole !== role) {
this.activeRole = role
try { localStorage.setItem('accountActiveRole', JSON.stringify(role)) } catch (e) {}
}
return
}
// 买家前缀优先匹配,确保“已购详情”等页面归属买家侧 // 买家前缀优先匹配,确保“已购详情”等页面归属买家侧
const buyerPrefixes = [ const buyerPrefixes = [
'/account/wallet', '/account/wallet',
@@ -155,7 +169,6 @@ export default {
'/account/product-detail', '/account/product-detail',
'/account/product-machine-add', '/account/product-machine-add',
'/account/seller-orders', '/account/seller-orders',
'/account/order-detail',
'/account/receipt-record', '/account/receipt-record',
'/account/shop-config' '/account/shop-config'
] ]
@@ -175,9 +188,21 @@ export default {
isActiveLink(pathLike) { isActiveLink(pathLike) {
const current = (this.$route && this.$route.path) || '' const current = (this.$route && this.$route.path) || ''
if (!pathLike) return false if (!pathLike) return false
// 详情页:根据来源决定高亮哪个分组的列表
if (current.indexOf('/account/order-detail') === 0) {
const qFrom = (this.$route && this.$route.query && this.$route.query.from) || ''
let from = qFrom
if (!from) {
try { from = sessionStorage.getItem('orderDetailFrom') || '' } catch (e) { from = '' }
}
if (from === 'buyer' && pathLike === '/account/orders') return true
if (from === 'seller' && pathLike === '/account/seller-orders') return true
// 兜底:不匹配
return false
}
// 列表-详情联动高亮映射 // 列表-详情联动高亮映射
const map = { const map = {
'/account/seller-orders': ['/account/seller-orders', '/account/order-detail'], '/account/seller-orders': ['/account/seller-orders'],
'/account/products': ['/account/products', '/account/product-detail'], '/account/products': ['/account/products', '/account/product-detail'],
'/account/purchased': ['/account/purchased', '/account/purchased-detail'] '/account/purchased': ['/account/purchased', '/account/purchased-detail']
} }

View File

@@ -650,12 +650,17 @@ export default {
const first = data[0] || {} const first = data[0] || {}
this.walletBalance = first.walletBalance || first.balance || 0 this.walletBalance = first.walletBalance || first.balance || 0
this.blockedBalance = first.blockedBalance || 0 this.blockedBalance = first.blockedBalance || 0
this.WalletData = first // 充值弹窗打开期间,避免覆盖正在展示的 WalletData会导致“充值币种”显示错误
if (!this.rechargeDialogVisible) {
this.WalletData = first
}
} else if (data && typeof data === 'object') { } else if (data && typeof data === 'object') {
this.walletList = [data] this.walletList = [data]
this.walletBalance = data.walletBalance || data.balance || 0 this.walletBalance = data.walletBalance || data.balance || 0
this.blockedBalance = data.blockedBalance || 0 this.blockedBalance = data.blockedBalance || 0
this.WalletData = data if (!this.rechargeDialogVisible) {
this.WalletData = data
}
} else { } else {
this.walletList = [] this.walletList = []
this.walletBalance = 0 this.walletBalance = 0
@@ -926,6 +931,8 @@ export default {
*/ */
resetRechargeForm() { resetRechargeForm() {
this.qrCodeGenerated = false this.qrCodeGenerated = false
// 关闭后刷新一次,恢复 WalletData 与列表一致
this.fetchWalletInfo()
}, },
/** /**
@@ -965,10 +972,11 @@ export default {
const feeInt = this.toScaledInt(this.withdrawForm.fee) const feeInt = this.toScaledInt(this.withdrawForm.fee)
const totalRequired = amountInt + feeInt const totalRequired = amountInt + feeInt
// 钱包余额转分 // 钱包余额转分(使用当前选中钱包的可用余额)
const balanceInt = this.toScaledInt(this.walletBalance) const availableBalance = this.WalletData && (this.WalletData.walletBalance || this.WalletData.balance) || 0
const balanceInt = this.toScaledInt(availableBalance)
if (totalRequired > balanceInt) { if (totalRequired > balanceInt) {
const totalText = this.scaledIntToString(totalRequired) const totalText = this.formatDec6FromInt(totalRequired)
callback(new Error(`提现金额加上手续费(${totalText} USDT)不能超过钱包余额`)) callback(new Error(`提现金额加上手续费(${totalText} USDT)不能超过钱包余额`))
return return
} }

View File

@@ -1017,11 +1017,21 @@ export default {
const items = [] const items = []
list.forEach(m => { list.forEach(m => {
if (selectedIds.has(m.id) && this.isOnShelf(m)) { if (selectedIds.has(m.id) && this.isOnShelf(m)) {
// 单价同币种显示若非USDT按实时价换算 // 单价同币种显示若非USDT按实时价换算 用现在的价格除以后端返回的this.selectedPrice
const baseUnit = Number(m.price || 0) const baseUnit = Number(m.price || 0)
const leaseDays = Math.max(1, Math.floor(Number(m.leaseTime || 1))) const leaseDays = Math.max(1, Math.floor(Number(m.leaseTime || 1)))
const isUSDT = String(this.selectedCoin).toUpperCase() === 'USDT' const isUSDT = String(this.selectedCoin).toUpperCase() === 'USDT'
console.log('baseUnit', baseUnit)
console.log('selectedPrice', this.selectedPrice)
const unitPrice = !isUSDT && this.selectedPrice > 0 ? (baseUnit / this.selectedPrice) : baseUnit const unitPrice = !isUSDT && this.selectedPrice > 0 ? (baseUnit / this.selectedPrice) : baseUnit
console.log('baseUnit / this.selectedPrice', baseUnit / this.selectedPrice);
console.log('unitPrice', unitPrice ,'leaseDays', leaseDays)
console.log(`unitPrice * leaseDays`,unitPrice * leaseDays);
console.log(unitPrice*this.selectedPrice,"客服付款");
const subtotal = unitPrice * leaseDays const subtotal = unitPrice * leaseDays
items.push({ items.push({
product: shop.name || '', product: shop.name || '',

View File

@@ -135,7 +135,9 @@
<el-dialog :visible.sync="confirmAddDialog.visible" width="80vw" :title="`确认加入购物车(共 ${confirmAddDialog.items.length} 台)`"> <el-dialog :visible.sync="confirmAddDialog.visible" width="80vw" :title="`确认加入购物车(共 ${confirmAddDialog.items.length} 台)`">
<div> <div>
<el-table :data="confirmAddDialog.items" height="360" border stripe :header-cell-style="{ textAlign: 'left' }" :cell-style="{ textAlign: 'left' }"> <el-table :data="confirmAddDialog.items" height="360" border stripe :header-cell-style="{ textAlign: 'left' }" :cell-style="{ textAlign: 'left' }">
<el-table-column prop="theoryPower" label="理论算力" header-align="left" align="left" /> <el-table-column prop="theoryPower" label="理论算力" header-align="left" align="left">
<template #default="scope">{{ scope.row.theoryPower }} {{ scope.row.unit }}</template>
</el-table-column>
<el-table-column label="实际算力" header-align="left" align="left"> <el-table-column label="实际算力" header-align="left" align="left">
<template #default="scope">{{ scope.row.computingPower }} {{ scope.row.unit }}</template> <template #default="scope">{{ scope.row.computingPower }} {{ scope.row.unit }}</template>
</el-table-column> </el-table-column>

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>power_leasing</title><script defer="defer" src="/js/chunk-vendors.f4da7ffe.js"></script><script defer="defer" src="/js/app.7b715e42.js"></script><link href="/css/chunk-vendors.10dd4e95.css" rel="stylesheet"><link href="/css/app.9d232bce.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but power_leasing doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> <!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>power_leasing</title><script defer="defer" src="/js/chunk-vendors.f4da7ffe.js"></script><script defer="defer" src="/js/app.c7605e06.js"></script><link href="/css/chunk-vendors.10dd4e95.css" rel="stylesheet"><link href="/css/app.4475c0cd.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but power_leasing doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long