diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 60339f7..9e8f422 100755 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -197,13 +197,12 @@ {{ transactionType === 'sell' ? '选择持仓' : '股票代码' }} - @@ -351,7 +350,6 @@ const searchTimer = ref(null); const handleStockInputClick = () => { if (transactionType.value === 'sell') { - // 卖出时显示当前持仓列表 searchResults.value = positions.value.map(pos => ({ ticker: pos.stockCode, stockCode: pos.stockCode, @@ -365,8 +363,14 @@ const handleStockInputClick = () => { } }; +const onStockInput = (e) => { + const keyword = e.detail.value; + console.log('🔍 股票输入:', keyword); + searchStock(keyword); +}; + const searchStock = async (keyword) => { - // 防抖 + console.log('🔍 searchStock 调用:', keyword); if (searchTimer.value) clearTimeout(searchTimer.value); if (!keyword || keyword.length < 1) { searchResults.value = []; @@ -375,7 +379,9 @@ const searchStock = async (keyword) => { searchTimer.value = setTimeout(async () => { try { + console.log('📤 调用 api.ticker.search:', keyword); const res = await api.ticker.search(keyword); + console.log('📥 搜索结果:', res); if (res.code === 200) { searchResults.value = res.data; } @@ -822,6 +828,18 @@ const deletePortfolio = async () => { margin-bottom: 12rpx; } +.stock-input { + width: 100%; + height: 80rpx; + background-color: #F9FAFB; + border: 2rpx solid #E5E7EB; + border-radius: 16rpx; + padding: 0 20rpx; + font-size: 26rpx; + color: #1F2937; + box-sizing: border-box; +} + .form-select { width: 100%; height: 80rpx;