huangbin 4 年之前
父节点
当前提交
0a9625900f

+ 52 - 45
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/buy-sell-market/index.vue

@@ -1,50 +1,56 @@
 <template>
-    <!-- 买卖大厅 -->
-    <div class="buy-sell-market">
-        <div class="buy-sell-market-title">
-            <a class="backIcon" @click="cancel">
-                <LeftOutlined />
-            </a>
-            <div class="titleBtn">
-                <div class="name">{{selectedRow.goodsname}}</div>
-                <div class="arrowRightIcon"></div>
-            </div>
-            <div class="priceBar bdf1 ml20">
-                <div class="greenBar">
-                    <div class="numBlock">
-                        <div class="first">卖量</div>
-                        <div class="last green">{{selectedRow.sellqty}}</div>
-                    </div>
-                    <div class="numBlock">
-                        <div class="first">买量</div>
-                        <div class="last white">{{selectedRow.buyqty}}</div>
-                    </div>
-                </div>
-            </div>
-            <!-- 历史走势按钮 -->
-            <a-button class="historyBtn" @click="openComponent({code: 'HisChart'})">
-                历史走势
-                <LineChartOutlined />
-            </a-button>
-            <BtnList :btnList="firstBtn" :record="selectedRow" @click="openComponent" />
+  <!-- 买卖大厅 -->
+  <div class="buy-sell-market">
+    <div class="buy-sell-market-title">
+      <a class="backIcon"
+         @click="cancel">
+        <LeftOutlined />
+      </a>
+      <div class="titleBtn">
+        <div class="name">{{selectedRow.goodsname}}</div>
+        <div class="arrowRightIcon"></div>
+      </div>
+      <div class="priceBar bdf1 ml20">
+        <div class="greenBar">
+          <div class="numBlock">
+            <div class="first">卖量</div>
+            <div class="last green">{{selectedRow.sellqty}}</div>
+          </div>
+          <div class="numBlock">
+            <div class="first">买量</div>
+            <div class="last white">{{selectedRow.buyqty}}</div>
+          </div>
         </div>
-        <a-row class="buySellHall">
-            <a-col :span="12">
-                <Sell :enumName="enumName" ref="sellRef" :parantSelectedRow="selectedRow" />
-            </a-col>
-            <a-col :span="12">
-                <Buy :enumName="enumName" ref="buyRef" :parantSelectedRow="selectedRow" />
-            </a-col>
-        </a-row>
-        <component
-            :is="componentId"
-            v-if="componentId"
-            :selectedRow="selectedRow"
-            :goodsPrice="getGoodsPrice()"
-            :enumName="enumName"
-            @cancel="closeComponent"
-        ></component>
+      </div>
+      <!-- 历史走势按钮 -->
+      <a-button class="historyBtn"
+                @click="openComponent({code: 'HisChart'})">
+        历史走势
+        <LineChartOutlined />
+      </a-button>
+      <BtnList :btnList="firstBtn"
+               :record="selectedRow"
+               @click="openComponent" />
     </div>
+    <a-row class="buySellHall">
+      <a-col :span="12">
+        <Sell :enumName="enumName"
+              ref="sellRef"
+              :parantSelectedRow="selectedRow" />
+      </a-col>
+      <a-col :span="12">
+        <Buy :enumName="enumName"
+             ref="buyRef"
+             :parantSelectedRow="selectedRow" />
+      </a-col>
+    </a-row>
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               :goodsPrice="getGoodsPrice()"
+               :enumName="enumName"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 
 <script lang="ts">
@@ -67,13 +73,14 @@ import { BtnListType } from '@/common/components/btnList/interface';
 import moment, { Moment } from 'moment';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { getBtnList } from '../../setup';
+import { RefGoodsList } from '../../interface';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
     name: 'buy-sell-market',
     props: {
         selectedRow: {
-            type: Object as PropType<WrOrderQuote>,
+            type: Object as PropType<RefGoodsList>,
             default: {},
         },
         enumName: {

+ 21 - 11
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/post_buying/index.vue

@@ -147,12 +147,14 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
 import { useTaAccount } from '@/common/setup/account';
 import { validateAction } from '@/common/setup/form';
 import { _closeModal } from '@/common/setup/modal/modal';
+import { queryTableList } from '@/common/setup/table';
 import { useListingTradeNumAndPrice } from '@/common/setup/trade';
 import { ListingTradeNumAndPrice } from '@/common/setup/trade/interface';
 import { useTodayMargin } from '@/hooks/margin';
 import { getGoodsAgreeunitByGoodsCode, getGoodsByCode, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
 import { geLoginID_number } from '@/services/bus/login';
 import { getMarketByTradeMode } from '@/services/bus/market';
+import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
 import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
 import { diaoQiOrder } from '@/services/socket/order';
@@ -164,6 +166,9 @@ import { defineComponent, PropType, ref } from 'vue';
 import { useUserType } from '../setup';
 import { FormParam } from './interface';
 import { handleForm, isFloat, useBuySellDirection, usePrice, useNum } from './setup';
+import { queryTradePosition } from '@/services/go/ermcp/order';
+import { WrOrderQuote } from '@/services/go/wrtrade/interface';
+import { RefGoodsList } from '../../interface';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
@@ -171,15 +176,15 @@ export default defineComponent({
     components: { Des, Drawer, PlusOutlined, MinusOutlined, SwapOutlined },
     props: {
         selectedRow: {
-            type: Object as PropType<QueryQuoteDayRsp>,
+            type: Object as PropType<RefGoodsList>,
             default: {},
         },
-        refGoods: {
-            type: Object as PropType<QueryQuoteGoodsListRsp[]>,
-            default: [],
-        },
     },
     setup(props, context) {
+        // 查询 我的 持仓
+        const { tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
+        queryTable(queryTradePosition);
+
         // 获取保证金比例
         const { getReckonMarginValueByTradeMode } = useTodayMargin();
         // 控制弹窗
@@ -207,13 +212,18 @@ export default defineComponent({
         // 最大数量
         const getMaxNum = () => {
             let result = 0;
-            // 可用资金
-            const temp = +canUseMoney();
+            if (isBuy()) {
+                // 可用资金
+                const temp = +canUseMoney();
 
-            const money = temp > 0 ? temp : 0;
-            const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
-            if (money && formState.FixedPrice) {
-                result = +(money / (formState.FixedPrice * agreeunit)).toFixed(0);
+                const money = temp > 0 ? temp : 0;
+                const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
+                if (money && formState.FixedPrice) {
+                    result = +(money / (formState.FixedPrice * agreeunit)).toFixed(0);
+                }
+            } else {
+                const temp = tableList.value.find((el) => el.goodscode === props.selectedRow.goodscode)?.enableqty;
+                result = temp ? temp : 0;
             }
             return result;
         };

+ 1 - 0
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/interface.ts

@@ -3,4 +3,5 @@ import { QueryQuoteDayRsp } from "@/services/go/quote/interface";
 export interface RefGoodsList extends QueryQuoteDayRsp {
     refgoodsname: string
     goodsname: string
+    orderid: number
 }