|
|
@@ -1,6 +1,7 @@
|
|
|
import { shallowRef, reactive, computed, toRefs, onUnmounted } from 'vue'
|
|
|
import { v4 } from 'uuid'
|
|
|
import { handlePriceColor } from '@/filters'
|
|
|
+import { queryMemberGoodsLimitConfig } from '@/services/api/common'
|
|
|
import { queryErmcpGoods, queryQuoteDay } from '@/services/api/goods'
|
|
|
import { defineStore } from '../store'
|
|
|
import { timerTask } from '@/utils/timer'
|
|
|
@@ -21,7 +22,7 @@ export const useFuturesStore = defineStore(() => {
|
|
|
|
|
|
const state = reactive({
|
|
|
loading: false,
|
|
|
- goodsList: <Model.GoodsRsp[]>[], // 商品列表
|
|
|
+ goodsList: <(Model.GoodsRsp & Partial<Model.MemberGoodsLimitConfigRsp>)[]>[], // 商品列表
|
|
|
goodsQuoteList: <Model.GoodsQuote[]>[], // 商品行情列表
|
|
|
selectedGoodsId: <number | undefined>undefined, // 当前选中的商品ID
|
|
|
})
|
|
|
@@ -73,12 +74,33 @@ export const useFuturesStore = defineStore(() => {
|
|
|
const getGoodsList = () => {
|
|
|
state.loading = true
|
|
|
timerTask.clearTimeout('quoteDay')
|
|
|
- queryErmcpGoods().then((res) => {
|
|
|
- state.goodsList = res.data
|
|
|
- const codes = res.data.map((e) => e.goodscode)
|
|
|
- if (codes.length) {
|
|
|
- getQuoteDay(codes)
|
|
|
+ // 任务 #5197
|
|
|
+ queryMemberGoodsLimitConfig({
|
|
|
+ data: {
|
|
|
+ roletype: 7
|
|
|
}
|
|
|
+ }).then((cfg) => {
|
|
|
+ queryErmcpGoods().then((res) => {
|
|
|
+ state.goodsList = res.data.reduce<(Model.GoodsRsp & Partial<Model.MemberGoodsLimitConfigRsp>)[]>((pre, cur) => {
|
|
|
+ const item = cfg.data.find((e) => e.goodsid === cur.goodsid)
|
|
|
+ // 跳过不显示的商品
|
|
|
+ if (item && item.isnodisplay) {
|
|
|
+ return pre
|
|
|
+ }
|
|
|
+ // 组合商品属性
|
|
|
+ pre.push({
|
|
|
+ ...cur,
|
|
|
+ iscannotbuy: item?.iscannotbuy ?? 0,
|
|
|
+ iscannotsell: item?.iscannotsell ?? 0
|
|
|
+ })
|
|
|
+ return pre
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ const codes = res.data.map((e) => e.goodscode)
|
|
|
+ if (codes.length) {
|
|
|
+ getQuoteDay(codes)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
// 获取商品盘面信息
|
|
|
const getQuoteDay = (codes: string[]) => {
|
|
|
@@ -216,6 +238,8 @@ export const useFuturesStore = defineStore(() => {
|
|
|
rise: 0,
|
|
|
change: 0,
|
|
|
amplitude: 0,
|
|
|
+ iscannotbuy: 0,
|
|
|
+ iscannotsell: 0,
|
|
|
bidColor: '',
|
|
|
bid2Color: '',
|
|
|
bid3Color: '',
|
|
|
@@ -261,6 +285,9 @@ export const useFuturesStore = defineStore(() => {
|
|
|
marketmarginvalue: item.marketmarginvalue,
|
|
|
} = goods)
|
|
|
|
|
|
+ item.iscannotbuy = goods.iscannotbuy ?? 0
|
|
|
+ item.iscannotsell = goods.iscannotsell ?? 0
|
|
|
+
|
|
|
// 向列表添加新数据
|
|
|
state.goodsQuoteList.push(item)
|
|
|
}
|