diff --git a/power_leasing/src/views/account/receiptRecord.vue b/power_leasing/src/views/account/receiptRecord.vue index 7305949..125279c 100644 --- a/power_leasing/src/views/account/receiptRecord.vue +++ b/power_leasing/src/views/account/receiptRecord.vue @@ -326,7 +326,7 @@ export default { .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; padding: 8px 4px; } .detail-item { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; } .detail-item-full { grid-column: 1 / -1; } -.detail-label { color: #666; font-size: 13px; text-align: right; } +.detail-label { color: #666; font-size: 13px; text-align: left; } .detail-value { color: #333; font-size: 13px; text-align: left; } .detail-value.address { font-family: "Monaco", "Menlo", monospace; word-break: break-all; } diff --git a/power_leasing/src/views/cart/index.vue b/power_leasing/src/views/cart/index.vue index 6efda86..044bf4b 100644 --- a/power_leasing/src/views/cart/index.vue +++ b/power_leasing/src/views/cart/index.vue @@ -216,6 +216,22 @@ 店铺:{{ grp.shopName || grp.shopId }} 支付方式:{{ grp.payLabel }} +
+ +
@@ -609,22 +625,16 @@ export default { getAllGroups() { return [] }, // 生成店铺的支付方式选项,基于 totalPriceList getShopPayOptions(shop) { - const list = Array.isArray(shop && shop.totalPriceList) ? shop.totalPriceList : [] - // 优先使用 payConfigList 提供的 icon,以链+币种去匹配 - const icons = new Map() + // 下拉渲染严格以 payConfigList 为准(接口定义的可选支付方式) const cfg = Array.isArray(shop && shop.payConfigList) ? shop.payConfigList : [] - cfg.forEach(c => { - const key = `${c.payChain || ''}|${c.payCoin || ''}` - icons.set(key, c.payCoinImage || '') - }) - return list.map(it => { - const chain = (it && it.chain) || '' - const coin = (it && it.coin) || '' + return cfg.map(c => { + const chain = c && c.payChain ? String(c.payChain) : '' + const coin = c && c.payCoin ? String(c.payCoin) : '' const key = `${chain}|${coin}` return { label: `${chain} - ${this.toUpperText(coin)}`, value: key, - icon: icons.get(key) || '' + icon: c && c.payCoinImage ? c.payCoinImage : '' } }) }, @@ -1317,12 +1327,24 @@ export default { const [chain, coin] = String(key).split('|') const coinSymbol = this.toUpperText(coin || '') const payLabel = `${chain} - ${coinSymbol}` + // 当前支付方式配置(起付额/手续费) + const cfgList = Array.isArray(shop && shop.payConfigList) ? shop.payConfigList : [] + const cfgHit = cfgList.find(c => String(c && c.payChain).toUpperCase() === String(chain).toUpperCase() + && String(c && c.payCoin).toUpperCase() === String(coin).toUpperCase()) + const deductibleAmount = Number((cfgHit && cfgHit.deductibleAmount) || 0) + const fee = Number((cfgHit && cfgHit.fee) || 0) + const groupSubtotal = items.reduce((sum, it) => sum + Number(it.subtotal || 0), 0) + const enough = groupSubtotal >= deductibleAmount || deductibleAmount <= 0 const grp = { shopId: shop.id, shopName: shop.name || '', coinSymbol, payLabel, - items + items, + deductibleAmount, + fee, + enough, + groupSubtotal } this.confirmDialog.shops = [grp] this.confirmDialog.count = items.length @@ -1330,7 +1352,9 @@ export default { const totals = {} const centsAdd = (acc, v) => (acc + this.toCents(v)) if (coinSymbol) { - const tCents = items.reduce((acc, it) => centsAdd(acc, it.subtotal || 0), 0) + let tCents = items.reduce((acc, it) => centsAdd(acc, it.subtotal || 0), 0) + // 若未满足起付额,合计中加入手续费 + if (!enough && fee > 0) tCents = tCents + this.toCents(fee) totals[coinSymbol] = Number(this.centsToText(tCents)) } this.confirmDialog.totalsByCoin = totals @@ -1350,8 +1374,14 @@ export default { const [chain, coin] = String(key).split('|') const coinSymbol = this.toUpperText(coin || '') const payLabel = `${chain} - ${coinSymbol}` + const cfgList = Array.isArray(shop && shop.payConfigList) ? shop.payConfigList : [] + const cfgHit = cfgList.find(c => String(c && c.payChain).toUpperCase() === String(chain).toUpperCase() + && String(c && c.payCoin).toUpperCase() === String(coin).toUpperCase()) + const deductibleAmount = Number((cfgHit && cfgHit.deductibleAmount) || 0) + const fee = Number((cfgHit && cfgHit.fee) || 0) const rows = [] const list = Array.isArray(shop.productMachineDtoList) ? shop.productMachineDtoList : [] + let groupSubtotal = 0 list.forEach(m => { if (!set.has(m.id) || !this.isOnShelf(m)) return const baseUnit = this.getMachineUnitPriceBySelection(shop, m) @@ -1368,17 +1398,28 @@ export default { leaseTime: leaseDays, subtotal }) + groupSubtotal += subtotal const prev = totalsCentsByCoin.get(coinSymbol) || 0 totalsCentsByCoin.set(coinSymbol, prev + this.toCents(subtotal)) count += 1 }) if (rows.length) { + const enough = groupSubtotal >= deductibleAmount || deductibleAmount <= 0 + // 未满足起付额:总额加上手续费 + if (!enough && fee > 0) { + const prev = totalsCentsByCoin.get(coinSymbol) || 0 + totalsCentsByCoin.set(coinSymbol, prev + this.toCents(fee)) + } groups.push({ shopId: shop.id, shopName: shop.name || '', coinSymbol, payLabel, - items: rows + items: rows, + deductibleAmount, + fee, + enough, + groupSubtotal }) } }) diff --git a/power_leasing/src/views/productDetail/index.js b/power_leasing/src/views/productDetail/index.js index dca62f7..792ec6c 100644 --- a/power_leasing/src/views/productDetail/index.js +++ b/power_leasing/src/views/productDetail/index.js @@ -27,8 +27,11 @@ export default { minPower: null, maxPower: null, minPowerDissipation: null, - maxPowerDissipation: null + maxPowerDissipation: null, + unit: 'GH/S' }, + // 实际算力单位选项 + powerUnitOptions: ['KH/S', 'MH/S', 'GH/S', 'TH/S', 'PH/S'], // 排序状态:true 升序,false 降序 sortStates: { priceSort: true, @@ -228,6 +231,7 @@ export default { // 支付方式条件:有值才传 if (this.filters.chain && String(this.filters.chain).trim()) q.chain = String(this.filters.chain).trim() if (this.filters.coin && String(this.filters.coin).trim()) q.coin = String(this.filters.coin).trim() + if (this.filters.unit && String(this.filters.unit).trim()) q.unit = String(this.filters.unit).trim() addNum(this.filters, 'minPrice', 'minPrice') addNum(this.filters, 'maxPrice', 'maxPrice') addNum(this.filters, 'minPower', 'minPower') diff --git a/power_leasing/src/views/productDetail/index.vue b/power_leasing/src/views/productDetail/index.vue index 12cc4fa..9d48d53 100644 --- a/power_leasing/src/views/productDetail/index.vue +++ b/power_leasing/src/views/productDetail/index.vue @@ -87,6 +87,9 @@ - + + + @@ -375,7 +378,8 @@ export default { minPower: null, maxPower: null, minPowerDissipation: null, - maxPowerDissipation: null + maxPowerDissipation: null, + unit: 'GH/S' } this.handleSearchFilters() },