From 97f2442581c7f1b65ddf471206b9ad9b2ed2ab83 Mon Sep 17 00:00:00 2001 From: claw_bot Date: Tue, 10 Mar 2026 02:33:35 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=96=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E7=82=B9=E5=87=BB=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=B1=95=E7=A4=BA=E5=B7=B2=E6=9C=89=E6=8C=81?= =?UTF-8?q?=E4=BB=93=E5=88=97=E8=A1=A8=E4=BE=9B=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/detail/detail.vue | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index a5601e7..67f03fc 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -159,14 +159,14 @@ - 股票代码 + {{ transactionType === 'sell' ? '选择持仓' : '股票代码' }} - + - {{ result.ticker }} + {{ result.ticker || result.stockCode }} + {{ result.name || result.stockName }} {{ result.assetType }} - {{ result.exchange }} + {{ result.exchange || '' }} @@ -334,17 +335,18 @@ const searchStock = async (keyword) => { }; const selectStock = (result) => { - transactionForm.value.stockCode = result.ticker || result.Ticker; + transactionForm.value.stockCode = result.ticker || result.Ticker || result.stockCode; // 自动填充对应货币 - if (result.priceCurrency) { + const currency = result.priceCurrency || result.currency; + if (currency) { const currencyMap = { 'CNY': 0, 'USD': 1, 'HKD': 2 }; - if (currencyMap[result.priceCurrency] !== undefined) { - currencyIndex.value = currencyMap[result.priceCurrency]; - transactionForm.value.currency = result.priceCurrency; + if (currencyMap[currency] !== undefined) { + currencyIndex.value = currencyMap[currency]; + transactionForm.value.currency = currency; } } searchResults.value = []; @@ -413,6 +415,14 @@ const handleBuy = () => { const handleSell = () => { transactionType.value = 'sell'; resetTransactionForm(); + // 卖出时自动填充持仓列表作为可选 + searchResults.value = positions.value.map(pos => ({ + ticker: pos.stockCode, + name: pos.stockName, + assetType: pos.assetType || 'Stock', + priceCurrency: pos.currency, + exchange: '' + })); showTransactionForm.value = true; }; @@ -425,6 +435,8 @@ const resetTransactionForm = () => { transactionDate: getCurrentDate(), remark: '' }; + // 重置搜索结果 + searchResults.value = []; }; const submitTransaction = async () => {