From 0b76ea601de159828c5513c8b41250500b4bbb11 Mon Sep 17 00:00:00 2001 From: claw_bot Date: Mon, 9 Mar 2026 10:40:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B4=A7=E5=B8=81?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E6=97=A0=E6=B3=95=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E9=97=AE=E9=A2=98=EF=BC=8C=E6=94=AF=E6=8C=81CNY/USD/H?= =?UTF-8?q?KD=E4=B8=89=E7=A7=8D=E8=B4=A7=E5=B8=81=E9=80=89=E6=8B=A9?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E8=82=A1=E7=A5=A8=E6=97=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A1=AB=E5=85=85=E5=AF=B9=E5=BA=94=E8=B4=A7=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/detail/detail.vue | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index c7a8cd6..a784270 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -200,10 +200,12 @@ 货币 - - {{ transactionForm.currency }} - - + + + {{ transactionForm.currency }} + + + @@ -264,13 +266,26 @@ const transactionForm = ref({ remark: '' }); +// 货币选择相关 +const currencyList = ref([ + { name: '人民币 CNY', code: 'CNY' }, + { name: '美元 USD', code: 'USD' }, + { name: '港币 HKD', code: 'HKD' } +]); +const currencyIndex = ref(0); + +const onCurrencyChange = (e) => { + currencyIndex.value = e.detail.value; + transactionForm.value.currency = currencyList.value[currencyIndex.value].code; +}; + // 股票搜索相关 const searchResults = ref([]); const searchTimer = ref(null); const searchStock = async (keyword) => { // 防抖 if (searchTimer.value) clearTimeout(searchTimer.value); - if (!keyword || keyword.length < 2) { + if (!keyword || keyword.length < 1) { searchResults.value = []; return; } @@ -289,7 +304,19 @@ const searchStock = async (keyword) => { }; const selectStock = (result) => { - transactionForm.value.stockCode = result.Ticker; + transactionForm.value.stockCode = result.ticker || result.Ticker; + // 自动填充对应货币 + if (result.priceCurrency) { + const currencyMap = { + 'CNY': 0, + 'USD': 1, + 'HKD': 2 + }; + if (currencyMap[result.priceCurrency] !== undefined) { + currencyIndex.value = currencyMap[result.priceCurrency]; + transactionForm.value.currency = result.priceCurrency; + } + } searchResults.value = []; };