Explorar el Código

股票数据显示修改

Zhangbw hace 2 meses
padre
commit
bcedbe101b
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. 4 1
      src/views/stock/shortPool/index.vue
  2. 4 1
      src/views/stock/strongPool/index.vue

+ 4 - 1
src/views/stock/shortPool/index.vue

@@ -79,7 +79,7 @@
           <template #default="scope">{{ formatPercent(scope.row.turnoverRate) }}</template>
         </el-table-column>
         <el-table-column label="成交额(亿)" align="center" prop="tradeAmount">
-          <template #default="scope">{{ scope.row.tradeAmount || '-' }}</template>
+          <template #default="scope">{{ formatAmount(scope.row.tradeAmount) }}</template>
         </el-table-column>
         <el-table-column label="入池日期" align="center" prop="addDate" />
         <el-table-column label="状态" align="center" prop="status">
@@ -275,6 +275,9 @@ const formatPrice = (val: any) => (val != null ? Number(val).toFixed(2) : '-');
 /** 格式化百分比 */
 const formatPercent = (val: any) => (val != null ? `${Number(val) >= 0 ? '+' : ''}${Number(val).toFixed(2)}%` : '-');
 
+/** 格式化成交额 */
+const formatAmount = (val: any) => (val != null && val !== 0 ? Number(val).toFixed(2) : '-');
+
 /** 获取价格样式 */
 const getPriceClass = (row: any) => {
   if (row.changePercent == null) return '';

+ 4 - 1
src/views/stock/strongPool/index.vue

@@ -79,7 +79,7 @@
           <template #default="scope">{{ formatPercent(scope.row.turnoverRate) }}</template>
         </el-table-column>
         <el-table-column label="成交额(亿)" align="center" prop="tradeAmount">
-          <template #default="scope">{{ scope.row.tradeAmount || '-' }}</template>
+          <template #default="scope">{{ formatAmount(scope.row.tradeAmount) }}</template>
         </el-table-column>
         <el-table-column label="入池日期" align="center" prop="addDate" />
         <el-table-column label="状态" align="center" prop="status">
@@ -275,6 +275,9 @@ const formatPrice = (val: any) => (val != null ? Number(val).toFixed(2) : '-');
 /** 格式化百分比 */
 const formatPercent = (val: any) => (val != null ? `${Number(val) >= 0 ? '+' : ''}${Number(val).toFixed(2)}%` : '-');
 
+/** 格式化成交额 */
+const formatAmount = (val: any) => (val != null && val !== 0 ? Number(val).toFixed(2) : '-');
+
 /** 获取价格样式 */
 const getPriceClass = (row: any) => {
   if (row.changePercent == null) return '';