|
|
@@ -94,15 +94,27 @@ export const useFuturesStore = defineStore(() => {
|
|
|
continue
|
|
|
}
|
|
|
// 更新商品配置
|
|
|
- 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)
|
|
|
- const res = await decodeProto<Proto.MarginInfoStruct>('MarginInfoStruct', uint8Array) // proto数据解析
|
|
|
- item.marketmarginalgorithm = res.MarginAlgorithm
|
|
|
- item.marketmarginvalue = res.MarketMarginValue
|
|
|
+ const findMargin = accountConfig.todayAccountMargins.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
|
|
|
+ const margin = findMargin ?? accountConfig.todayAccountMargins.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
|
|
|
+ if (margin) {
|
|
|
+ const marginWordArray = CryptoJS.enc.Base64.parse(margin.infocontent) // 解析base64
|
|
|
+ const marginUint8Array = wordArrayToUint8Array(marginWordArray)
|
|
|
+ const marginData = await decodeProto<Proto.MarginInfoStruct>('MarginInfoStruct', marginUint8Array) // proto数据解析
|
|
|
+ item.marketmarginalgorithm = marginData.MarginAlgorithm
|
|
|
+ item.marketmarginvalue = marginData.MarketMarginValue
|
|
|
}
|
|
|
+
|
|
|
+ const findRule = accountConfig.todayAccountTradeRules.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
|
|
|
+ const rule = findRule ?? accountConfig.todayAccountTradeRules.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
|
|
|
+ if (rule) {
|
|
|
+ const ruleWordArray = CryptoJS.enc.Base64.parse(rule.infocontent) // 解析base64
|
|
|
+ const ruleUint8Array = wordArrayToUint8Array(ruleWordArray)
|
|
|
+ const ruleData = await decodeProto<Proto.TradeRuleInfoStruct>('TradeRuleInfoStruct', ruleUint8Array) // proto数据解析
|
|
|
+ item.traderules = ruleData.TradeRules
|
|
|
+ } else {
|
|
|
+ item.traderules = []
|
|
|
+ }
|
|
|
+
|
|
|
// 组合商品属性
|
|
|
state.goodsList.push({
|
|
|
...item,
|
|
|
@@ -305,6 +317,7 @@ export const useFuturesStore = defineStore(() => {
|
|
|
openedColor: '',
|
|
|
highestColor: '',
|
|
|
lowestColor: '',
|
|
|
+ traderules: []
|
|
|
}
|
|
|
|
|
|
if (item.goodsid) {
|
|
|
@@ -340,7 +353,8 @@ export const useFuturesStore = defineStore(() => {
|
|
|
provideraccountid: item.provideraccountid,
|
|
|
provideruserid: item.provideruserid,
|
|
|
goodstradetype: item.goodstradetype,
|
|
|
- currencyid: item.currencyid
|
|
|
+ currencyid: item.currencyid,
|
|
|
+ traderules: item.traderules
|
|
|
} = goods)
|
|
|
|
|
|
item.iscannotbuy = goods.iscannotbuy ?? 0
|