|
|
@@ -1,25 +1,26 @@
|
|
|
<template>
|
|
|
- <!-- 协议平仓-->
|
|
|
- <Drawer
|
|
|
- :title="'协议平仓'"
|
|
|
- :placement="'right'"
|
|
|
- class="bottom486"
|
|
|
- :visible="visible"
|
|
|
- @cancel="cancel"
|
|
|
- >
|
|
|
- <div class="listed c_c_s_s">
|
|
|
- <a-form class="inlineForm dialogForm" ref="formRef">
|
|
|
- <div class="formBar">
|
|
|
- <div class="formtop">
|
|
|
- <div class="firstTitle">
|
|
|
- <span>合约:{{selectedRow.goodscode}}/{{selectedRow.goodsname}}</span>
|
|
|
- </div>
|
|
|
- <div class="secondLine">
|
|
|
- <div class="left">持仓单号/方向</div>
|
|
|
- <div class="middle">数量/价格/金额</div>
|
|
|
- <div class="right">到期日/盈亏</div>
|
|
|
- </div>
|
|
|
- <!-- <a-checkbox-group class="commonCheckboxGroup"
|
|
|
+ <!-- 协议平仓-->
|
|
|
+ <Drawer :title="'协议平仓'"
|
|
|
+ :placement="'right'"
|
|
|
+ class="bottom486"
|
|
|
+ :visible="visible"
|
|
|
+ @cancel="cancel">
|
|
|
+ <div class="listed c_c_s_s">
|
|
|
+ <a-form class="inlineForm dialogForm"
|
|
|
+ ref="formRef"
|
|
|
+ :model="formState"
|
|
|
+ :rules="rules">
|
|
|
+ <div class="formBar">
|
|
|
+ <div class="formtop">
|
|
|
+ <div class="firstTitle">
|
|
|
+ <span>合约:{{selectedRow.goodscode}}/{{selectedRow.goodsname}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="secondLine">
|
|
|
+ <div class="left">持仓单号/方向</div>
|
|
|
+ <div class="middle">数量/价格/金额</div>
|
|
|
+ <div class="right">到期日/盈亏</div>
|
|
|
+ </div>
|
|
|
+ <!-- <a-checkbox-group class="commonCheckboxGroup"
|
|
|
v-model:value="checked"
|
|
|
@change="checkGroupChange">
|
|
|
<div class="lineBar"
|
|
|
@@ -57,79 +58,67 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-checkbox-group>-->
|
|
|
- <a-checkbox-group class="commonCheckboxGroup">
|
|
|
- <div class="lineBar">
|
|
|
- <div class="line1">
|
|
|
- <div class>
|
|
|
- <a-checkbox></a-checkbox>
|
|
|
- </div>
|
|
|
- <div class="name">32266556655555</div>
|
|
|
- <div class="date">2021-10-30</div>
|
|
|
- </div>
|
|
|
- <div class="line2">
|
|
|
- <div class="left">买入</div>
|
|
|
- <div class="middle">
|
|
|
- <div>10</div>
|
|
|
- <div>850.5</div>
|
|
|
- <div>8505.5</div>
|
|
|
- </div>
|
|
|
- <div class="right red">+100</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="lineBar">
|
|
|
- <div class="line1">
|
|
|
- <div class>
|
|
|
- <a-checkbox></a-checkbox>
|
|
|
- </div>
|
|
|
- <div class="name">32266556655555</div>
|
|
|
- <div class="date">2021-10-30</div>
|
|
|
- </div>
|
|
|
- <div class="line2">
|
|
|
- <div class="left">买入</div>
|
|
|
- <div class="middle">
|
|
|
- <div>10</div>
|
|
|
- <div>850.5</div>
|
|
|
- <div>8505.5</div>
|
|
|
- </div>
|
|
|
- <div class="right red">+100</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </a-checkbox-group>
|
|
|
- </div>
|
|
|
+ <a-checkbox-group class="commonCheckboxGroup"
|
|
|
+ v-model:value="checked"
|
|
|
+ @change="checkGroupChange">
|
|
|
+ <div class="lineBar"
|
|
|
+ v-for="item in tableList"
|
|
|
+ :key="item.tradeid">
|
|
|
+ <div class="line1">
|
|
|
+ <div class>
|
|
|
+ <a-checkbox @change="checkboxChange(item)"
|
|
|
+ :value="item.tradeid"></a-checkbox>
|
|
|
+ </div>
|
|
|
+ <div class="name">{{item.tradeid}}</div>
|
|
|
+ <div class="date">{{item.tradetime}}</div>
|
|
|
</div>
|
|
|
- <div class="fixedBtns">
|
|
|
- <a-row :gutter="24">
|
|
|
- <a-col :span="24" class="mt12">
|
|
|
- <a-form-item label="协议价" name class="inputIconBox mb10">
|
|
|
- <a-input-number
|
|
|
- class="commonInput"
|
|
|
- style="width: 200px"
|
|
|
- :min="0"
|
|
|
- :max="100"
|
|
|
- />
|
|
|
- <MinusOutlined />
|
|
|
- <PlusOutlined />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-item label="平仓金额" class="mb10">
|
|
|
- <span class="white">50400.20</span>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-form-item class="btnCenter mt10">
|
|
|
- <a-button
|
|
|
- class="listedBtn"
|
|
|
- :loading="loading"
|
|
|
- :disabled="loading"
|
|
|
- @click="submit"
|
|
|
- >提交</a-button>
|
|
|
- <a-button class="ml10 cancelBtn">取消</a-button>
|
|
|
- </a-form-item>
|
|
|
+ <div class="line2">
|
|
|
+ <div class="left">{{item.buyorsell === BuyOrSell.buy ? '买入' : '卖出'}}</div>
|
|
|
+ <div class="middle">
|
|
|
+ <div>{{item.holderqty}}</div>
|
|
|
+ <div>{{item.holderprice}}</div>
|
|
|
+ <div>{{item.holderamount}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="right red">+100</div>
|
|
|
</div>
|
|
|
- </a-form>
|
|
|
+ </div>
|
|
|
+ </a-checkbox-group>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </Drawer>
|
|
|
+ <div class="fixedBtns">
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :span="24"
|
|
|
+ class="mt12">
|
|
|
+ <a-form-item label="协议价"
|
|
|
+ name="price"
|
|
|
+ class="inputIconBox mb10 not-copy">
|
|
|
+ <a-input-number class="commonInput not-copy"
|
|
|
+ v-model:value="formState.price"
|
|
|
+ style="width: 200px"
|
|
|
+ :min="0" />
|
|
|
+ <MinusOutlined @click="decreasePrice" />
|
|
|
+ <PlusOutlined @click="increasePirce" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="24">
|
|
|
+ <a-form-item label="平仓金额"
|
|
|
+ class="mb10 not-copy ">
|
|
|
+ <span class="white">50400.20</span>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-form-item class="btnCenter mt10">
|
|
|
+ <a-button class="listedBtn"
|
|
|
+ :loading="loading"
|
|
|
+ :disabled="loading"
|
|
|
+ @click="submit">提交</a-button>
|
|
|
+ <a-button class="ml10 cancelBtn"
|
|
|
+ @click="cancel">取消</a-button>
|
|
|
+ </a-form-item>
|
|
|
+ </div>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ </Drawer>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
@@ -160,8 +149,8 @@ import { queryTradeHolderDetail } from '@/services/go/order';
|
|
|
import { QueryTradeHolderDetailReq } from '@/services/go/order/interface';
|
|
|
import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
|
|
|
import { validateAction } from '@/common/setup/form';
|
|
|
-import { FormState } from './interface';
|
|
|
-import { handleForm } from './setup';
|
|
|
+import { FormState, BargainList } from './interface';
|
|
|
+import { handleForm, usePrice, useCheckd } from './setup';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: ModalEnum.commodity_contract_summary_settlement,
|
|
|
@@ -180,32 +169,45 @@ export default defineComponent({
|
|
|
setup(props, context) {
|
|
|
const { visible, cancel } = _closeModal(context);
|
|
|
const { rules, formState, formRef } = handleForm();
|
|
|
+ // 选中逻辑
|
|
|
+ const { checked, selected, checkGroupChange, checkboxChange } = useCheckd();
|
|
|
// 表格列表数据
|
|
|
- const { loading, tableList, queryTable } = queryTableList<QueryTjmdTransferApplyRsp>();
|
|
|
+ const { loading, tableList, queryTable } = queryTableList<BargainList>();
|
|
|
const param: QueryTradeHolderDetailReq = {
|
|
|
buyorsell: props.selectedRow.buyorsell,
|
|
|
userid: getUserId(),
|
|
|
goodsid: props.selectedRow.goodsid,
|
|
|
};
|
|
|
- queryTable(queryTradeHolderDetail, param);
|
|
|
+ queryTable(queryTradeHolderDetail, param).then((res) => {
|
|
|
+ tableList.value = res.map((e, i) => {
|
|
|
+ if (i) {
|
|
|
+ return { ...e, checked: false };
|
|
|
+ } else {
|
|
|
+ // 默认勾选第一个
|
|
|
+ checked.value = e.tradeid;
|
|
|
+ const result = { ...e, checked: true };
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
const toFixed0 = (value: number) => +value.toFixed(0);
|
|
|
|
|
|
function submit() {
|
|
|
- // validateAction<FormState>(formRef, formState).then((res) => {
|
|
|
- const item = tableList.value[0];
|
|
|
- const param: TradeHoldTransferApplyReq = {
|
|
|
- TradeID: Long.fromString(item.tradeid),
|
|
|
- BuyorSell: item.buyorsell,
|
|
|
- TransferPrice: 100,
|
|
|
- ApplySrc: 2,
|
|
|
- ApplicantID: geLoginID_number()!,
|
|
|
- Remark: '',
|
|
|
- };
|
|
|
- requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
|
|
|
- cancel(true);
|
|
|
+ validateAction<FormState>(formRef, formState).then((res) => {
|
|
|
+ const item = tableList.value[0];
|
|
|
+ const param: TradeHoldTransferApplyReq = {
|
|
|
+ TradeID: Long.fromString(item.tradeid),
|
|
|
+ BuyorSell: item.buyorsell,
|
|
|
+ TransferPrice: res.price,
|
|
|
+ ApplySrc: 2,
|
|
|
+ ApplicantID: geLoginID_number()!,
|
|
|
+ Remark: '',
|
|
|
+ };
|
|
|
+ requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
|
|
|
+ cancel(true);
|
|
|
+ });
|
|
|
});
|
|
|
- // });
|
|
|
}
|
|
|
return {
|
|
|
visible,
|
|
|
@@ -214,6 +216,14 @@ export default defineComponent({
|
|
|
tableList,
|
|
|
loading,
|
|
|
toFixed0,
|
|
|
+ rules,
|
|
|
+ formState,
|
|
|
+ formRef,
|
|
|
+ ...usePrice(formState),
|
|
|
+ checked,
|
|
|
+ checkGroupChange,
|
|
|
+ checkboxChange,
|
|
|
+ BuyOrSell,
|
|
|
};
|
|
|
},
|
|
|
});
|