li.shaoyi há 3 anos atrás
pai
commit
633e3265df

+ 5 - 2
src/common/setup/table/tableQuote.ts

@@ -211,7 +211,10 @@ export function quoteAmplituOfVibration(record: QueryQuoteDayRsp) {
 }
 
 // 处理 空值  或者 0的时候,显示 --  的情况,
-export function handleNoneValue(value: number | string) {
-    return value ? value : '--'
+export function handleNoneValue(value: number | string, decimalplace?: number) {
+    if (value) {
+        return decimalplace === undefined ? value : Number(value).toFixed(decimalplace)
+    }
+    return '--'
 }
 

+ 1 - 1
src/services/bus/goods.ts

@@ -44,7 +44,7 @@ export function getQutoGoodsByTradeMode(trademode: TradeMode) {
                 // 找到行情数据
                 const quote = getQuoteDayInfoByCode(el.goodscode);
                 if (quote) {
-                    Object.assign(quote, { goodsname: el.goodsname, goodsid: el.goodsid })
+                    Object.assign(quote, { decimalplace: el.decimalplace, goodsname: el.goodsname, goodsid: el.goodsid })
                     result.value.push(quote)
                 }
             })

+ 1 - 1
src/services/go/quote/interface.ts

@@ -218,7 +218,7 @@ export interface QueryQuoteDayRsp {
     totalturnover: number;
     totalvolume: number;
     utclasttime: string;
-
+    decimalplace?: number;
     goodsname?: string;
     goodsid?: number
     refgoodsname?: string;

+ 46 - 17
src/views/market/spot_trade/components/goods-chart/chart/index.vue

@@ -3,18 +3,22 @@
   <div class="chart-container">
     <div class="chart-content">
       <div class="chart-content__header">
-        <a-menu class="chart-content__tabs" v-model:selectedKeys="activeCycleName" mode="horizontal" @click="changeCycleType">
+        <a-menu class="chart-content__tabs" v-model:selectedKeys="activeCycleName" mode="horizontal"
+          @click="changeCycleType">
           <a-menu-item v-for="item in chartType" :key="item.name">{{ item.label }}</a-menu-item>
         </a-menu>
-        <a-menu class="chart-content__tabs" v-model:selectedKeys="activeSeriesType" mode="horizontal" v-show="activeCycleType !== CycleType.time">
+        <a-menu class="chart-content__tabs" v-model:selectedKeys="activeSeriesType" mode="horizontal"
+          v-show="activeCycleType !== CycleType.time">
           <a-menu-item key="MACD">MACD</a-menu-item>
           <!-- <a-menu-item key="VOL">VOL</a-menu-item> -->
           <a-menu-item key="KDJ">KDJ</a-menu-item>
           <a-menu-item key="CCI">CCI</a-menu-item>
         </a-menu>
       </div>
-      <echart-time class="chart-content__main" :quote-data="selectedRow" @change="getHistoryTikDatas" v-if="activeCycleType === CycleType.time"></echart-time>
-      <echart-kline class="chart-content__main" :quote-data="selectedRow" :cycle-type="activeCycleType" :series-type="activeSeriesType[0]" v-else></echart-kline>
+      <echart-time class="chart-content__main" :quote-data="selectedRow" @change="getHistoryTikDatas"
+        v-if="activeCycleType === CycleType.time"></echart-time>
+      <echart-kline class="chart-content__main" :quote-data="selectedRow" :cycle-type="activeCycleType"
+        :series-type="activeSeriesType[0]" v-else></echart-kline>
       <div class="chart-content__footer"></div>
     </div>
     <div class="chart-slider">
@@ -27,21 +31,29 @@
           <div class="content content--right">{{ selectedRow.goodsname }}</div>
         </div>
         <div class="chart-tips__last">
-          <div :class="['content content--left', handleQuotePriceColor(selectedRow.last, selectedRow.presettle)]">{{ handleNoneValue(selectedRow.last) }}</div>
+          <div :class="['content content--left', handleQuotePriceColor(selectedRow.last, selectedRow.presettle)]">{{
+              handleNoneValue(selectedRow.last, selectedRow.decimalplace)
+          }}</div>
           <div class="content content--right">
-            <span :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteChange(selectedRow) }}</span>
-            <span :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteAmplitude(selectedRow) }}</span>
+            <span :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteChange(selectedRow)
+            }}</span>
+            <span :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteAmplitude(selectedRow)
+            }}</span>
           </div>
         </div>
         <div class="chart-tips__volume">
           <a-row>
             <a-col :span="8">卖一</a-col>
-            <a-col :class="handleQuotePriceColor(selectedRow.ask, selectedRow.presettle)" :span="16">{{ handleNoneValue(selectedRow.ask) }}</a-col>
+            <a-col :class="handleQuotePriceColor(selectedRow.ask, selectedRow.presettle)" :span="16">{{
+                handleNoneValue(selectedRow.ask, selectedRow.decimalplace)
+            }}</a-col>
             <!-- <a-col :class="handleQuotePriceColor(selectedRow.ask, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.askvolume) }}</a-col> -->
           </a-row>
           <a-row>
             <a-col :span="8">买一</a-col>
-            <a-col :class="handleQuotePriceColor(selectedRow.bid, selectedRow.presettle)" :span="16">{{ handleNoneValue(selectedRow.bid) }}</a-col>
+            <a-col :class="handleQuotePriceColor(selectedRow.bid, selectedRow.presettle)" :span="16">{{
+                handleNoneValue(selectedRow.bid, selectedRow.decimalplace)
+            }}</a-col>
             <!-- <a-col :class="handleQuotePriceColor(selectedRow.bid, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.bidvolume) }}</a-col> -->
           </a-row>
         </div>
@@ -60,7 +72,10 @@
         <div class="row-content">
           <a-row v-for="(item, index) in tradedList" :key="index + '11'">
             <a-col :span="8">{{ formatTime(item.TS, 'hm') }}</a-col>
-            <a-col :class="handleQuotePriceColor(item.PE, selectedRow.presettle)" :span="8">{{ item.PE.toFixed(2) }}</a-col>
+            <a-col :class="handleQuotePriceColor(item.PE, selectedRow.presettle)" :span="8">{{ handleNoneValue(item.PE,
+                selectedRow.decimalplace)
+            }}
+            </a-col>
             <a-col :class="handleQuotePriceColor(item.Vol, selectedRow.presettle)" :span="8">
               <!-- {{ item.Vol }} -->
             </a-col>
@@ -70,27 +85,41 @@
       <div class="chart-tips__info">
         <a-row>
           <a-col :span="4">最新</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.last) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{
+              handleNoneValue(selectedRow.last, selectedRow.decimalplace)
+          }}</a-col>
           <a-col :span="4">均价</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.averageprice, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.averageprice) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.averageprice, selectedRow.presettle)" :span="8">{{
+              handleNoneValue(selectedRow.averageprice)
+          }}</a-col>
         </a-row>
         <a-row>
           <a-col :span="4">涨跌</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{ quoteChange(selectedRow) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{
+              quoteChange(selectedRow)
+          }}</a-col>
           <a-col :span="4">今开</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.opened, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.opened) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.opened, selectedRow.presettle)" :span="8">{{
+              handleNoneValue(selectedRow.opened, selectedRow.decimalplace)
+          }}</a-col>
         </a-row>
         <a-row>
           <a-col :span="4">涨幅</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{ quoteAmplitude(selectedRow) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)" :span="8">{{
+              quoteAmplitude(selectedRow)
+          }}</a-col>
           <a-col :span="4">最高</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.highest, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.highest) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.highest, selectedRow.presettle)" :span="8">{{
+              handleNoneValue(selectedRow.highest, selectedRow.decimalplace)
+          }}</a-col>
         </a-row>
         <a-row>
           <a-col :span="4">结算</a-col>
           <a-col :span="8">{{ handleNoneValue(selectedRow.settle) }}</a-col>
           <a-col :span="4">最低</a-col>
-          <a-col :class="handleQuotePriceColor(selectedRow.lowest, selectedRow.presettle)" :span="8">{{ handleNoneValue(selectedRow.lowest) }}</a-col>
+          <a-col :class="handleQuotePriceColor(selectedRow.lowest, selectedRow.presettle)" :span="8">{{
+              handleNoneValue(selectedRow.lowest, selectedRow.decimalplace)
+          }}</a-col>
         </a-row>
         <!-- <a-row>
           <a-col :span="4">金额</a-col>

+ 49 - 32
src/views/market/spot_trade/components/goods-chart/index.vue

@@ -12,12 +12,18 @@
       <div class="inlineBar">
         <div class="valNums bdf1 ml10">
           <!-- 最新价 -->
-          <div class="firstNum start" :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ selectedRow.last }}</div>
+          <div class="firstNum start" :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{
+              handleNoneValue(selectedRow.last, selectedRow.decimalplace)
+          }}</div>
           <div class="lastNum start">
             <!-- 涨跌值 -->
-            <div :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteChange(selectedRow, selectedRow.decimalplace) }}</div>
+            <div :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteChange(selectedRow,
+                selectedRow.decimalplace)
+            }}</div>
             <!-- 涨跌幅 -->
-            <div class="ml20" :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{ quoteAmplitude(selectedRow, selectedRow.decimalplace) }}</div>
+            <div class="ml20" :class="handleQuotePriceColor(selectedRow.last, selectedRow.presettle)">{{
+                quoteAmplitude(selectedRow, selectedRow.decimalplace)
+            }}</div>
           </div>
         </div>
         <div class="priceBar ml20">
@@ -25,7 +31,9 @@
             <div class="greenBar">
               <div class="numBlock ml15">
                 <div class="first grey">卖价</div>
-                <div class="last" :class="handleQuotePriceColor(selectedRow.ask, selectedRow.presettle)">{{ selectedRow.ask }}</div>
+                <div class="last" :class="handleQuotePriceColor(selectedRow.ask, selectedRow.presettle)">{{
+                    handleNoneValue(selectedRow.ask, selectedRow.decimalplace)
+                }}</div>
               </div>
               <!-- <div class="numBlock">
                                 <div class="first grey">卖量</div>
@@ -40,7 +48,9 @@
             <div class="redBar">
               <div class="numBlock">
                 <div class="first grey">买价</div>
-                <div class="last" :class="handleQuotePriceColor(selectedRow.bid, selectedRow.presettle)">{{ selectedRow.bid }}</div>
+                <div class="last" :class="handleQuotePriceColor(selectedRow.bid, selectedRow.presettle)">{{
+                    handleNoneValue(selectedRow.bid, selectedRow.decimalplace)
+                }}</div>
               </div>
               <!-- <div class="numBlock">
                                 <div class="first grey">买量</div>
@@ -64,7 +74,7 @@
 <script lang="ts">
 import { defineComponent } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { handleQuotePriceColor, handleSubcriteOnDemandQuote, quoteAmplitude, quoteAmplituOfVibration, quoteChange } from '@/common/setup/table/tableQuote';
+import { handleNoneValue, handleQuotePriceColor, handleSubcriteOnDemandQuote, quoteAmplitude, quoteAmplituOfVibration, quoteChange } from '@/common/setup/table/tableQuote';
 import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
 import { LeftOutlined } from '@ant-design/icons-vue';
 import { PropType, ref } from 'vue';
@@ -115,6 +125,7 @@ export default defineComponent({
       handleSubcriteOnDemandQuote,
       handleQuotePriceColor,
       quoteChange,
+      handleNoneValue,
       quoteAmplitude,
       quoteAmplituOfVibration,
     };
@@ -123,37 +134,43 @@ export default defineComponent({
 </script>
 <style lang="less">
 .valNums {
-    .flex;
-    flex-direction: column;
-    padding-left: 20px;
-    .firstNum {
-        font-size: 18px;
-        line-height: 18px;
-        font-weight: 400;
-    }
-    .lastNum {
-        margin-top: 2px;
-        display: inline-flex;
-        font-size: 12px;
-        line-height: 12px;
-        font-weight: 300;
-    }
+  .flex;
+  flex-direction: column;
+  padding-left: 20px;
+
+  .firstNum {
+    font-size: 18px;
+    line-height: 18px;
+    font-weight: 400;
+  }
+
+  .lastNum {
+    margin-top: 2px;
+    display: inline-flex;
+    font-size: 12px;
+    line-height: 12px;
+    font-weight: 300;
+  }
 }
+
 .inlineBar {
-    display: inline-flex;
+  display: inline-flex;
 }
+
 .priceBar {
-    .flex;
-    flex-direction: column;
-    height: 32px;
-    .greenBar,
-    .redBar {
-        height: 16px;
-        line-height: 16px;
-    }
+  .flex;
+  flex-direction: column;
+  height: 32px;
+
+  .greenBar,
+  .redBar {
+    height: 16px;
+    line-height: 16px;
+  }
 }
+
 .start {
-    align-self: flex-start !important;
-    align-items: flex-start !important;
+  align-self: flex-start !important;
+  align-items: flex-start !important;
 }
 </style>

+ 23 - 10
src/views/market/spot_trade/spot_trade_reference_market/index.vue

@@ -2,7 +2,9 @@
   <!--参考行情-->
   <mtp-table-scroll>
     <template #default="{ scroll }">
-      <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" rowKey="goodscode" ref="tableRef" :data-source="goodsList">
+      <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading"
+        :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" rowKey="goodscode" ref="tableRef"
+        :data-source="goodsList">
         <template #totalturnover="{ text }">
           <span>{{ changeUnit(text) }}</span>
         </template>
@@ -16,15 +18,20 @@
         </template>
         <!-- 开盘价 -->
         <template #opened="{ record, text }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 涨跌 -->
         <template #change="{ record }">
-          <span :class="handleQuotePriceColor(record.last, record.presettle)">{{ quoteChange(record, record.decimalplace) }}</span>
+          <span :class="handleQuotePriceColor(record.last, record.presettle)">{{ quoteChange(record,
+              record.decimalplace)
+          }}</span>
         </template>
         <!-- 幅度 -->
         <template #amplitude="{ record }">
-          <span :class="handleQuotePriceColor(record.last, record.presettle)">{{ quoteAmplitude(record, record.decimalplace) }}</span>
+          <span :class="handleQuotePriceColor(record.last, record.presettle)">{{ quoteAmplitude(record,
+              record.decimalplace)
+          }}</span>
         </template>
         <!-- 振幅 -->
         <template #vibration="{ record, text }">
@@ -35,23 +42,28 @@
         </template>
         <!-- 买价 -->
         <template #bid="{ text, record }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 卖价 -->
         <template #ask="{ text, record }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 最新价 -->
         <template #last="{ text, record }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 最低价 -->
         <template #lowest="{ text, record }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 最高价 -->
         <template #highest="{ text, record }">
-          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text) }}</span>
+          <span :class="handleQuotePriceColor(text, record.presettle)">{{ handleNoneValue(text, record.decimalplace)
+          }}</span>
         </template>
         <!-- 昨结价 -->
         <template #preclose="{ text, record }">
@@ -62,7 +74,8 @@
   </mtp-table-scroll>
   <!-- 右键 -->
   <!-- <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="firstBtn"></contextMenu> -->
-  <component :is="componentId" v-if="componentId" :enumName="name" :selectedRow="selectedRow" @cancel="closeComponent"></component>
+  <component :is="componentId" v-if="componentId" :enumName="name" :selectedRow="selectedRow" @cancel="closeComponent">
+  </component>
 </template>
 
 <script lang="ts">