huangbin 4 years ago
parent
commit
761d81000b

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

@@ -20,15 +20,13 @@
 
 
 <script lang="ts">
 <script lang="ts">
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, ModalEnum, queryTableList } from '@/common/export/commonTable';
+import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, queryTableList } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
 import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
 import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
 import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
 import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
-import { defineAsyncComponent, PropType, ref } from 'vue';
+import { PropType } from 'vue';
 import { BtnList as btnListType } from '@/common/components/btnList/interface';
 import { BtnList as btnListType } from '@/common/components/btnList/interface';
-import { handleModalComponent } from '@/common/setup/asyncComponent';
-import { getWrPriceAndHaswrType } from '../../setup';
+import { getBuyMarketParam } from '../../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     emits: ['cancel', 'openComponent'],
     emits: ['cancel', 'openComponent'],
@@ -56,9 +54,9 @@ export default defineComponent({
         function open(item: btnListType) {
         function open(item: btnListType) {
             context.emit('openComponent', item);
             context.emit('openComponent', item);
         }
         }
+        const { wrpricetype, haswr, tableKey } = getBuyMarketParam(props.enumName);
         // 获取列表数据
         // 获取列表数据
         const queryTableAction = () => {
         const queryTableAction = () => {
-            const { wrpricetype, haswr } = getWrPriceAndHaswrType(props.enumName);
             const param: QueryOrderQuoteDetailReq = {
             const param: QueryOrderQuoteDetailReq = {
                 buyorsell: 0,
                 buyorsell: 0,
                 wrpricetype,
                 wrpricetype,
@@ -72,7 +70,7 @@ export default defineComponent({
         const param: ComposeTableParam = {
         const param: ComposeTableParam = {
             queryFn: queryTableAction,
             queryFn: queryTableAction,
             menuType: props.enumName,
             menuType: props.enumName,
-            tableName: 'table_pcweb_agreement',
+            tableName: tableKey,
             tableFilterKey: [],
             tableFilterKey: [],
             isDetail: false,
             isDetail: false,
         };
         };

+ 18 - 11
src/views/market/spot_trade/components/buy-sell-market/components/sell/index.vue

@@ -21,13 +21,13 @@
 
 
 <script lang="ts">
 <script lang="ts">
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, ModalEnum, queryTableList } from '@/common/export/commonTable';
+import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, queryTableList } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
 import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
 import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
-import { QueryOrderQuoteDetailReq, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
-import { defineAsyncComponent, PropType } from 'vue';
+import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
+import { PropType } from 'vue';
 import { BtnList as btnListType } from '@/common/components/btnList/interface';
 import { BtnList as btnListType } from '@/common/components/btnList/interface';
+import { getSellMarketParam } from '../../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     emits: ['cancel', 'openComponent'],
     emits: ['cancel', 'openComponent'],
@@ -41,6 +41,10 @@ export default defineComponent({
             default: [],
             default: [],
             type: Array as PropType<btnListType[]>,
             type: Array as PropType<btnListType[]>,
         },
         },
+        selectedRow: {
+            type: Object as PropType<WrOrderQuote>,
+            default: {},
+        },
     },
     },
     components: {
     components: {
         BtnList,
         BtnList,
@@ -51,20 +55,23 @@ export default defineComponent({
         function open(item: btnListType) {
         function open(item: btnListType) {
             context.emit('openComponent', item);
             context.emit('openComponent', item);
         }
         }
+        const { wrpricetype, haswr, tableKey } = getSellMarketParam(props.enumName);
         // 获取列表数据
         // 获取列表数据
         const queryTableAction = () => {
         const queryTableAction = () => {
-            // const param: QueryOrderQuoteReq = {
-            //     wrpricetype: 2,
-            //     haswr: 1,
-            // };
-            // queryTable(queryOrderQuote, param);
-            queryTable(queryAgreementConfig);
+            const param: QueryOrderQuoteDetailReq = {
+                buyorsell: 1,
+                wrpricetype,
+                haswr,
+                wrfactortypeid: props.selectedRow.wrfactortypeid,
+                goodsid: props.selectedRow.goodsid,
+            };
+            queryTable(queryOrderQuoteDetail, param);
         };
         };
         // 表格通用逻辑
         // 表格通用逻辑
         const param: ComposeTableParam = {
         const param: ComposeTableParam = {
             queryFn: queryTableAction,
             queryFn: queryTableAction,
             menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
             menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
-            tableName: 'table_pcweb_agreement',
+            tableName: tableKey,
             tableFilterKey: [],
             tableFilterKey: [],
             isDetail: false,
             isDetail: false,
         };
         };

+ 35 - 10
src/views/market/spot_trade/components/buy-sell-market/setup.ts

@@ -17,33 +17,58 @@ export function handleBuyAndSellList<T>(menuType: EnumRouterName, isDetail: bool
     }
     }
 }
 }
 
 
-// 获取 wrpricetype haswr
-export function getWrPriceAndHaswrType(enumName: EnumRouterName) {
-    let wrpricetype = 1, haswr = 0;
+// 根据 当前tab 的枚举,获取买大厅对应的 wrpricetype haswr tableKey
+export function getBuyMarketParam(enumName: EnumRouterName) {
+    let wrpricetype = 1, haswr = 0, tableKey: keyof TableKey = 'table_pcweb_spot_trade_warehouse_price_trading_hall_buy'
     switch (enumName) {
     switch (enumName) {
         case EnumRouterName.warehouse_receipt_trade_price:
         case EnumRouterName.warehouse_receipt_trade_price:
             wrpricetype = 1;
             wrpricetype = 1;
             haswr = 1
             haswr = 1
+            tableKey = 'table_pcweb_spot_trade_warehouse_price_trading_hall_buy'
             break
             break
         case EnumRouterName.warehouse_receipt_trade_floating_price:
         case EnumRouterName.warehouse_receipt_trade_floating_price:
             wrpricetype = 2;
             wrpricetype = 2;
             haswr = 1
             haswr = 1
+            tableKey = 'table_pcweb_spot_trade_warehouse_float_trading_hall_buy'
             break
             break
         case EnumRouterName.warehouse_pre_sale_price:
         case EnumRouterName.warehouse_pre_sale_price:
             wrpricetype = 1;
             wrpricetype = 1;
             haswr = 0
             haswr = 0
+            tableKey = 'table_pcweb_spot_trade_warehouse_presale_price_trading_hall_buy'
             break
             break
         case EnumRouterName.warehouse_pre_sale_floating_price:
         case EnumRouterName.warehouse_pre_sale_floating_price:
             wrpricetype = 2;
             wrpricetype = 2;
             haswr = 0
             haswr = 0
+            tableKey = 'table_pcweb_spot_trade_warehouse_presale_float_trading_hall_buy'
             break
             break
     }
     }
-    return { wrpricetype, haswr }
+    return { wrpricetype, haswr, tableKey }
 }
 }
 
 
-export function getBuyMarketTableKey(enumName: EnumRouterName) {
-    const result = 'table_pcweb_spot_trade_warehouse_price_trading_hall_buy'
-    // switch(enumName) {
-    //     case
-    // }
-}
+// 根据 当前tab 的枚举,获取卖大厅对应的 wrpricetype haswr tableKey
+export function getSellMarketParam(enumName: EnumRouterName) {
+    let wrpricetype = 1, haswr = 0, tableKey: keyof TableKey = 'table_pcweb_spot_trade_warehouse_price_trading_hall_sale'
+    switch (enumName) {
+        case EnumRouterName.warehouse_receipt_trade_price:
+            wrpricetype = 1;
+            haswr = 1
+            tableKey = 'table_pcweb_spot_trade_warehouse_price_trading_hall_sale'
+            break
+        case EnumRouterName.warehouse_receipt_trade_floating_price:
+            wrpricetype = 2;
+            haswr = 1
+            tableKey = 'table_pcweb_spot_trade_warehouse_float_trading_hall_sale'
+            break
+        case EnumRouterName.warehouse_pre_sale_price:
+            wrpricetype = 1;
+            haswr = 0
+            tableKey = 'table_pcweb_spot_trade_warehouse_presale_price_trading_hall_sale'
+            break
+        case EnumRouterName.warehouse_pre_sale_floating_price:
+            wrpricetype = 2;
+            haswr = 0
+            tableKey = 'table_pcweb_spot_trade_warehouse_presale_float_trading_hall_sale'
+            break
+    }
+    return { wrpricetype, haswr, tableKey }
+}