diff --git a/src/views/ValueForum/components/TradeModal.js b/src/views/ValueForum/components/TradeModal.js
index 9e475c57..f205b822 100644
--- a/src/views/ValueForum/components/TradeModal.js
+++ b/src/views/ValueForum/components/TradeModal.js
@@ -80,10 +80,22 @@ const TradeModal = ({ isOpen, onClose, topic, mode = 'buy', onTradeSuccess }) =>
if (!topic || !userAccount) return null;
+ // 构建市场数据(兼容后端字段)
+ const positions = {
+ yes: {
+ total_shares: topic.yes_total_shares || 0,
+ current_price: topic.yes_price || 500,
+ },
+ no: {
+ total_shares: topic.no_total_shares || 0,
+ current_price: topic.no_price || 500,
+ },
+ };
+
// 获取市场数据
- const selectedSide = topic.positions[selectedOption];
+ const selectedSide = positions[selectedOption];
const otherOption = selectedOption === 'yes' ? 'no' : 'yes';
- const otherSide = topic.positions[otherOption];
+ const otherSide = positions[otherOption];
// 计算交易数据
let cost = 0;
@@ -278,14 +290,14 @@ const TradeModal = ({ isOpen, onClose, topic, mode = 'buy', onTradeSuccess }) =>
- {topic.positions.yes.total_shares}份持仓
+ {positions.yes.total_shares}份持仓
- {Math.round(topic.positions.yes.current_price)}
+ {Math.round(positions.yes.current_price)}
积分/份
@@ -324,14 +336,14 @@ const TradeModal = ({ isOpen, onClose, topic, mode = 'buy', onTradeSuccess }) =>
- {topic.positions.no.total_shares}份持仓
+ {positions.no.total_shares}份持仓
- {Math.round(topic.positions.no.current_price)}
+ {Math.round(positions.no.current_price)}
积分/份