|
|
@@ -24,8 +24,8 @@
|
|
|
<!-- 限价可修改 -->
|
|
|
<template v-if="selectedPriceType === 3">
|
|
|
<a-input-number class="commonInput" v-model:value="formData.OrderPrice" style="width:100%" />
|
|
|
- <MinusOutlined />
|
|
|
- <PlusOutlined />
|
|
|
+ <!-- <MinusOutlined />
|
|
|
+ <PlusOutlined /> -->
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<a-input-number class="commonInput" :value="selectedGoods.last" style="width:100%" disabled />
|
|
|
@@ -78,7 +78,6 @@ import { validateAction } from '@/common/setup/form';
|
|
|
import { GoodsQuote } from '@/services/go/ermcp/goodsInfo/interface';
|
|
|
import { getGoodsQuoteList } from '@/services/bus/goods';
|
|
|
import { getColumns } from '@/views/order/futures_information/components/futures_information_position/columns';
|
|
|
-import { QueryErmcpTradePositionRsp } from '@/services/go/ermcp/futures/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
|
export default defineComponent({
|
|
|
@@ -112,6 +111,13 @@ export default defineComponent({
|
|
|
const selectedRowKeys = ref<number[]>([]);
|
|
|
const onSelectChange = (keys: number[]) => {
|
|
|
selectedRowKeys.value = keys;
|
|
|
+ // 选中的单据数据
|
|
|
+ const { enableqty, positionaverageprice } = positionList.value[keys[0]];
|
|
|
+ formData.OrderPrice = positionaverageprice;
|
|
|
+ formData.OrderQty = enableqty;
|
|
|
+
|
|
|
+ // 限价
|
|
|
+ selectedPriceType.value = 3;
|
|
|
};
|
|
|
|
|
|
// 持仓列表
|
|
|
@@ -146,19 +152,6 @@ export default defineComponent({
|
|
|
const buyPrice = computed(() => getPrice(BuyOrSell.buy));
|
|
|
// 卖价
|
|
|
const sellPrice = computed(() => getPrice(BuyOrSell.sell));
|
|
|
-
|
|
|
- // 减少交易数量
|
|
|
- function minusQty() {
|
|
|
- if (formData.OrderQty > 1) {
|
|
|
- formData.OrderQty--;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 增加交易数量
|
|
|
- function plusQty() {
|
|
|
- formData.OrderQty++;
|
|
|
- }
|
|
|
-
|
|
|
// 根据买卖方向返回价格
|
|
|
function getPrice(direction: BuyOrSell): number {
|
|
|
const { last, bid, ask, decimalplace, quoteminunit } = selectedGoods.value;
|
|
|
@@ -196,6 +189,8 @@ export default defineComponent({
|
|
|
|
|
|
// 选择商品合约
|
|
|
function goodsChange(id: number) {
|
|
|
+ formData.OrderPrice = 0;
|
|
|
+ formData.OrderQty = 1;
|
|
|
selectedRowKeys.value = [];
|
|
|
selectedGoods.value = getGoods(id);
|
|
|
}
|
|
|
@@ -210,16 +205,22 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 减少交易数量
|
|
|
+ function minusQty() {
|
|
|
+ if (formData.OrderQty > 1) {
|
|
|
+ formData.OrderQty--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 增加交易数量
|
|
|
+ function plusQty() {
|
|
|
+ formData.OrderQty++;
|
|
|
+ }
|
|
|
+
|
|
|
function submit(submitType: 'buy' | 'sell' | 'close') {
|
|
|
let successMsg = '成功';
|
|
|
let failMsg = '失败';
|
|
|
|
|
|
- const positionIndex = selectedRowKeys.value[0]; // 选中的表格单据索引
|
|
|
- if (submitType === 'close' && positionIndex === undefined) {
|
|
|
- message.error('请选择需要平仓的单据');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
// 按钮提交类型
|
|
|
switch (submitType) {
|
|
|
case 'buy': {
|
|
|
@@ -242,19 +243,29 @@ export default defineComponent({
|
|
|
successMsg = '平仓成功';
|
|
|
failMsg = '平仓失败';
|
|
|
|
|
|
- const { outerdealmode, bid, ask } = selectedGoods.value!;
|
|
|
- const { curtdpositionenabled, buyorsell } = positionList.value[positionIndex];
|
|
|
+ const positionIndex = selectedRowKeys.value[0]; // 选中的单据索引
|
|
|
+ if (positionIndex === undefined) {
|
|
|
+ message.error('请选择需要平仓的单据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 选中的单据数据
|
|
|
+ const { curpositionqty, curtdpositionenabled, buyorsell } = positionList.value[positionIndex];
|
|
|
+
|
|
|
+ // 判断平仓数量
|
|
|
+ if (formData.OrderQty > curpositionqty) {
|
|
|
+ message.error('交易数量不能大于可用持仓数量');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
formData.BuyOrSell = buyorsell === BuyOrSell.buy ? BuyOrSell.sell : BuyOrSell.buy; // 如果单据方向是买,平仓方向就是卖,如果是卖,平仓方向就是买
|
|
|
formData.ChannelBuildType = BuildType.close;
|
|
|
- formData.OrderPrice = buyorsell ? ask : bid;
|
|
|
- formData.CloseTodayQty = curtdpositionenabled;
|
|
|
|
|
|
const account = accountList.find((el) => el.accountid === formData.AccountID)!;
|
|
|
// 判断是否母账号
|
|
|
if (account.ismain) {
|
|
|
- if (formData.ChannelBuildType === BuildType.close && outerdealmode === 3) {
|
|
|
- formData.CloseTodayQty = 1;
|
|
|
+ if (selectedGoods.value.outerdealmode === 3 && curtdpositionenabled > 0) {
|
|
|
+ formData.CloseTodayQty = curtdpositionenabled;
|
|
|
}
|
|
|
}
|
|
|
break;
|