huangbin il y a 4 ans
Parent
commit
8baea2b9de

+ 0 - 3
src/assets/styles/index.css

@@ -2403,9 +2403,6 @@ body {
   width: 100%;
   height: 100%;
 }
-.default-quote-color {
-  color: var(--m-white5);
-}
 .up-quote-color {
   color: #FF2B2B;
 }

+ 0 - 3
src/assets/styles/index.less

@@ -311,9 +311,6 @@ body {
 }
 
 // 行情涨跌颜色
-.default-quote-color {
-    color: @m-white5;
-}
 .up-quote-color {
     color: @m-red1;
 }

+ 20 - 7
src/common/setup/table/tableQuote.ts

@@ -93,12 +93,25 @@ export function handleSubcriteQuote<T extends object>(tableList: Ref<T[]>, codeK
  * @param price2
  * @returns
  */
-export function handleQuotePriceColor(price1: number, price2: number) {
-    if (price1 === price2) {
-        return 'default-quote-color'
-    } else if (price1 > price2) {
-        return 'up-quote-color'
-    } else {
-        return 'down-quote-color'
+export function handleQuotePriceColor(price1: number | string, price2: number | string) {
+    let result = ''
+    if (price2 && price2 !== '--' && price1 && price1 !== '--') {
+        if (price1 === price2) {
+            result = ''
+        } else if (price1 > price2) {
+            result = 'up-quote-color'
+        } else {
+            result = 'down-quote-color'
+        }
+    }
+    return result
+}
+
+// 涨跌 最新价 - 昨结价
+export function quoteChange(price1: number | string, price2: number | string, decimalplace = 2) {
+    let result = '--'
+    if (price2 && price2 !== '--' && price1 && price1 !== '--') {
+        result = ((price1 as number) - (price2 as number)).toFixed(decimalplace)
     }
+    return result
 }

+ 41 - 36
src/services/socket/quota/adapter/index.ts

@@ -127,42 +127,47 @@ export function parseReceivePush(quotationData: any) {
                 const decimalplace = goods.decimalplace
                 const num = Math.pow(10, decimalplace)
                 const fn = (value: number) => +(value / num).toFixed(decimalplace)
-                goodsQuoteTik.last && (goodsQuoteTik.last = fn(goodsQuoteTik.last))
-                goodsQuoteTik.settle && (goodsQuoteTik.settle = fn(goodsQuoteTik.settle))
-                goodsQuoteTik.presettle && (goodsQuoteTik.presettle = fn(goodsQuoteTik.presettle))
-                goodsQuoteTik.ask && (goodsQuoteTik.ask = fn(goodsQuoteTik.ask))
-                goodsQuoteTik.ask2 && (goodsQuoteTik.ask2 = fn(goodsQuoteTik.ask2))
-                goodsQuoteTik.ask3 && (goodsQuoteTik.ask3 = fn(goodsQuoteTik.ask3))
-                goodsQuoteTik.ask4 && (goodsQuoteTik.ask4 = fn(goodsQuoteTik.ask4))
-                goodsQuoteTik.ask5 && (goodsQuoteTik.ask5 = fn(goodsQuoteTik.ask5))
-                goodsQuoteTik.ask6 && (goodsQuoteTik.ask6 = fn(goodsQuoteTik.ask6))
-                goodsQuoteTik.ask7 && (goodsQuoteTik.ask7 = fn(goodsQuoteTik.ask7))
-                goodsQuoteTik.ask8 && (goodsQuoteTik.ask8 = fn(goodsQuoteTik.ask8))
-                goodsQuoteTik.ask9 && (goodsQuoteTik.ask9 = fn(goodsQuoteTik.ask9))
-                goodsQuoteTik.ask10 && (goodsQuoteTik.ask10 = fn(goodsQuoteTik.ask10))
-                goodsQuoteTik.bid && (goodsQuoteTik.bid = fn(goodsQuoteTik.bid))
-                goodsQuoteTik.bid2 && (goodsQuoteTik.bid2 = fn(goodsQuoteTik.bid2))
-                goodsQuoteTik.bid3 && (goodsQuoteTik.bid3 = fn(goodsQuoteTik.bid3))
-                goodsQuoteTik.bid4 && (goodsQuoteTik.bid4 = fn(goodsQuoteTik.bid4))
-                goodsQuoteTik.bid5 && (goodsQuoteTik.bid5 = fn(goodsQuoteTik.bid5))
-                goodsQuoteTik.bid6 && (goodsQuoteTik.bid6 = fn(goodsQuoteTik.bid6))
-                goodsQuoteTik.bid7 && (goodsQuoteTik.bid7 = fn(goodsQuoteTik.bid7))
-                goodsQuoteTik.bid8 && (goodsQuoteTik.bid8 = fn(goodsQuoteTik.bid8))
-                goodsQuoteTik.bid9 && (goodsQuoteTik.bid9 = fn(goodsQuoteTik.bid9))
-                goodsQuoteTik.bid10 && (goodsQuoteTik.bid10 = fn(goodsQuoteTik.bid10))
-                goodsQuoteTik.averageprice && (goodsQuoteTik.averageprice = fn(goodsQuoteTik.averageprice))
-                goodsQuoteTik.grepmarketprice && (goodsQuoteTik.grepmarketprice = fn(goodsQuoteTik.grepmarketprice))
-                goodsQuoteTik.highest && (goodsQuoteTik.highest = fn(goodsQuoteTik.highest))
-                goodsQuoteTik.iep && (goodsQuoteTik.iep = fn(goodsQuoteTik.iep))
-                goodsQuoteTik.last && (goodsQuoteTik.last = fn(goodsQuoteTik.last))
-                goodsQuoteTik.limitdown && (goodsQuoteTik.limitdown = fn(goodsQuoteTik.limitdown))
-                goodsQuoteTik.limitup && (goodsQuoteTik.limitup = fn(goodsQuoteTik.limitup))
-                goodsQuoteTik.lowest && (goodsQuoteTik.lowest = fn(goodsQuoteTik.lowest))
-                goodsQuoteTik.opened && (goodsQuoteTik.opened = fn(goodsQuoteTik.opened))
-                goodsQuoteTik.preclose && (goodsQuoteTik.preclose = fn(goodsQuoteTik.preclose))
-                goodsQuoteTik.presettle && (goodsQuoteTik.presettle = fn(goodsQuoteTik.presettle))
-                goodsQuoteTik.settle && (goodsQuoteTik.settle = fn(goodsQuoteTik.settle))
-                goodsQuoteTik.strikeprice && (goodsQuoteTik.strikeprice = fn(goodsQuoteTik.strikeprice))
+                goodsQuoteTik.decimalplace = decimalplace
+                goodsQuoteTik.last = goodsQuoteTik.last ? fn(goodsQuoteTik.last) : '--'
+                goodsQuoteTik.presettle = goodsQuoteTik.presettle ? (fn(goodsQuoteTik.presettle)) : '--'
+                goodsQuoteTik.ask = goodsQuoteTik.ask ? (fn(goodsQuoteTik.ask)) : '--'
+                goodsQuoteTik.ask2 = goodsQuoteTik.ask2 ? (fn(goodsQuoteTik.ask2)) : '--'
+                goodsQuoteTik.ask3 = goodsQuoteTik.ask3 ? (fn(goodsQuoteTik.ask3)) : '--'
+                goodsQuoteTik.ask4 = goodsQuoteTik.ask4 ? (fn(goodsQuoteTik.ask4)) : '--'
+                goodsQuoteTik.ask5 = goodsQuoteTik.ask5 ? (fn(goodsQuoteTik.ask5)) : '--'
+                goodsQuoteTik.ask6 = goodsQuoteTik.ask6 ? (fn(goodsQuoteTik.ask6)) : '--'
+                goodsQuoteTik.ask7 = goodsQuoteTik.ask7 ? (fn(goodsQuoteTik.ask7)) : '--'
+                goodsQuoteTik.ask8 = goodsQuoteTik.ask8 ? (fn(goodsQuoteTik.ask8)) : '--'
+                goodsQuoteTik.ask9 = goodsQuoteTik.ask9 ? (fn(goodsQuoteTik.ask9)) : '--'
+                goodsQuoteTik.ask10 = goodsQuoteTik.ask10 ? (fn(goodsQuoteTik.ask10)) : '--'
+                goodsQuoteTik.bid = goodsQuoteTik.bid ? (fn(goodsQuoteTik.bid)) : '--'
+                goodsQuoteTik.bid2 = goodsQuoteTik.bid2 ? (fn(goodsQuoteTik.bid2)) : '--'
+                goodsQuoteTik.bid3 = goodsQuoteTik.bid3 ? (fn(goodsQuoteTik.bid3)) : '--'
+                goodsQuoteTik.bid4 = goodsQuoteTik.bid4 ? (fn(goodsQuoteTik.bid4)) : '--'
+                goodsQuoteTik.bid5 = goodsQuoteTik.bid5 ? (fn(goodsQuoteTik.bid5)) : '--'
+                goodsQuoteTik.bid6 = goodsQuoteTik.bid6 ? (fn(goodsQuoteTik.bid6)) : '--'
+                goodsQuoteTik.bid7 = goodsQuoteTik.bid7 ? (fn(goodsQuoteTik.bid7)) : '--'
+                goodsQuoteTik.bid8 = goodsQuoteTik.bid8 ? (fn(goodsQuoteTik.bid8)) : '--'
+                goodsQuoteTik.bid9 = goodsQuoteTik.bid9 ? (fn(goodsQuoteTik.bid9)) : '--'
+                goodsQuoteTik.bid10 = goodsQuoteTik.bid10 ? (fn(goodsQuoteTik.bid10)) : '--'
+                goodsQuoteTik.averageprice = goodsQuoteTik.averageprice ? (fn(goodsQuoteTik.averageprice)) : '--'
+                goodsQuoteTik.grepmarketprice = goodsQuoteTik.grepmarketprice ? (fn(goodsQuoteTik.grepmarketprice)) : '--'
+                goodsQuoteTik.highest = goodsQuoteTik.highest ? (fn(goodsQuoteTik.highest)) : '--'
+                goodsQuoteTik.iep = goodsQuoteTik.iep ? (fn(goodsQuoteTik.iep)) : '--'
+                goodsQuoteTik.limitdown = goodsQuoteTik.limitdown ? (fn(goodsQuoteTik.limitdown)) : '--'
+                goodsQuoteTik.limitup = goodsQuoteTik.limitup ? (fn(goodsQuoteTik.limitup)) : '--'
+                goodsQuoteTik.lowest = goodsQuoteTik.lowest ? (fn(goodsQuoteTik.lowest)) : '--'
+                goodsQuoteTik.opened = goodsQuoteTik.opened ? (fn(goodsQuoteTik.opened)) : '--'
+                goodsQuoteTik.preclose = goodsQuoteTik.preclose ? (fn(goodsQuoteTik.preclose)) : '--'
+                goodsQuoteTik.settle = goodsQuoteTik.settle ? (fn(goodsQuoteTik.settle)) : '--'
+                goodsQuoteTik.strikeprice = goodsQuoteTik.strikeprice ? (fn(goodsQuoteTik.strikeprice)) : '--'
+
+                !goodsQuoteTik.bidvolume && (goodsQuoteTik.bidvolume = '--')
+                !goodsQuoteTik.askvolume && (goodsQuoteTik.askvolume = '--')
+                !goodsQuoteTik.lastvolume && (goodsQuoteTik.lastvolume = '--')
+                !goodsQuoteTik.holdvolume && (goodsQuoteTik.holdvolume = '--')
+                !goodsQuoteTik.holdincrement && (goodsQuoteTik.holdincrement = '--')
+                // !goodsQuoteTik.totalturnover && (goodsQuoteTik.totalturnover = '--')
 
             } else {
                 console.warn(`行情推送的商品goods:${itemQuote.goodscode}在商品列表里不存在`)

+ 8 - 7
src/views/market/spot_trade/spot_trade_reference_market/index.vue

@@ -18,7 +18,7 @@
         <span>{{index + 1}}</span>
       </template>
       <template #bid="{ text, record }">
-        <span :class="handleQuotePriceColor(text, record.preclose)">{{text}}</span>
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
       </template>
     </a-table>
     <!-- 右键 -->
@@ -57,17 +57,18 @@ const columnsList = [
     { title: '卖价', key: 'ask' },
     { title: '卖量', key: 'askvolume' },
     { title: '最新价', key: 'last' },
-    { title: '涨跌', key: 'change' },
-    { title: '幅度', key: 'amplitude' },
+    { title: '涨跌', key: 'change' }, // 最新价 - 昨结价
+    { title: '幅度', key: 'amplitude' }, // (最新价 - 昨结价) / 100 %
     { title: '开盘价', key: 'opened' },
     { title: '昨收价', key: 'preclose' },
+    { title: '昨结价', key: 'presettle' },
     { title: '最低价', key: 'lowest' },
     { title: '最高价', key: 'highest' },
-    { title: '振幅', key: 'goodscode' },
-    { title: '总量', key: 'goodscode' },
-    { title: '现量', key: 'goodscode' },
+    { title: '振幅', key: 'goodscode' }, // (最高价 - 最低价 ) / 最新价  * 100 %
+    { title: '总量', key: 'totalvolume' },
+    { title: '现量', key: 'lastvolume' },
     { title: '持仓量', key: 'holdvolume' },
-    { title: '日增', key: 'goodscode' },
+    { title: '日增', key: 'holdincrement' },
     { title: '金额', key: 'totalturnover' },
 ];