|
@@ -1,11 +1,12 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 挂牌求购 -->
|
|
<!-- 挂牌求购 -->
|
|
|
- <Drawer :title="'挂牌求购'"
|
|
|
|
|
|
|
+ <Drawer :title="isBuy() ? '挂牌求购' : '挂牌卖出' "
|
|
|
:placement="'right'"
|
|
:placement="'right'"
|
|
|
:visible="visible"
|
|
:visible="visible"
|
|
|
@cancel="cancel"
|
|
@cancel="cancel"
|
|
|
class="top">
|
|
class="top">
|
|
|
<div class="post_buying">
|
|
<div class="post_buying">
|
|
|
|
|
+ <span @click="changeDirection">{{isBuy() ? '卖出' : '求购'}}</span>
|
|
|
<a-form class="inlineForm dialogForm"
|
|
<a-form class="inlineForm dialogForm"
|
|
|
ref="formRef"
|
|
ref="formRef"
|
|
|
:model="formState"
|
|
:model="formState"
|
|
@@ -30,8 +31,8 @@
|
|
|
name>
|
|
name>
|
|
|
<a-radio-group class="commonRadioGroup"
|
|
<a-radio-group class="commonRadioGroup"
|
|
|
v-model:value="formState.priceType">
|
|
v-model:value="formState.priceType">
|
|
|
- <a-radio :value="1">固定价</a-radio>
|
|
|
|
|
- <a-radio :value="2">浮动价</a-radio>
|
|
|
|
|
|
|
+ <a-radio :value="2">固定价</a-radio>
|
|
|
|
|
+ <a-radio :value="3">浮动价</a-radio>
|
|
|
</a-radio-group>
|
|
</a-radio-group>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
</a-col>
|
|
</a-col>
|
|
@@ -110,7 +111,7 @@
|
|
|
class="fixedBtns">
|
|
class="fixedBtns">
|
|
|
<a-form-item class="btnCenter">
|
|
<a-form-item class="btnCenter">
|
|
|
<a-button class="listedBtn"
|
|
<a-button class="listedBtn"
|
|
|
- @click="submit">买入</a-button>
|
|
|
|
|
|
|
+ @click="submit">{{isBuy() ? '买入' : '卖出'}}</a-button>
|
|
|
<a-button class="ml10 cancelBtn"
|
|
<a-button class="ml10 cancelBtn"
|
|
|
@click="cancel">取消</a-button>
|
|
@click="cancel">取消</a-button>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -136,7 +137,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
import moment, { Moment } from 'moment';
|
|
import moment, { Moment } from 'moment';
|
|
|
import { getMarketByTradeMode, getMarketRunByTradeMode, getMarketsByTradeMode } from '@/services/bus/market';
|
|
import { getMarketByTradeMode, getMarketRunByTradeMode, getMarketsByTradeMode } from '@/services/bus/market';
|
|
|
import { WrOrderQuote } from '@/services/go/wrtrade/interface';
|
|
import { WrOrderQuote } from '@/services/go/wrtrade/interface';
|
|
|
-import { handleForm, handleNumAndPrice, isFloat } from './setup';
|
|
|
|
|
|
|
+import { handleForm, handleNumAndPrice, isFloat, useBuySellDirection } from './setup';
|
|
|
import { validateAction } from '@/common/setup/form';
|
|
import { validateAction } from '@/common/setup/form';
|
|
|
import { FormParam, TempWrOrderQuoteDetail } from './interface';
|
|
import { FormParam, TempWrOrderQuoteDetail } from './interface';
|
|
|
import { EnumRouterName } from '@/common/constants/enumRouterName';
|
|
import { EnumRouterName } from '@/common/constants/enumRouterName';
|
|
@@ -145,7 +146,10 @@ import { getCanUseMoney } from '@/services/bus/account';
|
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
|
import { OrderReq } from '@/services/socket/order/interface';
|
|
import { OrderReq } from '@/services/socket/order/interface';
|
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
|
|
|
-import { Order } from '@/services/socket/order';
|
|
|
|
|
|
|
+import { diaoQiOrder } from '@/services/socket/order';
|
|
|
|
|
+import Long from 'long';
|
|
|
|
|
+import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
|
|
|
|
|
+import { getGoodsByCode, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
emits: ['cancel', 'update'],
|
|
emits: ['cancel', 'update'],
|
|
@@ -153,16 +157,12 @@ export default defineComponent({
|
|
|
components: { Des, Drawer, PlusOutlined, MinusOutlined },
|
|
components: { Des, Drawer, PlusOutlined, MinusOutlined },
|
|
|
props: {
|
|
props: {
|
|
|
selectedRow: {
|
|
selectedRow: {
|
|
|
- type: Object as PropType<TempWrOrderQuoteDetail>,
|
|
|
|
|
|
|
+ type: Object as PropType<QueryQuoteDayRsp>,
|
|
|
default: {},
|
|
default: {},
|
|
|
},
|
|
},
|
|
|
- enumName: {
|
|
|
|
|
- default: '',
|
|
|
|
|
- type: String as PropType<EnumRouterName>,
|
|
|
|
|
- },
|
|
|
|
|
refGoods: {
|
|
refGoods: {
|
|
|
- type: Object as PropType<QueryQuoteGoodsListRsp>,
|
|
|
|
|
- default: {},
|
|
|
|
|
|
|
+ type: Object as PropType<QueryQuoteGoodsListRsp[]>,
|
|
|
|
|
+ default: [],
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
setup(props, context) {
|
|
setup(props, context) {
|
|
@@ -180,48 +180,58 @@ export default defineComponent({
|
|
|
return accountList.find((e) => e.accountid === formState.accountid);
|
|
return accountList.find((e) => e.accountid === formState.accountid);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const { getMaxNum, getMoney, getMargin, getPrice, canUseMoney } = handleNumAndPrice(props.enumName, props.selectedRow);
|
|
|
|
|
|
|
+ const { direction, changeDirection, isBuy } = useBuySellDirection();
|
|
|
|
|
+
|
|
|
|
|
+ const { getMaxNum, getMoney, getMargin, getPrice, canUseMoney } = handleNumAndPrice(props.selectedRow);
|
|
|
function submit() {
|
|
function submit() {
|
|
|
- // const param: OrderReq = {
|
|
|
|
|
- // ClientSerialNo: uuidv4(), // 客户端流水号
|
|
|
|
|
- // ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // 客户端委托时间
|
|
|
|
|
- // ClientType: 4, // 终端类型
|
|
|
|
|
- // LoginID: geLoginID_number()!, // 登陆账号
|
|
|
|
|
- // AccountID: getSelectedAccountId(), // 交易账号
|
|
|
|
|
- // GoodsID: props.selectedRow.goodsid, // 商品ID
|
|
|
|
|
- // MarketID: getMarketByTradeMode(TradeMode.ListingAndSelection)?.marketid, // 市场ID
|
|
|
|
|
- // ValidType: 1, // 校验类型 当日有效
|
|
|
|
|
- // OperateType: 1, // 操作类型: 申请
|
|
|
|
|
- // OrderSrc: 1, // 单据来源: 客户端下单
|
|
|
|
|
- // RelatedID: Long.fromString(props.selectedRow.orderid), // 操作员账号ID
|
|
|
|
|
- // OrderPrice: props.selectedRow.orderprice, // 委托价格
|
|
|
|
|
- // OperatorID: Number(geLoginID_number()),
|
|
|
|
|
- // // MarketMaxSub: number // 市价允许最大偏差(做市)
|
|
|
|
|
- // OrderQty: res.num, // 委托数量
|
|
|
|
|
- // BuyOrSell: props.selectedRow.buyorsell === 1 ? 0 : 1, // 买卖方向 0 买 1 卖
|
|
|
|
|
- // BuildType: props.selectedRow.buyorsell === 1 ? 1 : 2, // 下单类型 1 建 2 平
|
|
|
|
|
- // // CurtQuotePrice: 0, // 保留,计算冻结金额使用
|
|
|
|
|
- // // SpPrice: 0 ,// 止盈价格
|
|
|
|
|
- // // SlPrice: 0 , // 止损价格
|
|
|
|
|
- // PriceMode: PriceType.limit, // 取价方式
|
|
|
|
|
- // TimevalidType: 1, // 时间有效类型 单日有效
|
|
|
|
|
- // TriggerType: 1, // 预埋单触发类型
|
|
|
|
|
- // // TriggerPrice: number // 预埋单触发价格
|
|
|
|
|
- // ListingSelectType: 2, // 挂牌点选类型 1:挂牌 2:摘牌 3:先摘后挂
|
|
|
|
|
- // DelistingType: DelistingType.selected, // 摘牌类型 2:点选成交
|
|
|
|
|
- // // RelatedID: number // 关联单号
|
|
|
|
|
- // OptionType: 1, // 期权类型(1:认购(看涨)2:认沽(看跌))
|
|
|
|
|
- // // Premium: number // 权利金
|
|
|
|
|
- // // TriggerOperator: number // 触发条件(1:大于等于2:小于等于)
|
|
|
|
|
- // // ServiceTime: string // 服务端时间
|
|
|
|
|
- // // CouponTypeID: number // 优惠券类型ID(买方)
|
|
|
|
|
- // // UsedQty: number // 使用数量
|
|
|
|
|
- // // ValidTime: string // 指定有效日期
|
|
|
|
|
- // // ReceiveInfoID: number // 收货地址ID
|
|
|
|
|
- // };
|
|
|
|
|
- // requestResultLoadingAndInfo(Order, param, loading, ['摘牌成功', '摘牌失败:']).then(() => {
|
|
|
|
|
- // cancel(true);
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ validateAction<FormParam>(formRef, formState).then((res) => {
|
|
|
|
|
+ const { goodscode, orderid } = props.selectedRow;
|
|
|
|
|
+ const param: OrderReq = {
|
|
|
|
|
+ ClientSerialNo: uuidv4(), // 客户端流水号
|
|
|
|
|
+ ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // 客户端委托时间
|
|
|
|
|
+ ClientType: 4, // 终端类型
|
|
|
|
|
+ LoginID: geLoginID_number()!, // 登陆账号
|
|
|
|
|
+ AccountID: getSelectedAccountId(), // 交易账号
|
|
|
|
|
+ GoodsID: getGoodsByCode(goodscode)?.goodsid, // 商品ID
|
|
|
|
|
+ MarketID: getMarketByTradeMode(TradeMode.DiaoQi)?.marketid, // 市场ID
|
|
|
|
|
+ ValidType: 1, // 校验类型 当日有效
|
|
|
|
|
+ OperateType: 1, // 操作类型: 申请
|
|
|
|
|
+ OrderSrc: 1, // 单据来源: 客户端下单
|
|
|
|
|
+ RelatedID: orderid, // 操作员账号ID
|
|
|
|
|
+ OrderPrice: res.FixedPrice, // 委托价格
|
|
|
|
|
+ OperatorID: Number(geLoginID_number()),
|
|
|
|
|
+ // MarketMaxSub: number // 市价允许最大偏差(做市)
|
|
|
|
|
+ OrderQty: res.OrderQty, // 委托数量
|
|
|
|
|
+ BuyOrSell: direction.value, // 买卖方向 0 买 1 卖
|
|
|
|
|
+ BuildType: 1, // 下单类型 1 建 2 平
|
|
|
|
|
+ // CurtQuotePrice: 0, // 保留,计算冻结金额使用
|
|
|
|
|
+ // SpPrice: 0 ,// 止盈价格
|
|
|
|
|
+ // SlPrice: 0 , // 止损价格
|
|
|
|
|
+ PriceMode: res.priceType, // 取价方式
|
|
|
|
|
+ TimevalidType: 1, // 时间有效类型 单日有效
|
|
|
|
|
+ TriggerType: 1, // 预埋单触发类型
|
|
|
|
|
+ // TriggerPrice: number // 预埋单触发价格
|
|
|
|
|
+ ListingSelectType: 1, // 挂牌点选类型 1:挂牌 2:摘牌 3:先摘后挂
|
|
|
|
|
+ DelistingType: 2, // 摘牌类型 2:点选成交
|
|
|
|
|
+ // RelatedID: number // 关联单号
|
|
|
|
|
+ OptionType: 1, // 期权类型(1:认购(看涨)2:认沽(看跌))
|
|
|
|
|
+ // Premium: number // 权利金
|
|
|
|
|
+ // TriggerOperator: number // 触发条件(1:大于等于2:小于等于)
|
|
|
|
|
+ // ServiceTime: string // 服务端时间
|
|
|
|
|
+ // CouponTypeID: number // 优惠券类型ID(买方)
|
|
|
|
|
+ // UsedQty: number // 使用数量
|
|
|
|
|
+ // ValidTime: string // 指定有效日期
|
|
|
|
|
+ // ReceiveInfoID: number // 收货地址ID
|
|
|
|
|
+ };
|
|
|
|
|
+ if (isFloat()) {
|
|
|
|
|
+ // 浮动价
|
|
|
|
|
+ param.MarketMaxSub = res.PriceMove; // 基差
|
|
|
|
|
+ param.OrderPrice = +getQuoteDayInfoByCodeFindPrice(goodscode)!;
|
|
|
|
|
+ }
|
|
|
|
|
+ requestResultLoadingAndInfo(diaoQiOrder, param, loading, ['挂牌求购成功', '挂牌求购失败:']).then(() => {
|
|
|
|
|
+ cancel(true);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
return {
|
|
return {
|
|
|
submit,
|
|
submit,
|
|
@@ -238,6 +248,9 @@ export default defineComponent({
|
|
|
getSelectedAccount,
|
|
getSelectedAccount,
|
|
|
canUseMoney,
|
|
canUseMoney,
|
|
|
getPrice,
|
|
getPrice,
|
|
|
|
|
+ direction,
|
|
|
|
|
+ changeDirection,
|
|
|
|
|
+ isBuy,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|