@@ -138,7 +162,7 @@ export default {
// },
// {
// createTime: '2024-01-15 14:30:25',
- // amount: 100,
+ // amount: 100.656578965,
// fromAddress: 'djdddksfhsfj',
// fromChain: 'tron',
// fromSymbol: 'USDT',
@@ -345,9 +369,16 @@ export default {
getPayStatusType(s) { return ({ 0: 'danger', 1: 'success', 2: 'warning', 3: 'danger' })[s] || 'info' },
getPayStatusText(s) { return ({ 0: '支付失败', 1: '支付成功', 2: '待校验', 3: '证书校验失败' })[s] || '未知' },
+ /**
+ * 将链名称标准化为大写简称
+ * @param {string} chain - 后端返回的链标识,如 tron/eth/ethereum/bsc/polygon
+ * @returns {string} 大写显示,如 TRON/ETH/BSC/POLYGON
+ */
formatChain(chain) {
- const map = { tron: 'Tron (TRC20)', ethereum: 'Ethereum (ERC20)', bsc: 'BSC (BEP20)', polygon: 'Polygon (MATIC)' }
- return map[chain] || chain
+ if (!chain) return ''
+ const key = String(chain).toLowerCase()
+ const map = { tron: 'TRON', trx: 'TRON', eth: 'ETH', ethereum: 'ETH', bsc: 'BSC', polygon: 'POLYGON', matic: 'POLYGON' }
+ return (map[key] || String(chain)).toUpperCase()
},
formatFullTime(time) { if (!time) return ''; try { return new Date(time).toLocaleString('zh-CN') } catch (e) { return String(time) } },
formatTime(time) { return this.formatFullTime(time) },
@@ -363,6 +394,27 @@ export default {
const padded = decPart.padEnd(d, '0')
return `${intPart}.${padded}`
},
+ /**
+ * 金额显示:保留最多6位小数,直接截断不四舍五入;不补尾随0;始终返回非负字符串
+ * @param {number|string} value
+ * @returns {string}
+ */
+ formatDec6(value) {
+ if (value === null || value === undefined || value === '') return '0'
+ let s = String(value)
+ // 展开科学计数法为普通小数,避免 1e-7 之类展示
+ if (/e/i.test(s)) {
+ const n = Number(value)
+ if (!Number.isFinite(n)) return '0'
+ s = n.toFixed(20).replace(/\.0+$/, '').replace(/(\.\d*?)0+$/, '$1')
+ }
+ const m = s.match(/^(-?)(\d+)(?:\.(\d+))?$/)
+ if (!m) return s
+ let intPart = m[2]
+ let decPart = m[3] || ''
+ if (decPart.length > 6) decPart = decPart.slice(0, 6)
+ return decPart ? `${intPart}.${decPart}` : intPart
+ },
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pagination.pageSize = val;
@@ -376,6 +428,33 @@ export default {
this.loadList();
},
+ /**
+ * 复制文本到剪贴板
+ * @param {string} text - 需要复制的内容
+ * @param {string} [label] - 语义标签,用于提示文案
+ */
+ async handleCopy(text, label = '内容') {
+ try {
+ const value = String(text || '')
+ if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
+ await navigator.clipboard.writeText(value)
+ } else {
+ const ta = document.createElement('textarea')
+ ta.value = value
+ ta.style.position = 'fixed'
+ ta.style.left = '-9999px'
+ document.body.appendChild(ta)
+ ta.focus()
+ ta.select()
+ document.execCommand('copy')
+ document.body.removeChild(ta)
+ }
+ this.$message.success(`${label}已复制`)
+ } catch (e) {
+ this.$message.error('复制失败,请手动选择复制')
+ }
+ },
+
/**
* Tab 名称转状态码
* @param {string} tabName - 'recharge' | 'withdraw' | 'consume'
@@ -434,6 +513,7 @@ export default {
.expand-item { display: grid; grid-template-columns: 80px 1fr; gap: 6px; align-items: center; }
.label { color: #666; font-size: 13px; text-align: right; }
.value { color: #333; font-size: 13px; text-align: left; }
+.value-row { display: inline-flex; align-items: center; gap: 6px; }
.mono { font-family: "Monaco", "Menlo", monospace; }
.mono-ellipsis { font-family: "Monaco", "Menlo", monospace; max-width: 480px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: #999; padding: 20px 0; }
diff --git a/power_leasing/src/views/account/index.vue b/power_leasing/src/views/account/index.vue
index 22990b6..319cb68 100644
--- a/power_leasing/src/views/account/index.vue
+++ b/power_leasing/src/views/account/index.vue
@@ -38,8 +38,7 @@
v-for="item in displayedLinks"
:key="item.to"
:to="item.to"
- class="side-link"
- active-class="active"
+ :class="['side-link', isActiveLink(item.to) ? 'active' : '']"
>{{ item.label }}
@@ -104,13 +103,16 @@ export default {
if (raw == null) return null
try { return JSON.parse(raw) } catch (e) { return raw }
}
- const val = getVal('userName') || getVal('userEmail') || ''
+ const val =getVal('leasEmail') || ''
this.userEmail = typeof val === 'string' ? val : String(val)
// 恢复上次选择的导航分组(如无则默认 seller)
const savedRole = getVal('accountActiveRole')
if (savedRole === 'buyer' || savedRole === 'seller') {
- this.activeRole = savedRole
+ this.activeRole = savedRole
+
}
+ // 根据当前路由自动匹配分组,确保左侧导航高亮正确
+ this.setActiveRoleByRoute()
},
methods: {
/**
@@ -122,8 +124,78 @@ export default {
if (role !== 'buyer' && role !== 'seller') return
this.activeRole = role
try { localStorage.setItem('accountActiveRole', JSON.stringify(role)) } catch (e) {}
+ // 切换分组后,立即跳转到该分组的第一个导航页面
+ try {
+ const firstPath = role === 'buyer'
+ ? (this.buyerLinks && this.buyerLinks[0] && this.buyerLinks[0].to)
+ : (this.sellerLinks && this.sellerLinks[0] && this.sellerLinks[0].to)
+ if (firstPath && this.$route && this.$route.path !== firstPath) {
+ this.$router.push(firstPath)
+ }
+ } catch (e) { /* noop */ }
},
+ /**
+ * 根据当前路由自动选择导航分组,保证进入“我的店铺”等卖家页面时左侧高亮正确
+ */
+ setActiveRoleByRoute() {
+ const path = (this.$route && this.$route.path) || ''
+ // 买家前缀优先匹配,确保“已购详情”等页面归属买家侧
+ const buyerPrefixes = [
+ '/account/wallet',
+ '/account/purchased',
+ '/account/purchased-detail',
+ '/account/orders',
+ '/account/funds-flow'
+ ]
+ const sellerPrefixes = [
+ '/account/shops',
+ '/account/shop-new',
+ '/account/product-new',
+ '/account/products',
+ '/account/product-detail',
+ '/account/product-machine-add',
+ '/account/seller-orders',
+ '/account/order-detail',
+ '/account/receipt-record',
+ '/account/shop-config'
+ ]
+ const shouldBuyer = buyerPrefixes.some(p => path.indexOf(p) === 0)
+ const shouldSeller = sellerPrefixes.some(p => path.indexOf(p) === 0)
+ const role = shouldBuyer ? 'buyer' : (shouldSeller ? 'seller' : this.activeRole)
+ if (this.activeRole !== role) {
+ this.activeRole = role
+ try { localStorage.setItem('accountActiveRole', JSON.stringify(role)) } catch (e) {}
+ }
+ },
+ /**
+ * 判断左侧导航项是否高亮
+ * - 普通路径完全匹配
+ * - “已售出订单”需同时匹配详情页 /account/order-detail/:id
+ */
+ isActiveLink(pathLike) {
+ const current = (this.$route && this.$route.path) || ''
+ if (!pathLike) return false
+ // 列表-详情联动高亮映射
+ const map = {
+ '/account/seller-orders': ['/account/seller-orders', '/account/order-detail'],
+ '/account/products': ['/account/products', '/account/product-detail'],
+ '/account/purchased': ['/account/purchased', '/account/purchased-detail']
+ }
+ const prefixes = map[pathLike]
+ if (Array.isArray(prefixes)) {
+ return prefixes.some(p => current.indexOf(p) === 0)
+ }
+ return current.indexOf(pathLike) === 0
+ }
},
+ watch: {
+ '$route.path': {
+ immediate: true,
+ handler() {
+ this.setActiveRoleByRoute()
+ }
+ }
+ }
};
@@ -172,6 +244,7 @@ export default {
display: flex;
gap: 8px;
margin-bottom: 8px;
+ margin-top: 18px;
}
.role-button {
appearance: none;
diff --git a/power_leasing/src/views/account/myShops.vue b/power_leasing/src/views/account/myShops.vue
index a8ff22b..fa49198 100644
--- a/power_leasing/src/views/account/myShops.vue
+++ b/power_leasing/src/views/account/myShops.vue
@@ -134,17 +134,17 @@
-
-
-
+
-
-
![]()
-
{{ item.label }}
-
-
+ />
-
-
- 虚拟币
- 稳定币
-
+
+
+ {{ c }}
+ 未选择
+
@@ -173,7 +175,7 @@
@@ -181,7 +183,7 @@
diff --git a/power_leasing/src/views/account/wallet.vue b/power_leasing/src/views/account/wallet.vue
index 5340e3e..2d45cc5 100644
--- a/power_leasing/src/views/account/wallet.vue
+++ b/power_leasing/src/views/account/wallet.vue
@@ -26,6 +26,14 @@