From 172c94baad10ca37a294769053238610db8214a2 Mon Sep 17 00:00:00 2001 From: yaoqin <497681109@qq.com> Date: Fri, 30 Jan 2026 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E5=91=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- power_leasing/src/views/account/myShops.vue | 200 +++++++++++++++--- .../src/views/account/orderDetail.vue | 55 ++++- power_leasing/src/views/account/products.vue | 158 ++++++++++---- .../views/account/purchasedMachineDetail.vue | 10 +- .../src/views/account/receiptRecord.vue | 151 ++++++++----- power_leasing/src/views/account/shopNew.vue | 98 ++++++++- power_leasing/src/views/cart/index.vue | 1 + .../src/views/productDetail/index.js | 2 + .../src/views/productDetail/index.vue | 14 +- power_leasing/test.zip | Bin 2094360 -> 2100958 bytes power_leasing/test/css/app.4bdb375c.css | 1 + power_leasing/test/index.html | 2 +- power_leasing/test/js/app.bf293dd7.js | 2 + power_leasing/test/js/app.bf293dd7.js.map | 1 + 14 files changed, 541 insertions(+), 154 deletions(-) create mode 100644 power_leasing/test/css/app.4bdb375c.css create mode 100644 power_leasing/test/js/app.bf293dd7.js create mode 100644 power_leasing/test/js/app.bf293dd7.js.map diff --git a/power_leasing/src/views/account/myShops.vue b/power_leasing/src/views/account/myShops.vue index e4db544..4284ca6 100644 --- a/power_leasing/src/views/account/myShops.vue +++ b/power_leasing/src/views/account/myShops.vue @@ -45,6 +45,7 @@
{{ shop.description || '这家店还没有描述~' }}
手续费率:{{ formatFeeRate(shop.feeRate) }} + 网络手续费:{{ shopNetworkFeeText }}
修改店铺 @@ -218,9 +219,27 @@ + > + + +
+ +
+ +
+
+ 是否开启 + + + 网络手续费 + {{ editNetworkFeeText }} + +
+
专用网络会增加2%的手续费,建议无法直连矿池的用户开启
+
@@ -286,11 +305,13 @@ export default { image: '', description: '', feeRate: '', + networkFee: 0, + isOpen: false, del: true, state: 0 }, visibleEdit: false, - editForm: { id: '', name: '', image: '', description: '', feeRate: '', gCode: '' }, + editForm: { id: '', name: '', image: '', description: '', feeRate: '', gCode: '', isOpen: false, networkFee: 0 }, // 店铺配置列表 shopConfigs: [], visibleConfigEdit: false, @@ -335,6 +356,17 @@ export default { if (this.shop.state === 2) return 'info' return 'info' }, + shopNetworkFeeText() { + const fee = Number(this.shop.networkFee) + const feeValid = Number.isFinite(fee) && fee > 0 + const isOpen = this.normalizeIsOpen(this.shop.isOpen) + if (!isOpen) return '0' + const rate = feeValid ? fee : 0 + if (!rate) return '0' + const percent = rate * 100 + const fixed = percent.toFixed(6) + return `${fixed.replace(/\.?0+$/, '')}%` + }, hasShop() { return !!(this.shop && Number(this.shop.id) > 0) }, @@ -352,6 +384,9 @@ export default { const map = new Map((this.editCoinOptions || []).map(o => [String(o.value), String(o.label).toUpperCase()])) return (this.configForm.payCoins || []).map(v => map.get(String(v)) || String(v).toUpperCase()) }, + editNetworkFeeText() { + return this.editForm.isOpen ? '2%' : '0' + }, /* 提现弹窗标题:如 USDT提现 */ withdrawDialogTitle() { const sym = String((this.currentWithdrawRow && this.currentWithdrawRow.payCoin) || '').toUpperCase() || '' @@ -379,6 +414,34 @@ export default { this.fetchMyShop() }, methods: { + /** + * 专用网络状态解析(兼容 boolean/number/string) + */ + normalizeIsOpen(value) { + if (value === true || value === 1) return true + if (typeof value === 'string') { + const v = value.trim().toLowerCase() + return v === 'true' || v === '1' + } + return false + }, + /** + * 统一解析店铺数据结构(兼容 data/data.list/array/string) + */ + normalizeShopData(raw) { + let data = raw && raw.data != null ? raw.data : raw + if (Array.isArray(data)) return data[0] || {} + if (typeof data === 'string') { + try { + const parsed = JSON.parse(data) + if (Array.isArray(parsed)) return parsed[0] || {} + return parsed || {} + } catch (e) { + return {} + } + } + return data || {} + }, /** * 修改店铺:谷歌验证码输入(仅数字,最多6位) */ @@ -669,8 +732,9 @@ export default { if (value === null || value === undefined || value === '') return '-' const num = Number(value) if (!Number.isFinite(num)) return '-' - const fixed = num.toFixed(6) - return fixed.replace(/\.?0+$/, '') + const percent = num * 100 + const fixed = percent.toFixed(6) + return `${fixed.replace(/\.?0+$/, '')}%` }, /** * 修改弹窗 - 手续费输入:允许一个小数点,最多6位小数;允许尾随点 @@ -709,6 +773,9 @@ export default { name: '', image: '', description: '', + feeRate: '', + networkFee: 0, + isOpen: false, del: true, state: 0 } @@ -721,17 +788,23 @@ export default { const res = await getMyShop() // 预期格式:{"code":0,"data":{"del":true,"description":"","id":0,"image":"","name":"","state":0},"msg":""} if (res && (res.code === 0 || res.code === 200) && res.data) { + const shopData = this.normalizeShopData(res.data) + const feeRaw = Number(shopData.networkFee) + const feeValid = Number.isFinite(feeRaw) && feeRaw > 0 + const isOpen = this.normalizeIsOpen(shopData.isOpen) || feeValid this.shop = { - id: res.data.id, - name: res.data.name, - image: res.data.image, - description: res.data.description, - feeRate: res.data.feeRate, - del: !!res.data.del, - state: Number(res.data.state || 0) + id: shopData.id, + name: shopData.name, + image: shopData.image, + description: shopData.description, + feeRate: shopData.feeRate, + networkFee: feeValid ? feeRaw : 0, + isOpen, + del: !!shopData.del, + state: Number(shopData.state || 0) } // 同步加载钱包绑定 - this.fetchShopConfigs(res.data.id) + this.fetchShopConfigs(shopData.id) } else { // 当接口返回错误或没有数据时,重置店铺状态 this.resetShopState() @@ -940,38 +1013,54 @@ export default { this.visibleEdit = true // 查询最新店铺详情 const res = await queryShop({ id: this.shop.id }) - if (res && (res.code === 0 || res.code === 200) && res.data) { + if (res && (res.code === 0 || res.code === 200)) { + const shopData = this.normalizeShopData(res.data) + const feeRaw = Number(shopData.networkFee) + const feeValid = Number.isFinite(feeRaw) && feeRaw > 0 + const isOpen = this.normalizeIsOpen(shopData.isOpen) || feeValid + const feeRateNum = Number(shopData.feeRate) + const feeRatePercent = Number.isFinite(feeRateNum) ? (feeRateNum * 100) : '' this.editForm = { - id: res.data.id, - name: res.data.name, - image: res.data.image, - description: res.data.description, - feeRate: res.data.feeRate, - gCode: '' + id: shopData.id, + name: shopData.name, + image: shopData.image, + description: shopData.description, + feeRate: feeRatePercent === '' ? '' : String(feeRatePercent), + gCode: '', + isOpen, + networkFee: feeValid ? feeRaw : 0 } } else { // 回退到当前展示的数据 + const fallbackRateNum = Number(this.shop.feeRate) + const fallbackRatePercent = Number.isFinite(fallbackRateNum) ? (fallbackRateNum * 100) : '' this.editForm = { id: this.shop.id, name: this.shop.name, image: this.shop.image, description: this.shop.description, - feeRate: this.shop.feeRate, - gCode: '' + feeRate: fallbackRatePercent === '' ? '' : String(fallbackRatePercent), + gCode: '', + isOpen: false, + networkFee: 0 } this.$message.warning(res && res.msg ? res.msg : '未获取到店铺详情') } } catch (error) { // 出错时回退到当前展示的数据 + const fallbackRateNum = Number(this.shop.feeRate) + const fallbackRatePercent = Number.isFinite(fallbackRateNum) ? (fallbackRateNum * 100) : '' this.editForm = { id: this.shop.id, name: this.shop.name, image: this.shop.image, description: this.shop.description, - feeRate: this.shop.feeRate, - gCode: '' + feeRate: fallbackRatePercent === '' ? '' : String(fallbackRatePercent), + gCode: '', + isOpen: false, + networkFee: 0 } console.error('查询店铺详情失败:', error) @@ -1014,19 +1103,19 @@ export default { this.$message.warning('店铺描述不能超过300个字符') return } - // 手续费比例:必填、0.01-0.1、最多6位小数 + // 手续费比例:必填、1-10(百分比)且最多6位小数 const rateRaw = String(this.editForm.feeRate || '').trim() if (!rateRaw) { - this.$message.warning('请填写店铺手续费比例(0.01 - 0.1,最多6位小数)') + this.$message.warning('请填写店铺手续费比例(1 - 10,最多6位小数)') return } const rateNum = Number(rateRaw) const decOk = rateRaw.includes('.') ? ((rateRaw.split('.')[1] || '').length <= 6) : true - if (!Number.isFinite(rateNum) || rateNum < 0.01 || rateNum > 0.1 || !decOk) { - this.$message.warning('手续费比例需在 0.01 - 0.1 之间,且小数位不超过6位') + if (!Number.isFinite(rateNum) || rateNum < 1 || rateNum > 10 || !decOk) { + this.$message.warning('手续费比例需在 1 - 10 之间,且小数位不超过6位') return } - this.editForm.feeRate = rateNum.toString() + this.editForm.feeRate = (rateNum / 100).toString() // 谷歌验证码:必填 6 位数字 const gCode = String(this.editForm.gCode || '').trim() @@ -1035,6 +1124,8 @@ export default { return } + const feeRaw = Number(this.editForm.networkFee) + this.editForm.networkFee = this.editForm.isOpen ? (Number.isFinite(feeRaw) && feeRaw > 0 ? feeRaw : 0.02) : 0 const payload = { ...this.editForm, gCode } const res = await updateShop(payload) if (res && (res.code === 0 || res.code === 200)) { @@ -1203,6 +1294,57 @@ export default { /* 余额数字红色显示 */ .balance-num { color: #ff4d4f; font-weight: 600; } .balance-unit { color: #606266; } +.fee-rate-input { + max-width: 220px; +} +.edit-network { + display: flex; + flex-direction: column; + gap: 6px; + padding: 8px 10px; + border-radius: 8px; + background: #f7f9fc; + border: 1px solid #eef2f7; + align-items: flex-start; +} +.edit-network-line { + display: inline-flex; + align-items: center; + gap: 12px; + flex-wrap: wrap; +} +.edit-network-label { + color: #606266; + font-size: 13px; +} +.edit-network-fee { + display: inline-flex; + align-items: center; + gap: 6px; + color: #606266; + font-size: 13px; +} +.edit-fee-value { + display: inline-block; + min-width: 40px; + text-align: center; + padding: 2px 8px; + border-radius: 10px; + background: #eef2f7; + color: #606266; + font-weight: 600; +} +.edit-fee-value.on { + background: #fff7ed; + color: #c2410c; + border: 1px solid #fed7aa; +} +.edit-network-hint { + color: #909399; + font-size: 12px; + line-height: 1.4; + text-align: left; +} diff --git a/power_leasing/src/views/account/products.vue b/power_leasing/src/views/account/products.vue index 9c11852..bcd8cdd 100644 --- a/power_leasing/src/views/account/products.vue +++ b/power_leasing/src/views/account/products.vue @@ -6,17 +6,6 @@

商品列表

- - - -
- -
- 筛选售价: - - - +
+
+ - - - {{ formatPayTypeHead(pt) }} - - - + ASIC + + + GPU + +
+
+ 筛选售价: + + + + + + {{ formatPayTypeHead(pt) }} + + + +
@@ -158,7 +166,12 @@ @@ -197,6 +210,7 @@ :active-value="0" :inactive-value="1" :value="(updateMap[getRowId(scope.row)] && updateMap[getRowId(scope.row)].state) != null ? updateMap[getRowId(scope.row)].state : 1" + :disabled="Number(scope.row.saleState) === 1" @change="handleToggleState(scope.row, $event)" /> @@ -244,7 +259,13 @@ @@ -1589,6 +1610,16 @@ export default { display: flex; align-items: center; } +.price-select-bar.inline { + display: inline-flex; + align-items: center; + margin-right: 12px; +} +.price-select-bar.inline .price-label { + margin-right: 8px; + color: #606266; + font-size: 14px; +} .paytypes-bar { display: flex; align-items: center; @@ -1623,6 +1654,39 @@ export default { margin-top: 12px; } +.list-actions-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16px; + margin: 6px 0 10px; +} + +.machine-type-switch { + display: flex; + align-items: center; + gap: 8px; +} +.machine-type-switch .el-button { + border-radius: 18px; + padding: 6px 18px; + font-weight: 600; + color: #6b7280; + background: #f3f4f6; + border-color: #e5e7eb; +} +.machine-type-switch .el-button.active { + color: #fff; + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + border-color: transparent; + box-shadow: 0 6px 12px rgba(118, 75, 162, 0.2); +} +.machine-type-switch .el-button:not(.active):hover { + color: #374151; + background: #e5e7eb; + border-color: #d1d5db; +} + /* 编辑弹窗内:让下拉/单选与输入框左边缘对齐 */ .edit-form .align-like-input .el-form-item__content { padding-left: 12px; /* 对齐到上方 el-input 的内边距视觉效果 */ diff --git a/power_leasing/src/views/account/purchasedMachineDetail.vue b/power_leasing/src/views/account/purchasedMachineDetail.vue index 34b8021..63e355c 100644 --- a/power_leasing/src/views/account/purchasedMachineDetail.vue +++ b/power_leasing/src/views/account/purchasedMachineDetail.vue @@ -101,7 +101,7 @@ @@ -218,6 +218,14 @@ export default { return String(value) } }, + /** + * 实时算力展示:拼接单位(unit 有则显示) + */ + formatPowerWithUnit(power, unit) { + if (power === null || power === undefined || power === '') return '—' + const u = unit != null ? String(unit).trim() : '' + return u ? `${power} ${u}` : String(power) + }, /** * 复制文本到剪贴板 * @param {string} text - 需要复制的内容 diff --git a/power_leasing/src/views/account/receiptRecord.vue b/power_leasing/src/views/account/receiptRecord.vue index 8531bcd..1c5f087 100644 --- a/power_leasing/src/views/account/receiptRecord.vue +++ b/power_leasing/src/views/account/receiptRecord.vue @@ -38,7 +38,7 @@ border stripe size="small" - style="width: 100%; table-layout: auto;" + style="width: 100%; table-layout: fixed;" :row-key="getRowKey" :expand-row-keys="expandedRowKeys" :row-class-name="getRowClassName" @@ -51,24 +51,33 @@