huangbin 4 년 전
부모
커밋
a2c1b5859c

+ 2 - 1
src/views/market/spot_trade/setup.ts

@@ -163,4 +163,5 @@ export function handleWarehouse() {
         }
     })
     return { warehouseList }
-}
+}
+

+ 70 - 0
src/views/market/spot_trade/spot_trade_order_transaction/setup.ts

@@ -0,0 +1,70 @@
+import { TradeMode } from "@/common/constants/enumCommon"
+import { getMarketByTradeMode } from "@/services/bus/market"
+import { queryDeliveryRelation } from "@/services/go/delivery"
+import { QueryDeliveryRelationRsp } from "@/services/go/delivery/interface"
+import { ref } from "vue"
+
+// 获取交个商品
+const allDeliverGoods = ref<QueryDeliveryRelationRsp[]>([])
+type deliverytype = 1 | 2 | 3 | 4
+// 1和3是订单交易 挂牌转让
+// 2和4是基差点价
+export function handleDeliveryRelation(param: deliverytype[]) {
+    const deliverGoods = ref<any[]>([])
+    // 查询交割商品
+    function queryAction() {
+        const marketid = getMarketByTradeMode(TradeMode.ListingAndSelection)!.marketid
+        queryDeliveryRelation({ marketid }).then(res => {
+            allDeliverGoods.value = res
+            deliverGoods.value = getDeliverGoods()
+        })
+    }
+    function getDeliverGoods() {
+        return allDeliverGoods.value.filter(e => param.includes(e.deliverytype as deliverytype))
+    }
+    // initData(() => {
+    //     if (allDeliverGoods.value.length === 0) {
+    //         // 从服务交割商品
+    //         queryAction()
+    //     } else {
+    //         // 从缓存中获取交割商品
+    //         deliverGoods.value = getDeliverGoods()
+    //     }
+    // })
+    // 更新交割商品
+    function updateGeliverGoods() {
+        queryAction()
+    }
+    deliverGoods.value.length = 0
+    for (let i = 0; i < 200; i++) {
+        const obj = {
+            wrfactortypeid: '2121628355212000001',
+            buyprice: 1000,
+            buyqty: 1,
+            sellprice: 1,
+            sellqty: 1,
+            wrfactortypename: '广州一号仓,广州铜,优,广州',
+            deliverygoodsid: 1,
+            wrstandardid: 1,
+            warehouseid: 2,
+            deliverygoodsname: '铜',
+            deliverygoodscode: 'CU',
+            warehousename: '广州一号仓',
+            warehousecode: 'GZ0001',
+            wrstandardname: '广州黄铜',
+            wrstandardcode: 'CU',
+            wrgoodsname: '广州黄铜-广州铜-优-广州',
+            buypricemove: 0,
+            sellpricemove: 0,
+            goodsid: 0,
+            goodscode: '--',
+            deliverymonth: '0',
+            enumdicname: '吨',
+            minivalue: 1,
+            key: `${i}`,
+        }
+        deliverGoods.value.push(obj)
+    }
+
+    return { deliverGoods, updateGeliverGoods }
+}

+ 9 - 47
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_basis_difference/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 仓单贸易 一口价挂牌-->
+  <!--订单交易 基差点价-->
   <div class="topTableHeight">
     <a-table :columns="columns"
              class="srcollYTable"
@@ -9,7 +9,7 @@
              :expandedRowKeys="expandedRowKeys"
              :customRow="Rowclick"
              rowKey="key"
-             :data-source="tableList"></a-table>
+             :data-source="deliverGoods"></a-table>
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
                  @cancel="closeContext"
@@ -30,6 +30,7 @@ import { queryOrderQuote } from '@/services/go/wrtrade';
 import { handleComposeTable } from '@/views/market/spot_trade/setup';
 import Bus from '@/utils/eventBus/index';
 import Filter from '../../components/filter/index.vue';
+import { handleDeliveryRelation } from '../setup';
 
 export default defineComponent({
     name: EnumRouterName.spot_trade_order_transaction_basis_difference,
@@ -37,12 +38,13 @@ export default defineComponent({
         contextMenu,
         // [ModalEnum.spot_trade_warehouse_detail]: defineAsyncComponent(() => import('../../components/detail/index.vue')),
         // [ModalEnum.spot_trade_warehouse_post_buying]: defineAsyncComponent(() => import('../../components/post_buying/index.vue')),
-        // buyAndSell: defineAsyncComponent(() => import('../../components/buy-sell-market/index.vue')),
+        buyAndSell: defineAsyncComponent(() => import('../components/buy-sell-market/index.vue')),
         // postBuying: defineAsyncComponent(() => import('../../components/post_buying/index.vue')),
     },
     setup() {
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
+        const { deliverGoods } = handleDeliveryRelation([2, 4]);
         // 获取列表数据
         const queryTableAction = () => {
             const param: QueryOrderQuoteReq = {
@@ -55,55 +57,15 @@ export default defineComponent({
         const param: ComposeTableParam = {
             queryFn: queryTableAction,
             menuType: EnumRouterName.warehouse_receipt_trade_price,
-            tableName: 'table_pcweb_financing_manage_order_transaction',
+            tableName: 'table_pcweb_spot_trade_warehouse_price',
             tableFilterKey: [],
             isDetail: false,
         };
-        const {
-            contextMenu,
-            openContext,
-            closeContext, // 右键
-            columns,
-            registerColumn,
-            updateColumn, // 表头
-            expandedRowKeys,
-            selectedRow,
-            Rowclick, // 表格折腾面板数据与单击、双击事件
-            componentId,
-            closeComponent, // 控制异步组件
-            firstBtn, // 表格按钮
-        } = handleComposeTable<WrOrderQuote>(param);
-        function search(value: Object) {
-            const param: QueryOrderQuoteReq = {
-                wrpricetype: 1,
-                haswr: 1,
-            };
-            Object.assign(param, value);
-            queryTable(queryOrderQuote, param);
-        }
-        function buyOpen(value: any, goods: any) {
-            componentId.value = 'postBuying';
-            selectedRow.value = value;
-        }
-
         return {
-            contextMenu,
-            openContext,
-            closeContext, // 右键
-            columns,
-            registerColumn,
-            updateColumn, // 表头
-            expandedRowKeys,
-            selectedRow,
-            Rowclick, // 表格折腾面板数据与单击、双击事件
-            componentId,
-            closeComponent, // 控制异步组件
-            firstBtn, // 表格按钮
-            name: EnumRouterName.warehouse_receipt_trade_price,
+            ...handleComposeTable<WrOrderQuote>(param),
             loading,
-            tableList,
-            search,
-            buyOpen,
+            // tableList,
+            deliverGoods,
         };
     },
 });

+ 22 - 2
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_listing_transfer/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 仓单贸易 一口价挂牌-->
+  <!--订单交易 挂牌转让-->
   <div class="topTableHeight">
     <a-table :columns="columns"
              class="srcollYTable"
@@ -9,7 +9,8 @@
              :expandedRowKeys="expandedRowKeys"
              :customRow="Rowclick"
              rowKey="key"
-             :data-source="tableList"></a-table>
+             ref="tableRef"
+             :data-source="deliverGoods"></a-table>
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
                  @cancel="closeContext"
@@ -30,6 +31,9 @@ import { queryOrderQuote } from '@/services/go/wrtrade';
 import { handleComposeTable } from '@/views/market/spot_trade/setup';
 import Bus from '@/utils/eventBus/index';
 import Filter from '../../components/filter/index.vue';
+import { handleDeliveryRelation } from '../setup';
+import { ref } from 'vue';
+import { onMounted } from '@vue/runtime-core';
 
 export default defineComponent({
     name: EnumRouterName.spot_trade_order_transaction_listing_transfer,
@@ -43,6 +47,20 @@ export default defineComponent({
     setup() {
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
+        const tableRef = ref<any>(null);
+        onMounted(() => {
+            // tableRef.value!.srcollYTable.addEventListener('sroll', (event: Event) => {
+            //     console.log('======='), event;
+            // });
+            console.log('document.querySelector)', document.querySelector('.ant-table-body'));
+            document.querySelector('.ant-table-body')!.addEventListener('sroll', (event: Event) => {
+                console.log('======='), event;
+            });
+        });
+        const { deliverGoods } = handleDeliveryRelation([1, 3]);
+        window.addEventListener('srcol', () => {
+            console.log('=======');
+        });
         // 获取列表数据
         const queryTableAction = () => {
             const param: QueryOrderQuoteReq = {
@@ -63,6 +81,8 @@ export default defineComponent({
             ...handleComposeTable<WrOrderQuote>(param),
             loading,
             tableList,
+            deliverGoods,
+            tableRef,
         };
     },
 });