|
|
@@ -1,23 +1,35 @@
|
|
|
import { TradeMode } from "@/common/constants/enumCommon"
|
|
|
import { initData } from "@/common/methods"
|
|
|
+import { getQuoteDayInfoByCode } from "@/services/bus/goods"
|
|
|
import { getMarketByTradeMode } from "@/services/bus/market"
|
|
|
import { queryDeliveryRelation } from "@/services/go/delivery"
|
|
|
import { QueryDeliveryRelationRsp } from "@/services/go/delivery/interface"
|
|
|
+import { QueryQuoteDayRsp } from "@/services/go/quote/interface"
|
|
|
import { ref } from "vue"
|
|
|
|
|
|
// 获取交个商品
|
|
|
const allDeliverGoods = ref<QueryDeliveryRelationRsp[]>([])
|
|
|
+// 行情商品
|
|
|
+const goodsList = ref<QueryQuoteDayRsp[]>([])
|
|
|
type deliverytype = 1 | 2 | 3 | 4
|
|
|
// 1和3是订单交易 挂牌转让
|
|
|
// 2和4是基差点价
|
|
|
export function handleDeliveryRelation(param: deliverytype[]) {
|
|
|
- const deliverGoods = ref<any[]>([])
|
|
|
// 查询交割商品
|
|
|
+ const deliverGoods = ref<any[]>([])
|
|
|
function queryAction() {
|
|
|
const marketid = getMarketByTradeMode(TradeMode.ListingAndSelection)!.marketid
|
|
|
queryDeliveryRelation({ marketid }).then(res => {
|
|
|
allDeliverGoods.value = res
|
|
|
deliverGoods.value = getDeliverGoods()
|
|
|
+ res.forEach(el => {
|
|
|
+ // 找到行情数据
|
|
|
+ const quote = getQuoteDayInfoByCode(el.goodscode);
|
|
|
+ if (quote) {
|
|
|
+ Object.assign(quote, { goodsname: el.goodsname, deliverytype: el.deliverytype })
|
|
|
+ goodsList.value.push(quote)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
function getDeliverGoods() {
|
|
|
@@ -36,12 +48,19 @@ export function handleDeliveryRelation(param: deliverytype[]) {
|
|
|
function updateGeliverGoods() {
|
|
|
queryAction()
|
|
|
}
|
|
|
-
|
|
|
- return { deliverGoods, updateGeliverGoods }
|
|
|
+ // 获取对应的行情
|
|
|
+ function getQuoteList() {
|
|
|
+ return goodsList.value.filter(e => param.includes((e as unknown as any).deliverytype))
|
|
|
+ }
|
|
|
+ // 通过goodscode 查找交割商品
|
|
|
+ function findDeilverGoodsByGoodsCode(goodscode: string) {
|
|
|
+ return allDeliverGoods.value.find(e => e.goodscode === goodscode)!
|
|
|
+ }
|
|
|
+ return { deliverGoods, updateGeliverGoods, getQuoteList, findDeilverGoodsByGoodsCode }
|
|
|
}
|
|
|
|
|
|
export const columnsList = [
|
|
|
- { title: '序号', key: 'orderid' },
|
|
|
+ { title: '序号', key: 'index', width: 80 },
|
|
|
{ title: '代码', key: 'goodscode' },
|
|
|
{ title: '名称', key: 'goodsname' },
|
|
|
{ title: '买价', key: 'bid' },
|
|
|
@@ -49,10 +68,17 @@ export const columnsList = [
|
|
|
{ title: '卖价', key: 'ask' },
|
|
|
{ title: '卖量', key: 'askvolume' },
|
|
|
{ title: '最新价', key: 'last' },
|
|
|
- { title: '涨跌', key: 'goodscode' },
|
|
|
- { title: '幅度', key: 'goodscode' },
|
|
|
- { title: '今开', key: 'opened' },
|
|
|
+ { title: '涨跌', key: 'change' }, // 最新价 - 昨结价
|
|
|
+ { title: '幅度', key: 'amplitude' }, // (最新价 - 昨结价) / 100 %
|
|
|
+ { title: '开盘价', key: 'opened' },
|
|
|
{ title: '昨收价', key: 'preclose' },
|
|
|
+ { title: '昨结价', key: 'presettle' },
|
|
|
{ title: '最低价', key: 'lowest' },
|
|
|
{ title: '最高价', key: 'highest' },
|
|
|
+ // { title: '振幅', key: 'vibration' }, // (最高价 - 最低价 ) / 最新价 * 100 %
|
|
|
+ // { title: '总量', key: 'totalvolume' },
|
|
|
+ // { title: '现量', key: 'lastvolume' },
|
|
|
+ // { title: '持仓量', key: 'holdvolume' },
|
|
|
+ // { title: '日增', key: 'holdincrement' },
|
|
|
+ // { title: '金额', key: 'totalturnover' },
|
|
|
];
|