huangbin 4 anni fa
parent
commit
679862f694

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

@@ -22,6 +22,9 @@
     <template #username="{text, record }">
       <span>{{record.userid + " "}}{{text}}</span>
     </template>
+    <template #orderprice="{ record }">
+      <span>{{getBuyOrSellMarketPrice(record, parantSelectedRow)}}</span>
+    </template>
   </a-table>
   <component :is="componentId"
              v-if="componentId"
@@ -50,8 +53,9 @@ import { queryTjmdTradeOrderDetail } from '@/services/go/Tjmd';
 import { QueryTjmdTradeOrderDetailReq, QueryTjmdTradeOrderDetailRsp } from '@/services/go/Tjmd/interface';
 import { getUserId } from '@/services/bus/account';
 import { getUserAccountType } from '@/services/bus/user';
-import { useBuyOrSellBtnList } from '../setup';
+import { useBuyOrSellBtnList, getBuyOrSellMarketPrice } from '../setup';
 import { findItemGoods } from '../../setup';
+import { RefGoodsList } from '../../interface';
 
 const columns = [
     {
@@ -104,7 +108,7 @@ export default defineComponent({
             type: String as PropType<EnumRouterName>,
         },
         parantSelectedRow: {
-            type: Object as PropType<WrOrderQuote>,
+            type: Object as PropType<RefGoodsList>,
             default: {},
         },
     },
@@ -145,6 +149,7 @@ export default defineComponent({
             expandIcon,
             btnList: useBuyOrSellBtnList(),
             columns,
+            getBuyOrSellMarketPrice,
         };
     },
 });

+ 7 - 2
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/sell/index.vue

@@ -17,6 +17,9 @@
                :record="record"
                @click="openComponent" />
     </template>
+    <template #orderprice="{ record }">
+      <span>{{getBuyOrSellMarketPrice(record, parantSelectedRow)}}</span>
+    </template>
     <template #username="{text, record }">
       <span>{{record.userid + " " }}{{text}}</span>
     </template>
@@ -44,12 +47,13 @@ import { ColumnType } from '@/common/methods/table/interface';
 import { Moment } from 'moment';
 import moment from 'moment';
 import { getShowBottomValue } from '@/common/config/constrolBottom';
-import { useBuyOrSellBtnList } from '../setup';
+import { useBuyOrSellBtnList, getBuyOrSellMarketPrice } from '../setup';
 import { getUserId } from '@/services/bus/account';
 import { getUserAccountType } from '@/services/bus/user';
 import { queryTjmdTradeOrderDetail } from '@/services/go/Tjmd';
 import { QueryTjmdTradeOrderDetailReq } from '@/services/go/Tjmd/interface';
 import { findItemGoods } from '../../setup';
+import { RefGoodsList } from '../../interface';
 
 const columns = [
     {
@@ -102,7 +106,7 @@ export default defineComponent({
             type: String as PropType<EnumRouterName>,
         },
         parantSelectedRow: {
-            type: Object as PropType<WrOrderQuote>,
+            type: Object as PropType<RefGoodsList>,
             default: {},
         },
     },
@@ -155,6 +159,7 @@ export default defineComponent({
             handleColumn,
             btnList: useBuyOrSellBtnList(),
             columns,
+            getBuyOrSellMarketPrice,
         };
     },
 });

+ 17 - 0
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/setup.ts

@@ -1,8 +1,11 @@
 import { BtnListType } from "@/common/components/btnList/interface";
 import { UserType } from "@/common/constants/enumCommon";
 import { getAccountTypeList, getCanUseMoney } from "@/services/bus/account";
+import { getGoodsByCode, getQuoteDayInfoByCodeFindPrice } from "@/services/bus/goods";
 import { getUserAccountType } from "@/services/bus/user";
+import { QueryTjmdTradeOrderDetailRsp } from "@/services/go/Tjmd/interface";
 import { UnwrapRef } from "vue";
+import { RefGoodsList } from "../interface";
 
 // 获取按钮列表
 export function useBuyOrSellBtnList() {
@@ -50,3 +53,17 @@ export function useBlocksAccount<T extends { accountid: number | undefined }>(fo
     return { handleSelectedAccount, canUseMoney, getSelectedAccount, accountList };
 }
 
+// 获取买卖大厅的价格,如果是浮动价的时候,取行情最新价格价基差
+export function getBuyOrSellMarketPrice(record: QueryTjmdTradeOrderDetailRsp, selectedRow: RefGoodsList) {
+    let result = record.orderprice
+    // 浮动价
+    if (record.pricemode === 3) {
+        const price = getQuoteDayInfoByCodeFindPrice(selectedRow.refgoodscode);
+        const goods = getGoodsByCode(selectedRow.refgoodscode)?.decimalplace || 2
+        if (price && price !== '--') {
+            // 浮动价
+            result = +(+price + record.marketmaxsub).toFixed(goods);
+        }
+    }
+    return result
+}