From 868632400afafcc95273d2426886ce96ee45502e Mon Sep 17 00:00:00 2001 From: yaoqin <497681109@qq.com> Date: Fri, 21 Nov 2025 16:23:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- power_leasing/.env.staging | 2 +- power_leasing/src/views/account/myShops.vue | 78 ++- .../src/views/account/productMachineAdd.vue | 573 +++++++----------- power_leasing/src/views/account/shopNew.vue | 87 ++- 4 files changed, 366 insertions(+), 374 deletions(-) diff --git a/power_leasing/.env.staging b/power_leasing/.env.staging index aca330c..8ad7e3f 100644 --- a/power_leasing/.env.staging +++ b/power_leasing/.env.staging @@ -9,7 +9,7 @@ ENV = 'staging' # 测试环境 VUE_APP_BASE_API = 'http://10.168.2.220:8888' # VUE_APP_BASE_API = 'https://test.m2pool.com/api/' -VUE_APP_BASE_URL = 'https://test.m2pool.com/' +VUE_APP_BASE_URL = 'https://test.m2pool.com/' # 路由懒加载 diff --git a/power_leasing/src/views/account/myShops.vue b/power_leasing/src/views/account/myShops.vue index fa49198..59550b5 100644 --- a/power_leasing/src/views/account/myShops.vue +++ b/power_leasing/src/views/account/myShops.vue @@ -39,10 +39,9 @@
{{ shop.description || '这家店还没有描述~' }}
- +
+ 手续费率:{{ formatFeeRate(shop.feeRate) }} +
修改店铺 @@ -124,6 +123,14 @@
+
+ + +
取消 @@ -200,11 +207,12 @@ export default { name: '', image: '', description: '', + feeRate: '', del: true, state: 0 }, visibleEdit: false, - editForm: { id: '', name: '', image: '', description: '' }, + editForm: { id: '', name: '', image: '', description: '', feeRate: '' }, // 店铺配置列表 shopConfigs: [], visibleConfigEdit: false, @@ -259,6 +267,38 @@ export default { this.fetchMyShop() }, methods: { + /** + * 手续费率显示:最多6位小数,去除多余的0;空值显示为 '-' + */ + formatFeeRate(value) { + 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+$/, '') + }, + /** + * 修改弹窗 - 手续费输入:允许一个小数点,最多6位小数;允许尾随点 + */ + handleEditFeeRateInput(value) { + let v = String(value ?? this.editForm.feeRate ?? '') + v = v.replace(/[^0-9.]/g, '') + const firstDot = v.indexOf('.') + if (firstDot !== -1) { + v = v.slice(0, firstDot + 1) + v.slice(firstDot + 1).replace(/\./g, '') + } + const endsWithDot = v.endsWith('.') + const parts = v.split('.') + let intPart = parts[0] || '' + let decPart = parts[1] || '' + if (decPart.length > 6) decPart = decPart.slice(0, 6) + if (intPart && intPart !== '0') intPart = String(Number(intPart)) + if (endsWithDot && firstDot !== -1) { + this.editForm.feeRate = `${intPart || '0'}.` + return + } + this.editForm.feeRate = decPart ? `${intPart || '0'}.${decPart}` : (intPart || '') + }, // 简单的emoji检测:覆盖常见表情平面与符号范围 hasEmoji(str) { if (!str || typeof str !== 'string') return false @@ -291,6 +331,7 @@ export default { 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) } @@ -429,7 +470,8 @@ export default { id: res.data.id, name: res.data.name, image: res.data.image, - description: res.data.description + description: res.data.description, + feeRate: res.data.feeRate } @@ -439,7 +481,8 @@ export default { id: this.shop.id, name: this.shop.name, image: this.shop.image, - description: this.shop.description + description: this.shop.description, + feeRate: this.shop.feeRate } this.$message.warning(res && res.msg ? res.msg : '未获取到店铺详情') } @@ -449,7 +492,8 @@ export default { id: this.shop.id, name: this.shop.name, image: this.shop.image, - description: this.shop.description + description: this.shop.description, + feeRate: this.shop.feeRate } console.error('查询店铺详情失败:', error) @@ -492,7 +536,19 @@ export default { this.$message.warning('店铺描述不能超过300个字符') return } - + // 手续费比例:必填、0.01-0.1、最多6位小数 + const rateRaw = String(this.editForm.feeRate || '').trim() + if (!rateRaw) { + this.$message.warning('请填写店铺手续费比例(0.01 - 0.1,最多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位') + return + } + this.editForm.feeRate = rateNum.toString() const payload = { ...this.editForm } const res = await updateShop(payload) @@ -585,9 +641,9 @@ export default { }) return } - // 跳转到新增商品页面,并传递店铺ID + // 直接跳转到“添加出售机器”页面,并传递店铺ID(供后续扩展使用) this.$router.push({ - path: '/account/product-new', + path: '/account/product-machine-add', query: { shopId: this.shop.id } }) }, diff --git a/power_leasing/src/views/account/productMachineAdd.vue b/power_leasing/src/views/account/productMachineAdd.vue index 29dc9b3..986c89e 100644 --- a/power_leasing/src/views/account/productMachineAdd.vue +++ b/power_leasing/src/views/account/productMachineAdd.vue @@ -5,22 +5,41 @@

添加出售机器

- + /> --> - - + + + ASIC + GPU + - - + + + + + + + +
+ 输入多个用逗号隔开 +
@@ -65,19 +84,8 @@ - - - 统一售价 - -
- 卖家最终收款金额 = 机器售价 × 波动率
- 波动率规则:
- 1)0% - 5%(包含5%):波动率 = 1(按售价结算)
- 2)5%以上:波动率 = 实际算力 / 理论算力,且不会超过 1,即最终结算时不会超过机器售价 -
- -
-
+ + 统一售价
@@ -105,156 +113,20 @@ - - - - - - - - - + + + - - -
已选择机器
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
取消 确认添加 @@ -275,11 +147,31 @@ 确认上架已选择机器 + + +
+
+ 下载客户端 + 已启动客户端 +
+
+
注意事项:
+
    +
  1. 请直接下载客户端后并启动,客户端显示 GPU 信息后,启动完成点击“已启动客户端”按钮(若未完全启动点击按钮会创建失败)。
  2. +
  3. 涉及多台主机,每个主机都需要配置相同客户端。
  4. +
  5. 客户端身份信息和本网站身份信息一致。
  6. +
+
+
+ + 关闭 + +
@@ -1144,7 +1003,7 @@ export default { .notice-alert :deep(.el-alert__description) { text-align: left; } .label-help { margin-left: 4px; color: #909399; cursor: help; } .form-card { margin-bottom: 12px; } -.actions { text-align: right; } +.actions { text-align: left; } /* 统一左对齐,控件宽度 50% */ .product-machine-add :deep(.el-form-item__content) { diff --git a/power_leasing/src/views/account/shopNew.vue b/power_leasing/src/views/account/shopNew.vue index c049f8e..6248b4b 100644 --- a/power_leasing/src/views/account/shopNew.vue +++ b/power_leasing/src/views/account/shopNew.vue @@ -3,7 +3,7 @@

新增店铺

- +