huangbin 4 лет назад
Родитель
Сommit
e1abe5a6be

+ 3 - 0
src/services/bus/goods.ts

@@ -28,10 +28,13 @@ export function getGoodsListByTrade(trademode: TradeMode): Ref<Goods[]> {
 export function getQutoGoodsByTradeMode(trademode: TradeMode) {
     const result = ref<QueryQuoteDayRsp[]>([])
     initData(() => {
+        // 获取市场信息
         const marketInfo = getMarketByTradeMode(trademode)
         if (marketInfo) {
+            // 过滤商品信息
             const goodsList = getGoodsList().filter(e => e.marketid === marketInfo.marketid)
             goodsList.forEach(el => {
+                // 找到行情数据
                 const quote = getQuoteDayInfoByCode(el.goodscode);
                 if (quote) {
                     Object.assign(quote, { goodsname: el.goodsname })

+ 2 - 3
src/views/market/spot_trade/spot_trade_order_transaction/components/buy-market/index.vue

@@ -30,7 +30,6 @@
              v-if="componentId"
              :selectedRow="selectedRow"
              :buyOrSell="BuyOrSell.buy"
-             :parantSelectedRow="parantSelectedRow"
              @cancel="closeComponent"></component>
 </template>
 
@@ -53,7 +52,7 @@ export default defineComponent({
     emits: ['cancel', 'openComponent'],
     name: 'warehouse_receipt_trade_price_delisting_buy',
     props: {
-        parantSelectedRow: {
+        selectedRow: {
             type: Object as PropType<WrOrderQuote>,
             default: {},
         },
@@ -78,7 +77,7 @@ export default defineComponent({
         const queryTableAction = () => {
             const param: WrTradeOrderDetailReq = {
                 buyorsell: 0,
-                goodsid: props.parantSelectedRow.goodsid,
+                goodsid: props.selectedRow.goodsid,
             };
             queryTable(queryWrTradeOrderDetail, param);
         };

+ 10 - 5
src/views/market/spot_trade/spot_trade_order_transaction/components/buy-sell-market/index.vue

@@ -37,16 +37,16 @@
     <a-row class="buySellHall">
       <a-col :span="12">
         <Sell ref="sellRef"
-              :parantSelectedRow="selectedRow" />
+              :selectedRow="deliverGoods" />
       </a-col>
       <a-col :span="12">
         <Buy ref="buyRef"
-             :parantSelectedRow="selectedRow" />
+             :selectedRow="deliverGoods" />
       </a-col>
     </a-row>
     <component :is="componentId"
                v-if="componentId"
-               :selectedRow="selectedRow"
+               :selectedRow="deliverGoods"
                @cancel="closeComponent"></component>
   </div>
 </template>
@@ -66,13 +66,19 @@ import Bus from '@/utils/eventBus/index';
 import TimerUtils from '@/utils/timer/timerUtil';
 import { BtnListType } from '@/common/components/btnList/interface';
 import moment, { Moment } from 'moment';
+import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
+import { QueryDeliveryRelationRsp } from '@/services/go/delivery/interface';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
     name: 'buy-sell-market',
     props: {
         selectedRow: {
-            type: Object as PropType<WrOrderQuote>,
+            type: Object as PropType<QueryQuoteDayRsp>,
+            default: {},
+        },
+        deliverGoods: {
+            type: Object as PropType<QueryDeliveryRelationRsp>,
             default: {},
         },
     },
@@ -85,7 +91,6 @@ export default defineComponent({
         Detail: defineAsyncComponent(() => import('../detail/index.vue')),
     },
     setup(props, context) {
-        const time = ref<Moment>(moment(props.selectedRow.deliverymonth)); // string 交收月
         const loading = ref<boolean>(false);
         const { visible, cancel } = _closeModal(context);
 

+ 32 - 35
src/views/market/spot_trade/spot_trade_order_transaction/components/sell-market/index.vue

@@ -1,37 +1,34 @@
 <template>
-    <!-- 现货贸易 - 买卖大厅 - 买报价牌 -->
-    <a-table
-        :columns="handleColumn(columns)"
-        :class="['sellHallTable', isBottom ? '' : 'sellHallTableHigh', tableList.length ? '' : 'noDataTable']"
-        :scroll="{ x: '100%', y: isBottom ? 'calc(100vh- 470px)' : 'calc(100vh - 145px)' }"
-        :pagination="false"
-        :loading="loading"
-        :expandedRowKeys="expandedRowKeys"
-        :customRow="Rowclick"
-        :expandIcon="expandIcon"
-        :expandIconAsCell="false"
-        rowKey="key"
-        :data-source="tableList"
-    >
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{ record }">
-            <BtnList :btnList="btnListData" :record="record" @click="openComponent" />
-        </template>
-        <template #username="{text, record }">
-            <span>{{record.userid + " " }}{{text}}</span>
-        </template>
-        <template #fixedprice="{record }">
-            <span>{{record.useorderpricerid }}</span>
-        </template>
-    </a-table>
-    <component
-        :is="componentId"
-        v-if="componentId"
-        :selectedRow="selectedRow"
-        :buyOrSell="BuyOrSell.sell"
-        :parantSelectedRow="parantSelectedRow"
-        @cancel="closeComponent"
-    ></component>
+  <!-- 现货贸易 - 买卖大厅 - 买报价牌 -->
+  <a-table :columns="handleColumn(columns)"
+           :class="['sellHallTable', isBottom ? '' : 'sellHallTableHigh', tableList.length ? '' : 'noDataTable']"
+           :scroll="{ x: '100%', y: isBottom ? 'calc(100vh- 470px)' : 'calc(100vh - 145px)' }"
+           :pagination="false"
+           :loading="loading"
+           :expandedRowKeys="expandedRowKeys"
+           :customRow="Rowclick"
+           :expandIcon="expandIcon"
+           :expandIconAsCell="false"
+           rowKey="key"
+           :data-source="tableList">
+    <!-- 额外的展开行 -->
+    <template #expandedRowRender="{ record }">
+      <BtnList :btnList="btnListData"
+               :record="record"
+               @click="openComponent" />
+    </template>
+    <template #username="{text, record }">
+      <span>{{record.userid + " " }}{{text}}</span>
+    </template>
+    <template #fixedprice="{record }">
+      <span>{{record.useorderpricerid }}</span>
+    </template>
+  </a-table>
+  <component :is="componentId"
+             v-if="componentId"
+             :selectedRow="selectedRow"
+             :buyOrSell="BuyOrSell.sell"
+             @cancel="closeComponent"></component>
 </template>
 
 <script lang="ts">
@@ -52,7 +49,7 @@ export default defineComponent({
     emits: ['cancel', 'openComponent'],
     name: 'warehouse_receipt_trade_price_delisting_sell',
     props: {
-        parantSelectedRow: {
+        selectedRow: {
             type: Object as PropType<WrOrderQuote>,
             default: {},
         },
@@ -78,7 +75,7 @@ export default defineComponent({
         const queryTableAction = () => {
             const param: WrTradeOrderDetailReq = {
                 buyorsell: 1,
-                goodsid: props.parantSelectedRow.goodsid,
+                goodsid: props.selectedRow.goodsid,
             };
             queryTable(queryWrTradeOrderDetail, param);
         };

+ 33 - 7
src/views/market/spot_trade/spot_trade_order_transaction/setup.ts

@@ -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' },
 ];

+ 54 - 5
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_basis_difference/index.vue

@@ -5,10 +5,51 @@
              class="srcollYTable"
              :scroll="{ x: '100%', y: 'calc(100vh - 479px)' }"
              :pagination="false"
+             :loading="loading"
              :expandedRowKeys="expandedRowKeys"
              :customRow="Rowclick"
-             rowKey="key"
-             :data-source="deliverGoods"></a-table>
+             rowKey="goodscode"
+             ref="tableRef"
+             :data-source="getQuoteList()">
+      <template #totalturnover="{ text }">
+        <span>{{changeUnit(text)}}</span>
+      </template>
+      <!-- 涨跌 -->
+      <template #change="{ record }">
+        <span>{{quoteChange(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 幅度 -->
+      <template #amplitude="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 振幅 -->
+      <template #vibration="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <template #index="{ index }">
+        <span>{{index + 1}}</span>
+      </template>
+      <!-- 买价 -->
+      <template #bid="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 卖价 -->
+      <template #ask="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最新价 -->
+      <template #last="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最低价 -->
+      <template #lowest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最高价 -->
+      <template #highest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+    </a-table>
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
                  @cancel="closeContext"
@@ -16,6 +57,7 @@
     <component :is="componentId"
                v-if="componentId"
                :selectedRow="selectedRow"
+               :deliverGoods="findDeilverGoodsByGoodsCode(selectedRow.goodscode)"
                @cancel="closeComponent"></component>
   </div>
 </template>
@@ -26,13 +68,14 @@ import { contextMenu, defineAsyncComponent, defineComponent } from '@/common/exp
 
 import { handleDeliveryRelation } from '../setup';
 
-import { handleSubcriteQuote } from '@/common/setup/table/tableQuote';
+import { handleSubcriteQuote, handleQuotePriceColor, quoteChange, quoteAmplitude, quoteAmplituOfVibration } from '@/common/setup/table/tableQuote';
 import { QueryDeliveryRelationRsp } from '@/services/go/delivery/interface';
 import { columnsList } from '../setup';
 
 import { handleTableEventAndData } from '@/common/setup/table/compose';
 import { TableParam } from '@/common/setup/table/interface';
 import { BtnListType } from '@/common/components/btnList/interface';
+import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
 export default defineComponent({
     name: EnumRouterName.spot_trade_order_transaction_basis_difference,
     components: {
@@ -52,14 +95,20 @@ export default defineComponent({
             { lable: '详情', code: 'Detail', className: 'btnDeafault' },
             { lable: '买卖大厅', code: 'BuyAndSell', className: 'btnDeafault' },
         ];
-        const { deliverGoods } = handleDeliveryRelation([2, 4]);
+        const { deliverGoods, getQuoteList, findDeilverGoodsByGoodsCode } = handleDeliveryRelation([2, 4]);
         // 行情按需订阅
         handleSubcriteQuote<QueryDeliveryRelationRsp>(deliverGoods);
 
         return {
-            ...handleTableEventAndData(param),
+            ...handleTableEventAndData<QueryQuoteDayRsp>(param),
             deliverGoods,
             btnList,
+            handleQuotePriceColor,
+            quoteChange,
+            quoteAmplitude,
+            quoteAmplituOfVibration,
+            getQuoteList,
+            findDeilverGoodsByGoodsCode,
         };
     },
 });

+ 54 - 5
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_listing_transfer/index.vue

@@ -5,10 +5,51 @@
              class="srcollYTable"
              :scroll="{ x: '100%', y: 'calc(100vh - 479px)' }"
              :pagination="false"
+             :loading="loading"
              :expandedRowKeys="expandedRowKeys"
              :customRow="Rowclick"
-             rowKey="key"
-             :data-source="deliverGoods"></a-table>
+             rowKey="goodscode"
+             ref="tableRef"
+             :data-source="getQuoteList()">
+      <template #totalturnover="{ text }">
+        <span>{{changeUnit(text)}}</span>
+      </template>
+      <!-- 涨跌 -->
+      <template #change="{ record }">
+        <span>{{quoteChange(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 幅度 -->
+      <template #amplitude="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <!-- 振幅 -->
+      <template #vibration="{ record }">
+        <span>{{quoteAmplituOfVibration(record, record.decimalplace)}}</span>
+      </template>
+      <template #index="{ index }">
+        <span>{{index + 1}}</span>
+      </template>
+      <!-- 买价 -->
+      <template #bid="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 卖价 -->
+      <template #ask="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最新价 -->
+      <template #last="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最低价 -->
+      <template #lowest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+      <!-- 最高价 -->
+      <template #highest="{ text, record }">
+        <span :class="handleQuotePriceColor(text, record.presettle)">{{text}}</span>
+      </template>
+    </a-table>
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
                  @cancel="closeContext"
@@ -16,6 +57,7 @@
     <component :is="componentId"
                v-if="componentId"
                :selectedRow="selectedRow"
+               :deliverGoods="findDeilverGoodsByGoodsCode(selectedRow.goodscode)"
                @cancel="closeComponent"></component>
   </div>
 </template>
@@ -26,13 +68,14 @@ import { contextMenu, defineAsyncComponent, defineComponent } from '@/common/exp
 
 import { handleDeliveryRelation } from '../setup';
 
-import { handleSubcriteQuote } from '@/common/setup/table/tableQuote';
+import { handleSubcriteQuote, handleQuotePriceColor, quoteChange, quoteAmplitude, quoteAmplituOfVibration } from '@/common/setup/table/tableQuote';
 import { QueryDeliveryRelationRsp } from '@/services/go/delivery/interface';
 import { columnsList } from '../setup';
 
 import { handleTableEventAndData } from '@/common/setup/table/compose';
 import { TableParam } from '@/common/setup/table/interface';
 import { BtnListType } from '@/common/components/btnList/interface';
+import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
 
 export default defineComponent({
     name: EnumRouterName.spot_trade_order_transaction_listing_transfer,
@@ -53,14 +96,20 @@ export default defineComponent({
             { lable: '详情', code: 'Detail', className: 'btnDeafault' },
             { lable: '买卖大厅', code: 'BuyAndSell', className: 'btnDeafault' },
         ];
-        const { deliverGoods } = handleDeliveryRelation([1, 3]);
+        const { deliverGoods, getQuoteList, findDeilverGoodsByGoodsCode } = handleDeliveryRelation([1, 3]);
         // 行情按需订阅
         handleSubcriteQuote<QueryDeliveryRelationRsp>(deliverGoods);
 
         return {
-            ...handleTableEventAndData(param),
+            ...handleTableEventAndData<QueryQuoteDayRsp>(param),
             deliverGoods,
             btnList,
+            handleQuotePriceColor,
+            quoteChange,
+            quoteAmplitude,
+            quoteAmplituOfVibration,
+            getQuoteList,
+            findDeilverGoodsByGoodsCode,
         };
     },
 });