|
|
@@ -0,0 +1,71 @@
|
|
|
+import { TradeMode } from "@/common/constants/enumCommon"
|
|
|
+import { initData } from "@/common/methods"
|
|
|
+import { queryTableList } from "@/common/setup/table"
|
|
|
+import { getQuoteDayInfoByCode } from "@/services/bus/goods"
|
|
|
+import { getMarketIdsByTradeMode } from "@/services/bus/market"
|
|
|
+import { getUserAccountType } from "@/services/bus/user"
|
|
|
+import { QueryQuoteDayRsp } from "@/services/go/quote/interface"
|
|
|
+import { queryQuoteGoodsList } from "@/services/go/Tjmd"
|
|
|
+import { QueryQuoteGoodsListReq, QueryQuoteGoodsListRsp } from "@/services/go/Tjmd/interface"
|
|
|
+import { ref } from "vue"
|
|
|
+
|
|
|
+// 获取 商品掉期 商品列表
|
|
|
+export const useSwapList = () => {
|
|
|
+ const { loading, tableList, queryTable } = queryTableList<QueryQuoteGoodsListRsp>();
|
|
|
+ // 行情商品
|
|
|
+ const goodsList = ref<QueryQuoteDayRsp[]>([])
|
|
|
+ initData(() => {
|
|
|
+ // 组装 参数
|
|
|
+ const marketids = getMarketIdsByTradeMode(TradeMode.ListingAndSelection)
|
|
|
+ const param: QueryQuoteGoodsListReq = {
|
|
|
+ usertype: getUserAccountType(),
|
|
|
+ }
|
|
|
+ if (marketids) {
|
|
|
+ param.marketids = marketids
|
|
|
+ }
|
|
|
+ // 开始查询 商品掉期
|
|
|
+ queryTable(queryQuoteGoodsList, param).then(res => {
|
|
|
+ goodsList.value.length = 0
|
|
|
+ res.forEach(el => {
|
|
|
+ // 找到盘面数据
|
|
|
+ const quote = getQuoteDayInfoByCode(el.goodscode);
|
|
|
+ if (quote) {
|
|
|
+ Object.assign(quote, { goodsname: el.goodsname, refgoodsname: el.refgoodsname })
|
|
|
+ goodsList.value.push(quote)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return { loading, goodsList }
|
|
|
+}
|
|
|
+
|
|
|
+export const columnsList = [
|
|
|
+ { title: '序号', key: 'index', width: 80 },
|
|
|
+ { title: '代码', key: 'goodscode' },
|
|
|
+ { title: '名称', key: 'goodsname' },
|
|
|
+
|
|
|
+ { title: '标的合约', key: 'refgoodsname' },
|
|
|
+
|
|
|
+ { title: '买价', key: 'bid' },
|
|
|
+ { title: '买量', key: 'bidvolume' },
|
|
|
+ { title: '卖价', key: 'ask' },
|
|
|
+ { title: '卖量', key: 'askvolume' },
|
|
|
+
|
|
|
+ { title: '当前价', key: 'last' },
|
|
|
+ { title: '涨跌', key: 'change' }, // 最新价 - 昨结价
|
|
|
+ { title: '幅度', key: 'amplitude' }, // (最新价 - 昨结价) / 100 %
|
|
|
+ { title: '开盘', key: 'opened' },
|
|
|
+ { title: '最高', key: 'highest' },
|
|
|
+ { title: '最低', key: 'lowest' },
|
|
|
+
|
|
|
+ { title: '结算', key: 'settle' },
|
|
|
+
|
|
|
+ { title: '昨结算', key: 'presettle' },
|
|
|
+
|
|
|
+ // { title: '振幅', key: 'vibration' }, // (最高价 - 最低价 ) / 最新价 * 100 %
|
|
|
+ // { title: '总量', key: 'totalvolume' },
|
|
|
+ // { title: '现量', key: 'lastvolume' },
|
|
|
+ // { title: '持仓量', key: 'holdvolume' },
|
|
|
+ // { title: '日增', key: 'holdincrement' },
|
|
|
+ // { title: '金额', key: 'totalturnover' },
|
|
|
+];
|