周五固定更新
This commit is contained in:
@@ -37,21 +37,22 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="价格范围">
|
||||
<!-- <el-form-item label="价格范围">
|
||||
<el-input :value="product && product.priceRange" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
</el-form-item> -->
|
||||
<el-form-item label="类型">
|
||||
<el-input :value="product && (product.type === 1 ? '算力套餐' : '挖矿机器')" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-input :value="product && (product.state === 1 ? '下架' : '上架')" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="24">
|
||||
<el-form-item label="图片">
|
||||
@@ -64,7 +65,7 @@
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述">
|
||||
<el-input type="textarea" :rows="3" :value="product && product.description" disabled />
|
||||
<el-input type="textarea" :rows="3" :value="product && product.description" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -76,9 +77,9 @@
|
||||
<div slot="header" class="section-title">机器组合</div>
|
||||
<div v-if="machineList && machineList.length">
|
||||
<el-table :data="machineList" border stripe style="width: 100%">
|
||||
<el-table-column prop="user" label="挖矿账户" min-width="80" />
|
||||
<el-table-column prop="id" label="矿机ID" min-width="60" />
|
||||
<el-table-column prop="miner" label="机器编号" min-width="100" />
|
||||
<el-table-column prop="user" label="挖矿账户" />
|
||||
<el-table-column prop="id" label="矿机ID" />
|
||||
<el-table-column prop="miner" label="机器编号" />
|
||||
<el-table-column label="实际算力" width="100">
|
||||
<template slot="header">
|
||||
<el-tooltip content="实际算力为该机器在本矿池过去24H的平均算力" effect="dark" placement="top">
|
||||
@@ -100,11 +101,15 @@
|
||||
:class="{ 'changed-input': isCellChanged(scope.row, 'theoryPower') }"
|
||||
style="max-width: 260px;"
|
||||
>
|
||||
<template slot="append">{{ scope.row.unit || '' }}</template>
|
||||
<template slot="append">
|
||||
<el-select v-model="scope.row.unit" size="mini" :disabled="isRowDisabled(scope.row)" class="append-select append-select--unit" style="width: 90px;">
|
||||
<el-option v-for="u in unitOptions" :key="u" :label="u" :value="u" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="功耗(kw/h)" min-width="140">
|
||||
<el-table-column label="功耗(kw/h)" >
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.powerDissipation"
|
||||
@@ -116,16 +121,16 @@
|
||||
:class="{ 'changed-input': isCellChanged(scope.row, 'powerDissipation') }"
|
||||
style="max-width: 260px;"
|
||||
>
|
||||
<template slot="append">kw/h</template>
|
||||
<!-- <template slot="append">kw/h</template> -->
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号" min-width="140">
|
||||
<el-table-column label="型号" >
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.type"
|
||||
size="small"
|
||||
placeholder="矿机型号"
|
||||
|
||||
:maxlength="20"
|
||||
:disabled="isRowDisabled(scope.row)"
|
||||
@input="handleTypeCell(scope.$index)"
|
||||
@@ -134,7 +139,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价(USDT)" min-width="140">
|
||||
<el-table-column label="售价" width="188">
|
||||
<template slot="header">
|
||||
<el-tooltip effect="dark" placement="top">
|
||||
<div slot="content">
|
||||
@@ -145,11 +150,11 @@
|
||||
</div>
|
||||
<i class="el-icon-question label-help" aria-label="帮助" tabindex="0"></i>
|
||||
</el-tooltip>
|
||||
<span>售价(USDT)</span>
|
||||
<span>售价(按结算币种)</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.price"
|
||||
v-model="scope.row._priceEditing"
|
||||
size="small"
|
||||
inputmode="decimal"
|
||||
:disabled="isRowDisabled(scope.row)"
|
||||
@@ -158,11 +163,20 @@
|
||||
:class="{ 'changed-input': isCellChanged(scope.row, 'price') }"
|
||||
style="max-width: 260px;"
|
||||
>
|
||||
<template slot="append">USDT</template>
|
||||
<template slot="append">
|
||||
<el-select v-model="scope.row._selectedPayIndex" size="mini" @change="handlePayTypeChange(scope.$index)" class="append-select append-select--coin" style="width:120px;">
|
||||
<el-option
|
||||
v-for="(pt, i) in (scope.row.priceList || [])"
|
||||
:key="pt.payTypeId || i"
|
||||
:label="[String(pt.chain||'').toUpperCase(), String(pt.coin||'').toUpperCase()].filter(Boolean).join('-')"
|
||||
:value="i"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最大租赁天数(天)" min-width="140">
|
||||
<el-table-column label="最大租赁天数(天)" width="100">
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.maxLeaseDays"
|
||||
@@ -248,6 +262,8 @@ export default {
|
||||
// 可编辑字段快照(用于变更高亮)
|
||||
fieldSnapshot: {},
|
||||
updateLoading:false,
|
||||
// 算力单位选项(与新增出售机器页面保持一致)
|
||||
unitOptions: ['KH/S','MH/S','GH/S','TH/S','PH/S'],
|
||||
}
|
||||
},
|
||||
|
||||
@@ -269,6 +285,15 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
/** 结算币种切换时,更新当前编辑价格 */
|
||||
handlePayTypeChange(index) {
|
||||
const row = this.machineList && this.machineList[index]
|
||||
if (!row) return
|
||||
const sel = Number(row._selectedPayIndex || 0)
|
||||
const list = Array.isArray(row.priceList) ? row.priceList : []
|
||||
const target = list[sel] || {}
|
||||
this.$set(this.machineList, index, { ...row, _priceEditing: String(target.price ?? '') })
|
||||
},
|
||||
/**
|
||||
* 判断行是否不可编辑(已售出则禁用)
|
||||
* @param {Object} row - 当前行数据
|
||||
@@ -304,7 +329,13 @@ export default {
|
||||
|
||||
|
||||
if (res && res.code === 200) {
|
||||
this.machineList =res.rows
|
||||
const rows = Array.isArray(res.rows) ? res.rows : []
|
||||
this.machineList = rows.map(r => {
|
||||
const list = Array.isArray(r.priceList) ? r.priceList : []
|
||||
const sel = 0
|
||||
const first = list[sel] || {}
|
||||
return { ...r, _selectedPayIndex: sel, _priceEditing: String(first.price ?? '') }
|
||||
})
|
||||
this.refreshStateSnapshot()
|
||||
this.refreshFieldSnapshot()
|
||||
}
|
||||
@@ -338,11 +369,15 @@ export default {
|
||||
for (let i = 0; i < list.length; i += 1) {
|
||||
const row = list[i]
|
||||
if (!row || typeof row.id === 'undefined') continue
|
||||
const priceMap = {}
|
||||
if (Array.isArray(row.priceList)) {
|
||||
row.priceList.forEach(p => { if (p) priceMap[String(p.payTypeId ?? '')] = String(p.price ?? '') })
|
||||
}
|
||||
snapshot[row.id] = {
|
||||
theoryPower: String(row.theoryPower ?? ''),
|
||||
powerDissipation: String(row.powerDissipation ?? ''),
|
||||
type: String(row.type ?? ''),
|
||||
price: String(row.price ?? ''),
|
||||
priceMap,
|
||||
maxLeaseDays: String(row.maxLeaseDays ?? ''),
|
||||
}
|
||||
}
|
||||
@@ -358,6 +393,14 @@ export default {
|
||||
isCellChanged(row, key) {
|
||||
if (!row || typeof row.id === 'undefined') return false
|
||||
const snap = this.fieldSnapshot[row.id] || {}
|
||||
if (key === 'price') {
|
||||
const sel = Number(row._selectedPayIndex || 0)
|
||||
const pt = Array.isArray(row.priceList) && row.priceList[sel] ? row.priceList[sel] : null
|
||||
const pid = String(pt && pt.payTypeId ? pt.payTypeId : sel)
|
||||
const cur = String(pt && pt.price != null ? pt.price : '')
|
||||
const ori = String((snap.priceMap && snap.priceMap[pid]) || '')
|
||||
return cur !== ori
|
||||
}
|
||||
const current = String(row[key] ?? '')
|
||||
const original = String(snap[key] ?? '')
|
||||
return current !== original
|
||||
@@ -438,7 +481,7 @@ export default {
|
||||
// - 功耗:6 位整数 + 4 位小数
|
||||
// - 价格:12 位整数 + 2 位小数
|
||||
// - 其他:保持原逻辑(6 位小数)
|
||||
let v = String(this.machineList[index][key] ?? '')
|
||||
let v = String(key === 'price' ? (this.machineList[index]._priceEditing ?? '') : (this.machineList[index][key] ?? ''))
|
||||
v = v.replace(/[^0-9.]/g, '')
|
||||
const firstDot = v.indexOf('.')
|
||||
if (firstDot !== -1) {
|
||||
@@ -460,22 +503,35 @@ export default {
|
||||
if (intPart.length > 12) { intPart = intPart.slice(0, 12) }
|
||||
if (decPart) { decPart = decPart.slice(0, 2) }
|
||||
v = decPart.length ? `${intPart}.${decPart}` : (endsWithDot ? `${intPart}.` : intPart)
|
||||
// 同步到当前选中结算币种的价格
|
||||
this.$set(this.machineList[index], '_priceEditing', v)
|
||||
const row = this.machineList[index]
|
||||
const sel = Number(row._selectedPayIndex || 0)
|
||||
if (Array.isArray(row.priceList) && row.priceList[sel]) {
|
||||
this.$set(row.priceList[sel], 'price', v)
|
||||
}
|
||||
} else {
|
||||
if (firstDot !== -1) {
|
||||
const [i, d] = v.split('.')
|
||||
v = i + '.' + (d ? d.slice(0, 6) : '')
|
||||
}
|
||||
}
|
||||
const row = { ...this.machineList[index], [key]: v }
|
||||
this.$set(this.machineList, index, row)
|
||||
if (key !== 'price') {
|
||||
const row = { ...this.machineList[index], [key]: v }
|
||||
this.$set(this.machineList, index, row)
|
||||
}
|
||||
},
|
||||
handlePriceBlur(index) {
|
||||
const raw = String(this.machineList[index].price ?? '')
|
||||
const raw = String(this.machineList[index]._priceEditing ?? '')
|
||||
const pattern = /^\d{1,12}(\.\d{1,2})?$/
|
||||
if (!raw || Number(raw) <= 0 || !pattern.test(raw)) {
|
||||
this.$message.warning('单价必须大于0,整数最多12位,小数最多2位')
|
||||
const row = { ...this.machineList[index], price: '' }
|
||||
this.$set(this.machineList, index, row)
|
||||
this.$set(this.machineList[index], '_priceEditing', '')
|
||||
const row = this.machineList[index]
|
||||
const sel = Number(row._selectedPayIndex || 0)
|
||||
if (Array.isArray(row.priceList) && row.priceList[sel]) {
|
||||
this.$set(row.priceList[sel], 'price', '')
|
||||
}
|
||||
}
|
||||
},
|
||||
handleMaxLeaseDaysInput(index) {
|
||||
@@ -567,7 +623,7 @@ export default {
|
||||
const row = this.machineList[i]
|
||||
const rowLabel = row && (row.miner || row.id || i + 1)
|
||||
const theoryRaw = String(row.theoryPower ?? '')
|
||||
const priceRaw = String(row.price ?? '')
|
||||
const priceRaw = String(row._priceEditing ?? '')
|
||||
const typeRaw = String(row.type ?? '')
|
||||
const dissRaw = String(row.powerDissipation ?? '')
|
||||
const daysRaw = String(row.maxLeaseDays ?? '')
|
||||
@@ -598,7 +654,7 @@ export default {
|
||||
const payload = this.machineList.map(m => ({
|
||||
id: m.id,
|
||||
powerDissipation: Number(m.powerDissipation ?? 0),
|
||||
price: Number(m.price ?? 0),
|
||||
priceList: Array.isArray(m.priceList) ? m.priceList.map(p => ({ ...p, price: Number(p && p.price != null && p.price !== '' ? p.price : 0) })) : [],
|
||||
state: Number(m.state ?? 0),
|
||||
theoryPower: Number(m.theoryPower ?? 0),
|
||||
type: m.type || '',
|
||||
@@ -641,17 +697,51 @@ export default {
|
||||
.empty-text { color: #909399; text-align: center; padding: 12px 0; }
|
||||
|
||||
.label-help { margin-left: 4px; color: #909399; cursor: help; }
|
||||
|
||||
/* ::v-deep .el-form-item__content{
|
||||
margin-left: 52px !important;
|
||||
} */
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.el-input-group__append, .el-input-group__prepend{
|
||||
padding: 0 5px !important;
|
||||
}
|
||||
.account-product-detail .el-table .el-input,
|
||||
.account-product-detail .el-table .el-textarea{
|
||||
width: 94% !important; /* 仅限制表格内输入宽度,避免影响上面的基础信息区域 */
|
||||
}
|
||||
/* 基础信息表单保持满宽,确保“描述”与上方输入左侧对齐 */
|
||||
.account-product-detail .detail-form .el-input,
|
||||
.account-product-detail .detail-form .el-textarea{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* 让追加区裁剪内部元素,避免 el-select 下拉箭头溢出到单元格外 */
|
||||
.el-input-group__append,
|
||||
.el-input-group__prepend{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 追加在输入框右侧的下拉(单位/结算币种)细节优化 */
|
||||
.append-select .el-input__inner{
|
||||
/* 预留更多箭头空间,避免被右侧裁剪 */
|
||||
padding-right: 28px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.append-select .el-select__caret{
|
||||
right: 10px; /* 箭头往内侧移动,防止被裁切 */
|
||||
transform: scale(.85); /* 缩小箭头,保证完全显示 */
|
||||
}
|
||||
.append-select .el-input__icon{
|
||||
line-height: 30px; /* 垂直居中,避免上下被裁切 */
|
||||
}
|
||||
|
||||
/* 变化高亮:为输入框外层添加红色边框,视觉醒目但不改变布局 */
|
||||
.changed-input .el-input__inner,
|
||||
.changed-input input.el-input__inner {
|
||||
.changed-input input.el-input__inner,
|
||||
/* 带有 append 时,同步高亮右侧追加区的边框,保证整体连贯 */
|
||||
.changed-input .el-input-group__append {
|
||||
border-color: #f56c6c !important;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user