fix(client): show chargeable quantity in quote summary
This commit is contained in:
@@ -15,7 +15,11 @@ const hasInput = computed(() => Boolean(originWarehouseId.value && destinationWa
|
||||
const quoteCards = computed(() => quotes.value.map((quote) => ({ quote, channel: channels.value.find((item) => item.channelCode === quote.channelCode) })).filter((item): item is { quote: MerchantPriceEstimate; channel: MerchantPricingChannel } => Boolean(item.channel)).sort((a, b) => a.quote.estimatedAmount - b.quote.estimatedAmount).slice(0, 4))
|
||||
const priceWinner = computed(() => quoteCards.value.reduce((winner, item) => !winner || item.quote.estimatedAmount < winner.quote.estimatedAmount ? item : winner, undefined as (typeof quoteCards.value)[number] | undefined))
|
||||
const timeWinner = computed(() => quoteCards.value.reduce((winner, item) => { const days = transitDays(item.channel.referenceTransit); if (days === null) return winner; return !winner || days < transitDays(winner.channel.referenceTransit)! ? item : winner }, undefined as (typeof quoteCards.value)[number] | undefined))
|
||||
const resultSummary = computed(() => `${volume.value || 0} CBM · ${destinationCode.value || '—'} · 匹配 ${quoteCards.value.length} 个渠道`)
|
||||
const resultSummary = computed(() => {
|
||||
const quoteUnit = (volume.value || 0) >= (weight.value || 0) / 167 ? 'CBM' : 'KG'
|
||||
const quoteQuantity = quoteUnit === 'CBM' ? volume.value : weight.value
|
||||
return `${quoteQuantity || 0} ${quoteUnit} · ${destinationCode.value || '—'} · 匹配 ${quoteCards.value.length} 个渠道`
|
||||
})
|
||||
function transitDays(value: string | null) { const match = value?.match(/\d+/); return match ? Number(match[0]) : null }
|
||||
function formatMoney(item: MerchantPriceEstimate) { const currency = item.currency === 'CNY' ? '¥' : `${item.currency} `; return `${currency}${item.estimatedAmount.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` }
|
||||
function formatUnitPrice(item: MerchantPriceEstimate) { const currency = item.currency === 'CNY' ? '¥' : `${item.currency} `; return `${currency}${item.unitPrice.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}/${item.chargeUnit || 'CBM'}` }
|
||||
|
||||
Reference in New Issue
Block a user