|
|
@@ -151,25 +151,23 @@ 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 { getSelectedAccountId } from '@/services/bus/account';
|
|
|
import { getGoodsAgreeunitByGoodsCode, getGoodsByCode, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
|
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
|
-import { getMarketByTradeMode } from '@/services/bus/market';
|
|
|
+import { getMarketByTradeMode, getMarketIdsByTradeMode } from '@/services/bus/market';
|
|
|
+import { queryTradePosition } from '@/services/go/ermcp/order';
|
|
|
import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
|
|
|
-import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
|
|
|
-import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
|
+import { QueryTjmdTodayAccountMarginReq } from '@/services/go/Tjmd/interface';
|
|
|
import { diaoQiOrder } from '@/services/socket/order';
|
|
|
import { OrderReq } from '@/services/socket/order/interface';
|
|
|
import { MinusOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons-vue';
|
|
|
import moment from 'moment';
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
import { defineComponent, PropType, ref } from 'vue';
|
|
|
+import { RefGoodsList } from '../../interface';
|
|
|
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';
|
|
|
-import { getGoodsPrice } from '@/views/market/spot_trade/components/buy-sell-market/setup';
|
|
|
+import { handleForm, isFloat, useBuySellDirection, useNum, usePrice } from './setup';
|
|
|
|
|
|
export default defineComponent({
|
|
|
emits: ['cancel', 'update'],
|
|
|
@@ -186,8 +184,13 @@ export default defineComponent({
|
|
|
const { tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
|
|
|
queryTable(queryTradePosition);
|
|
|
|
|
|
+ const marginParam: QueryTjmdTodayAccountMarginReq = {
|
|
|
+ accountid: getSelectedAccountId()!.toString(),
|
|
|
+ goodsid: props.selectedRow.goodsid,
|
|
|
+ marketids: getMarketIdsByTradeMode(TradeMode.DiaoQi),
|
|
|
+ };
|
|
|
// 获取保证金比例
|
|
|
- const { getReckonMarginTypeAndValueByTradeMode } = useTodayMargin();
|
|
|
+ const { getReckonMarginTypeAndValueByTradeMode } = useTodayMargin(marginParam);
|
|
|
// 控制弹窗
|
|
|
const { visible, cancel } = _closeModal(context);
|
|
|
// 表单
|
|
|
@@ -228,17 +231,19 @@ export default defineComponent({
|
|
|
// 最大数量
|
|
|
const getMaxNum = () => {
|
|
|
let result = 0;
|
|
|
+ const goodscode = props.selectedRow.goodscode;
|
|
|
const [marginType, marginValue] = getReckonMarginTypeAndValueByTradeMode(TradeMode.DiaoQi);
|
|
|
// 可用资金
|
|
|
const temp = +canUseMoney();
|
|
|
const money = temp > 0 ? temp : 0;
|
|
|
- if (marginType && money && formState.FixedPrice) {
|
|
|
+ const price = isFloat() ? getQuoteDayInfoByCodeFindPrice(goodscode) : formState.FixedPrice;
|
|
|
+ if (marginType && money && price && price !== '--') {
|
|
|
// 保证金方式 1:比率 2:固定
|
|
|
if (marginType === 1) {
|
|
|
// 合约单位
|
|
|
- const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
|
|
|
+ const agreeunit = getGoodsAgreeunitByGoodsCode(goodscode);
|
|
|
// 最大可挂牌数量=可用/(价格*合约单位*保证金比例
|
|
|
- result = money / (((formState.FixedPrice * marginValue) / 100) * agreeunit);
|
|
|
+ result = money / (((+price * marginValue) / 100) * agreeunit);
|
|
|
} else {
|
|
|
// 最大可挂牌数量=可用/保证金固定值
|
|
|
result = money / marginValue;
|
|
|
@@ -325,7 +330,7 @@ export default defineComponent({
|
|
|
canUseMoney,
|
|
|
accountList,
|
|
|
...usePrice(),
|
|
|
- ...useNum(),
|
|
|
+ ...useNum(getMaxNum),
|
|
|
getPrice,
|
|
|
};
|
|
|
},
|