fix: 今日变动显示正负号; 详情页动态显示组合名称

This commit is contained in:
claw_bot 2026-03-25 03:11:09 +00:00
parent 4b2ee7038b
commit 5ef4e76053
2 changed files with 7 additions and 1 deletions

View File

@ -977,6 +977,12 @@ const fetchPortfolioData = async () => {
if (response.code === 200) { if (response.code === 200) {
portfolioData.value = response.data; portfolioData.value = response.data;
positions.value = response.data.positions || []; positions.value = response.data.positions || [];
//
if (response.data.name) {
uni.setNavigationBarTitle({ title: response.data.name });
}
console.log('投资组合数据获取成功:', response.data); console.log('投资组合数据获取成功:', response.data);
} }
} catch (error) { } catch (error) {

View File

@ -137,7 +137,7 @@
<view class="card-extra" v-if="holding.todayProfit"> <view class="card-extra" v-if="holding.todayProfit">
<text class="extra-label">今日变动</text> <text class="extra-label">今日变动</text>
<text class="extra-val" :class="(holding.todayProfit || 0) >= 0 ? 'text-red' : 'text-green'"> <text class="extra-val" :class="(holding.todayProfit || 0) >= 0 ? 'text-red' : 'text-green'">
{{ (holding.todayProfit || 0) >= 0 ? '+' : '' }}{{ getCurrencySymbol(holding.todayProfitCurrency || holding.currency) }}{{ Math.abs(holding.todayProfit || 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }} {{ (holding.todayProfit || 0) >= 0 ? '+' : '-' }}{{ getCurrencySymbol(holding.todayProfitCurrency || holding.currency) }}{{ Math.abs(holding.todayProfit || 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) }}
</text> </text>
</view> </view>
</view> </view>