|
@@ -5,9 +5,12 @@
|
|
|
<div class="futures_trade__left">
|
|
<div class="futures_trade__left">
|
|
|
<div class="futures_trade__form">
|
|
<div class="futures_trade__form">
|
|
|
<a-form class="inlineForm" ref="formRef" :model="formData" :rules="rules">
|
|
<a-form class="inlineForm" ref="formRef" :model="formData" :rules="rules">
|
|
|
|
|
+ <a-form-item label="现货合同" v-if="isHedging">
|
|
|
|
|
+ <span class="white">{{ selectedRow.spotcontractid }}</span>
|
|
|
|
|
+ </a-form-item>
|
|
|
<a-form-item label="账号">
|
|
<a-form-item label="账号">
|
|
|
- <a-select class="inlineFormSelect" placeholder="请选择" v-model:value="formData.AccountID" @change="getPositionList">
|
|
|
|
|
- <a-select-option v-for="item in accountList" :value="item.accountid" :key="item.accountid">{{ item.accountname }} - {{item.accountid}}</a-select-option>
|
|
|
|
|
|
|
+ <a-select class="inlineFormSelect" placeholder="请选择" v-model:value="formData.AccountID" @change="tradeAccountChange">
|
|
|
|
|
+ <a-select-option v-for="item in futuresAccountList" :value="item.accountid" :key="item.accountid">{{ item.accountname }} - {{item.accountid}}</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
<a-form-item label="合约">
|
|
<a-form-item label="合约">
|
|
@@ -15,9 +18,6 @@
|
|
|
<a-select-option v-for="item in goodsList" :value="item.goodsid" :key="item.goodsid">{{ item.goodsname }}</a-select-option>
|
|
<a-select-option v-for="item in goodsList" :value="item.goodsid" :key="item.goodsid">{{ item.goodsname }}</a-select-option>
|
|
|
</a-select>
|
|
</a-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
- <a-form-item label="现货合同" v-if="isHedging">
|
|
|
|
|
- <span class="white">{{ selectedRow.spotcontractid }}</span>
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
<a-form-item label="价格类型">
|
|
<a-form-item label="价格类型">
|
|
|
<a-select class="inlineFormSelect" placeholder="请选择" v-model:value="selectedPriceType" @change="priceTypeChange">
|
|
<a-select class="inlineFormSelect" placeholder="请选择" v-model:value="selectedPriceType" @change="priceTypeChange">
|
|
|
<a-select-option v-for="item in priceTypeList" :value="item.priceType" :key="item.priceType">{{ item.priceName }}</a-select-option>
|
|
<a-select-option v-for="item in priceTypeList" :value="item.priceType" :key="item.priceType">{{ item.priceName }}</a-select-option>
|
|
@@ -52,14 +52,13 @@
|
|
|
<span>{{sellPrice}}</span>
|
|
<span>{{sellPrice}}</span>
|
|
|
<span>卖出</span>
|
|
<span>卖出</span>
|
|
|
</a-button>
|
|
</a-button>
|
|
|
- <!--如果是套保交易隐藏按钮-->
|
|
|
|
|
- <a-button class="close" :loading="loading" @click="submit('close')" :disabled="positionList.length === 0" v-if="!isHedging">
|
|
|
|
|
|
|
+ <a-button class="close" :loading="loading" @click="submit('close')" :disabled="positionList.length === 0">
|
|
|
<!--根据持仓方向显示平仓价格-->
|
|
<!--根据持仓方向显示平仓价格-->
|
|
|
<span v-if="selectedPosition">{{selectedPosition.buyorsell === BuyOrSell.buy ? sellPrice : buyPrice}}</span>
|
|
<span v-if="selectedPosition">{{selectedPosition.buyorsell === BuyOrSell.buy ? sellPrice : buyPrice}}</span>
|
|
|
<span>平仓</span>
|
|
<span>平仓</span>
|
|
|
</a-button>
|
|
</a-button>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="futures_trade__table tableDatas" v-show="positionList.length && !isHedging">
|
|
|
|
|
|
|
+ <div class="futures_trade__table tableDatas" v-show="positionList.length">
|
|
|
<a-table class="dialogTable" :columns="getColumns()" :data-source="positionList" :rowKey="(record,index)=>index" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio' }"></a-table>
|
|
<a-table class="dialogTable" :columns="getColumns()" :data-source="positionList" :rowKey="(record,index)=>index" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio' }"></a-table>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -85,6 +84,7 @@ import { GoodsQuote } from '@/services/go/ermcp/goodsInfo/interface';
|
|
|
import { QueryErmcpTradePositionRsp } from '@/services/go/ermcp/futures/interface';
|
|
import { QueryErmcpTradePositionRsp } from '@/services/go/ermcp/futures/interface';
|
|
|
import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
|
|
import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
|
|
|
import { getGoodsQuoteList } from '@/services/bus/goods';
|
|
import { getGoodsQuoteList } from '@/services/bus/goods';
|
|
|
|
|
+import { useTradeAccount } from '@/hooks/account';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
@@ -112,7 +112,8 @@ export default defineComponent({
|
|
|
cancel();
|
|
cancel();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const { rules, formData, accountList, allPositionList, getPositionList } = handleForm(selectedGoods.value);
|
|
|
|
|
|
|
+ const { futuresAccountList, tradePositionList, tradeAccount, tradeAccountChange } = useTradeAccount();
|
|
|
|
|
+ const { rules, formData } = handleForm(selectedGoods.value);
|
|
|
const formRef = ref();
|
|
const formRef = ref();
|
|
|
const loading = ref<boolean>(false);
|
|
const loading = ref<boolean>(false);
|
|
|
|
|
|
|
@@ -132,14 +133,31 @@ export default defineComponent({
|
|
|
|
|
|
|
|
// 持仓列表
|
|
// 持仓列表
|
|
|
const positionList = computed(() => {
|
|
const positionList = computed(() => {
|
|
|
- const result = allPositionList.value.filter((item) => item.goodsid === selectedGoods.value.goodsid);
|
|
|
|
|
- const { goodscode, goodsid, buyorsell } = props.selectedRow;
|
|
|
|
|
- // 查找选中的持仓单据
|
|
|
|
|
- const index = result.findIndex((item) => item.goodscode === goodscode && item.goodsid === goodsid && item.buyorsell === buyorsell);
|
|
|
|
|
- if (index > -1) {
|
|
|
|
|
- onSelectChange([index], [result[index]])
|
|
|
|
|
|
|
+ if (selectedGoods.value) {
|
|
|
|
|
+ const { goodscode, goodsid } = selectedGoods.value;
|
|
|
|
|
+ // 判断是否套保交易
|
|
|
|
|
+ if (isHedging) {
|
|
|
|
|
+ // 买卖方向,根据合同类型判断
|
|
|
|
|
+ const buyorsell = props.selectedRow.contracttype === 1 ? BuyOrSell.buy : BuyOrSell.sell;
|
|
|
|
|
+ const index = tradePositionList.findIndex((item) => item.goodscode === goodscode && item.goodsid === goodsid && item.buyorsell === buyorsell);
|
|
|
|
|
+ if (index > -1) {
|
|
|
|
|
+ const result = [tradePositionList[index]];
|
|
|
|
|
+ onSelectChange([0], result);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ return [];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 过滤出当前商品的持仓单据
|
|
|
|
|
+ const result = tradePositionList.filter((item) => item.goodsid === goodsid);
|
|
|
|
|
+ // 查找选中的持仓单据
|
|
|
|
|
+ const index = result.findIndex((item) => item.goodscode === goodscode && item.buyorsell === props.selectedRow.buyorsell);
|
|
|
|
|
+ if (index > -1) {
|
|
|
|
|
+ onSelectChange([index], [result[index]])
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- return result;
|
|
|
|
|
|
|
+ return [];
|
|
|
});
|
|
});
|
|
|
// 选中的价格类型
|
|
// 选中的价格类型
|
|
|
const selectedPriceType = ref(1);
|
|
const selectedPriceType = ref(1);
|
|
@@ -298,9 +316,8 @@ export default defineComponent({
|
|
|
formData.OrderPrice = buyorsell === BuyOrSell.buy ? sellPrice.value : buyPrice.value; // 根据持仓方向选择平仓价格
|
|
formData.OrderPrice = buyorsell === BuyOrSell.buy ? sellPrice.value : buyPrice.value; // 根据持仓方向选择平仓价格
|
|
|
formData.ChannelBuildType = BuildType.close;
|
|
formData.ChannelBuildType = BuildType.close;
|
|
|
|
|
|
|
|
- const account = accountList.find((el) => el.accountid === formData.AccountID)!;
|
|
|
|
|
// 判断是否母账号
|
|
// 判断是否母账号
|
|
|
- if (account.ismain) {
|
|
|
|
|
|
|
+ if (tradeAccount.value?.ismain) {
|
|
|
if (selectedGoods.value.outerdealmode === 3 && curtdpositionenabled > 0) {
|
|
if (selectedGoods.value.outerdealmode === 3 && curtdpositionenabled > 0) {
|
|
|
formData.CloseTodayQty = curtdpositionenabled;
|
|
formData.CloseTodayQty = curtdpositionenabled;
|
|
|
}
|
|
}
|
|
@@ -320,7 +337,7 @@ export default defineComponent({
|
|
|
cancel,
|
|
cancel,
|
|
|
loading,
|
|
loading,
|
|
|
visible,
|
|
visible,
|
|
|
- accountList,
|
|
|
|
|
|
|
+ futuresAccountList,
|
|
|
positionList,
|
|
positionList,
|
|
|
rules,
|
|
rules,
|
|
|
formRef,
|
|
formRef,
|
|
@@ -330,7 +347,7 @@ export default defineComponent({
|
|
|
buyPrice,
|
|
buyPrice,
|
|
|
sellPrice,
|
|
sellPrice,
|
|
|
selectedGoods,
|
|
selectedGoods,
|
|
|
- getPositionList,
|
|
|
|
|
|
|
+ tradeAccountChange,
|
|
|
goodsChange,
|
|
goodsChange,
|
|
|
selectedRowKeys,
|
|
selectedRowKeys,
|
|
|
selectedPosition,
|
|
selectedPosition,
|