li.shaoyi 1 ano atrás
pai
commit
1ebeebad6f
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6 3
      src/stores/modules/futures.ts

+ 6 - 3
src/stores/modules/futures.ts

@@ -8,6 +8,7 @@ import { queryErmcpGoods, queryQuoteDay } from '@/services/api/goods'
 import { wordArrayToUint8Array } from '@/services/websocket/package/crypto'
 import { decodeProto } from '@/services/websocket/package/package50/proto'
 import { defineStore } from '../store'
+import { useAccountStore } from './account'
 import CryptoJS from 'crypto-js'
 import eventBus from '@/services/bus'
 import moment from 'moment'
@@ -74,6 +75,7 @@ export const useFuturesStore = defineStore(() => {
         state.quotationList = []
         timerTask.clearTimeout('quoteDay')
 
+        const accountStore = useAccountStore()
         // 任务 #5511
         const { data: accountConfig } = await getTodayAccountConfigInfo()
         // 任务 #5197
@@ -92,7 +94,8 @@ export const useFuturesStore = defineStore(() => {
                 continue
             }
             // 更新商品配置
-            const config = accountConfig.todayAccountMargins.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
+            const findAccountConfig = accountConfig.todayAccountMargins.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
+            const config = findAccountConfig ?? accountConfig.todayAccountMargins.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
             if (config) {
                 const wordArray = CryptoJS.enc.Base64.parse(config.infocontent) // 解析base64
                 const uint8Array = wordArrayToUint8Array(wordArray)
@@ -234,7 +237,7 @@ export const useFuturesStore = defineStore(() => {
             trademode: 0,
             agreeunit: 0,
             decimalplace: 0,
-            decimalvalue:0,
+            decimalvalue: 0,
             quoteminunit: 0,
             quotegear: 0,
             last: quote.last ?? 0,
@@ -367,7 +370,7 @@ export const useFuturesStore = defineStore(() => {
         item.amplitude = item.presettle ? (item.highest - item.lowest) / item.presettle : 0 // 振幅: (最高价 - 最低价 ) / 最新价
 
         // 计算小数单位值
-        item.decimalvalue= item.quoteminunit * Math.pow(10, item.decimalplace * -1)
+        item.decimalvalue = item.quoteminunit * Math.pow(10, item.decimalplace * -1)
 
         // 处理行情价格颜色
         const handleColor = (value: number | string) => handlePriceColor(Number(value), item.presettle)