Ver código fonte

commit 挂牌求购挂牌提交

yu jie 4 anos atrás
pai
commit
2259272687

+ 48 - 43
public/proto/mtp.proto

@@ -325,52 +325,57 @@ message ErrorCodeInfo {
 		optional string ErrorCode = 1; // 错误码
 		optional string ErrorMsg = 2; // 提示信息
 }
-// 交易委托请求
+
+// 交易委托请求 0 3 1
 message OrderReq {
-	optional MessageHead Header = 1;
-		optional string ClientSerialNo = 2; // 客户端流水号
-		optional string ClientOrderTime = 3; // 客户端委托时间
-		optional uint32 ClientType = 4; // 终端类型
-		optional uint64 LoginID = 5; // 登陆账号
-		optional uint64 AccountID = 6; // 交易账号
-		optional uint32 GoodsID = 7; // 商品ID
-		optional uint32 MarketID = 8; // 市场ID
-		optional int32 ValidType = 9; // 校验类型
-		optional uint32 OperateType = 10; // 操作类型:
-		optional uint32 OrderSrc = 11; // 单据来源
-		optional uint64 OperatorID = 12; // 操作员账号ID
-		optional double OrderPrice = 13; // 委托价格
-		optional double MarketMaxSub = 14; // 市价允许最大偏差(做市)
-		optional uint64 OrderQty = 15; // 委托数量
-		optional uint32 BuyOrSell = 16; // 买卖方向
-		optional uint32 BuildType = 17; // 下单类型
-		optional double CurtQuotePrice = 18; // 保留,计算冻结金额使用
-		optional double SpPrice = 19; // 止盈价格
-		optional double SlPrice = 20; // 止损价格
-		optional uint32 PriceMode = 21; // 取价方式
-		optional uint32 TimevalidType = 22; // 时间有效类型
-		optional uint32 TriggerType = 23; // 预埋单触发类型
-		optional double TriggerPrice = 24; // 预埋单触发价格
-		optional uint32 ListingSelectType = 25; // 挂牌点选类型
-		optional uint32 DelistingType = 26; // 摘牌类型
-		optional uint64 RelatedID = 27; // 关联单号
-		optional uint32 OptionType = 28; // 期权类型(1:认购(看涨)2:认沽(看跌))
-		optional double Premium = 29; // 权利金
-		optional uint32 TriggerOperator = 30; // 触发条件(1:大于等于2:小于等于)
-		optional string ServiceTime = 31; // 服务端时间
-		optional uint64 CouponTypeID = 32; // 优惠券类型ID(买方)
-		optional uint32 UsedQty = 33; // 使用数量
-		optional string ValidTime = 34; // 指定有效日期
-		optional uint64 ReceiveInfoID = 35; // 收货地址ID
-}
-// 交易委托应答
+ optional MessageHead Header = 1; // MessageHead
+ optional string ClientSerialNo = 2; // string 客户端流水号
+ optional string ClientOrderTime = 3; // string 客户端委托时间
+ optional uint32 ClientType = 4; // uint32 终端类型
+ optional uint64 LoginID = 5; // uint64 登陆账号
+ optional uint64 AccountID = 6; // uint64 交易账号
+ optional uint32 GoodsID = 7; // uint32 商品ID
+ optional uint32 MarketID = 8; // uint32 市场ID
+ optional int32 ValidType = 9; // int32 校验类型
+ optional uint32 OperateType = 10; // uint32 操作类型:
+ optional uint32 OrderSrc = 11; // uint32 单据来源
+ optional uint64 OperatorID = 12; // uint64 操作员账号ID
+ optional double OrderPrice = 13; // double 委托价格
+ optional double MarketMaxSub = 14; // double 市价允许最大偏差(做市)
+ optional uint64 OrderQty = 15; // uint64 委托数量
+ optional uint32 BuyOrSell = 16; // uint32 买卖方向
+ optional uint32 BuildType = 17; // uint32 下单类型
+ optional double CurtQuotePrice = 18; // double 保留,计算冻结金额使用
+ optional double SpPrice = 19; // double 止盈价格
+ optional double SlPrice = 20; // double 止损价格
+ optional uint32 PriceMode = 21; // uint32 取价方式
+ optional uint32 TimevalidType = 22; // uint32 时间有效类型
+ optional uint32 TriggerType = 23; // uint32 预埋单触发类型
+ optional double TriggerPrice = 24; // double 预埋单触发价格
+ optional uint32 ListingSelectType = 25; // uint32 挂牌点选类型
+ optional uint32 DelistingType = 26; // uint32 摘牌类型
+ optional uint64 RelatedID = 27; // uint64 关联单号
+ optional uint32 OptionType = 28; // uint32 期权类型(1:认购(看涨) 2:认沽(看跌))
+ optional double Premium = 29; // double 权利金
+ optional uint32 TriggerOperator = 30; // uint32 触发条件(1: 大于等于 2:小于等于)
+ optional string ServiceTime = 31; // string 服务端时间
+ optional uint64 CouponTypeID = 32; // uint64 优惠券类型ID(买方)
+ optional uint32 UsedQty = 33; // uint32 使用数量
+ optional string ValidTime = 34; // string 指定有效日期
+ optional uint64 ReceiveInfoID = 35; // uint64 收货地址ID
+ optional uint32 OrderFlag = 36; // uint32 委托标识 - 1:按量 2:按金额
+ optional double OrderAmount = 37; // double 委托金额 OrderFlag=2必填
+}
+
+// 交易委托应答 0 3 2
 message OrderRsp {
-	optional MessageHead Header = 1; // 消息头
-	optional int32 RetCode = 2; // 返回码
-	optional string RetDesc = 3; // 描述信息
-		optional uint64 OrderID = 4; // 一级生成的订单号
-		optional string OrderTime = 5; // 接收委托交易的时间
+ optional MessageHead Header = 1; // MessageHead 消息头
+ optional int32 RetCode = 2; // int32 返回码
+ optional string RetDesc = 3; // string 描述信息
+ optional uint64 OrderID = 4; // uint64 一级生成的订单号
+ optional string OrderTime = 5; // string 接收委托交易的时间
 }
+
 // 撤单请求
 message CancelOrderReq {
 	optional MessageHead Header = 1;

+ 18 - 1
src/common/constants/enumsName.ts

@@ -996,7 +996,24 @@ export function getInterestrateModeName(mode: number, value: number) {
     return result
 }
 
-
+/**
+ *     buildtype	:number;//委托单据类型 - 1:建仓 2:平仓 3:先平后建
+ */
+export function getBuildTypeName(buildtype: number) {
+    let result = "--"
+    switch (buildtype) {  // 1:年利率
+        case 1:
+            result = "建仓"
+            break
+        case 2:
+            result = "平仓"
+            break
+        case 3:
+            result = "先平后建"
+            break;
+    }
+    return result
+}
 
 /**
  * 资金操作类型

+ 22 - 20
src/services/socket/order/interface.ts

@@ -1,30 +1,30 @@
 // 交易委托请求
 export interface OrderReq {
-    ClientSerialNo: string, // 客户端流水号
-    ClientOrderTime: string // 客户端委托时间
-    ClientType: number // 终端类型
-    LoginID: number // 登陆账号
-    AccountID: number // 交易账号
-    GoodsID: number // 商品ID
-    MarketID: number // 市场ID
-    ValidType: number // 校验类型
-    OperateType: number // 操作类型:
-    OrderSrc: number // 单据来源
-    OperatorID: number // 操作员账号ID
-    OrderPrice: number // 委托价格
+    ClientSerialNo?: string, // 客户端流水号
+    ClientOrderTime?: string // 客户端委托时间
+    ClientType?: number // 终端类型
+    LoginID?: number // 登陆账号
+    AccountID?: number // 交易账号
+    GoodsID?: number // 商品ID
+    MarketID?: number // 市场ID
+    ValidType?: number // 校验类型
+    OperateType?: number // 操作类型:
+    OrderSrc?: number // 单据来源
+    OperatorID?: number // 操作员账号ID
+    OrderPrice?: number // 委托价格
     MarketMaxSub?: number // 市价允许最大偏差(做市)
-    OrderQty: number // 委托数量
-    BuyOrSell: number // 买卖方向
-    BuildType: number // 下单类型
+    OrderQty?: number // 委托数量
+    BuyOrSell?: number // 买卖方向
+    BuildType?: number // 下单类型
     CurtQuotePrice?: number // 保留,计算冻结金额使用
     SpPrice?: number // 止盈价格
     SlPrice?: number // 止损价格
-    PriceMode: number // 取价方式
-    TimevalidType: number // 时间有效类型
-    TriggerType: number // 预埋单触发类型
+    PriceMode?: number // 取价方式
+    TimevalidType?: number // 时间有效类型
+    TriggerType?: number // 预埋单触发类型
     TriggerPrice?: number // 预埋单触发价格
-    ListingSelectType: number // 挂牌点选类型
-    DelistingType: number // 摘牌类型
+    ListingSelectType?: number // 挂牌点选类型
+    DelistingType?: number // 摘牌类型
     RelatedID?: number // 关联单号
     OptionType: number // 期权类型(1:认购(看涨)2:认沽(看跌))
     Premium?: number // 权利金
@@ -34,6 +34,8 @@ export interface OrderReq {
     UsedQty?: number // 使用数量
     ValidTime?: string // 指定有效日期
     ReceiveInfoID?: number // 收货地址ID
+    OrderFlag?: number // uint32 委托标识 - 1:按量 2:按金额
+    OrderAmount?: number // double 委托金额 OrderFlag=2必填
 }
 
 

+ 51 - 40
src/views/market/spot_trade/spot_trade_order_transaction/components/listing/index.vue

@@ -1,4 +1,5 @@
 <template>
+    <!-- 贸易圈挂牌 -->
   <Drawer :title="'挂牌'"
           :placement="'right'"
           :visible="visible"
@@ -119,6 +120,14 @@ import { validateAction } from '@/common/setup/form';
 import { FormState } from './interface';
 import { getCanUseMoney } from '@/services/bus/account';
 import { QueryDeliveryRelationRsp } from '@/services/go/delivery/interface';
+import {OrderReq} from "@/services/socket/order/interface";
+import {Order} from "@/services/socket/order";
+import {DelistingType, PriceType} from "@/common/constants/enumCommon";
+import {getLongTypeLoginID} from "@/services/bus/login";
+import {LongType} from "@/services/socket/login/interface";
+import {v4 as uuidv4} from "uuid";
+import moment from "moment";
+import Long from "long";
 export default defineComponent({
     name: ModalEnum.spot_trade_warehouse_financing_delisting,
     components: { Drawer, PlusOutlined, MinusOutlined },
@@ -146,46 +155,48 @@ export default defineComponent({
         // const { getMaxNum, getMoney, getMargin } = handleNumAndMoney(props.enumName, props.buyOrSell, props.selectedRow, props.parantSelectedRow, formState);
         function submit() {
             validateAction<FormState>(formRef, formState).then((res) => {
-                // 摘牌请求
-                // const param: OrderReq = {
-                //     ClientSerialNo: uuidv4(), // 客户端流水号
-                //     ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // 客户端委托时间
-                //     ClientType: 4, // 终端类型
-                //     LoginID: Number(getLongTypeLoginID() as LongType), // 登陆账号
-                //     AccountID: getSelectedAccountId(), // 交易账号
-                //     GoodsID: props.parantSelectedRow.goodsid, // 商品ID
-                //     MarketID: 123, // 市场ID
-                //     ValidType: 1, // 校验类型 当日有效
-                //     OperateType: 1, // 操作类型: 申请
-                //     OrderSrc: 1, // 单据来源: 客户端下单
-                //     OperatorID: getUserId(), // 操作员账号ID
-                //     OrderPrice: 123, // 委托价格
-                //     // MarketMaxSub: number // 市价允许最大偏差(做市)
-                //     // OrderQty: res.num, // 委托数量
-                //     // BuyOrSell: props.buyOrSell === BuyOrSell.buy ? 0 : 1 ,  // 买卖方向  0 买 1 卖
-                //     // BuildType: props.buyOrSell === BuyOrSell.buy ? 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);
-                // });
+                // 挂牌请求 通过挂牌求购进行挂牌
+                const param: OrderReq = {
+                    ClientSerialNo: uuidv4(), // 客户端流水号
+                    ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // 客户端委托时间
+                    ClientType: 4, // 终端类型
+                    LoginID: Number(getLongTypeLoginID() as LongType), // 登陆账号
+                    AccountID: getSelectedAccountId(), // 交易账号
+                    GoodsID: props.parantSelectedRow.goodsid, // 商品ID
+                    MarketID: props.parantSelectedRow.marketid, // 市场ID
+                    ValidType: 1, // 校验类型 当日有效
+                    OperateType: 1, // 操作类型: 申请
+                    OrderSrc: 1, // 单据来源: 客户端下单
+                    OrderPrice: res.price, // 委托价格
+                    OperatorID: Number(getLongTypeLoginID()),
+                    // MarketMaxSub: number // 市价允许最大偏差(做市)
+                    OrderQty: res.num, // 委托数量
+                    BuyOrSell: 0 ,  // 买卖方向  0 买 1 卖
+                    BuildType: 1 ,  // 下单类型  1 建 2 平
+                    // CurtQuotePrice: 0, // 保留,计算冻结金额使用
+                    // SpPrice: 0 ,// 止盈价格
+                    // SlPrice: 0 , // 止损价格
+                    PriceMode: PriceType.limit, // 取价方式
+                    TimevalidType: 1, // 时间有效类型 单日有效
+                    TriggerType: 1, // 预埋单触发类型
+                    // TriggerPrice: number // 预埋单触发价格
+                    ListingSelectType: 1, // 挂牌点选类型 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
+                    OrderFlag: 1,
+                }
+                debugger
+                requestResultLoadingAndInfo(Order, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
+                    cancel(true);
+                });
             });
         }
 

+ 18 - 2
src/views/order/commodity_contract/components/commodity_contract_commission/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 委托 -->
+  <!-- 商品订单 - 委托 -->
   <section>
     <a-table :columns="columns"
              class="srcollYTable expandLeftTable"
@@ -20,6 +20,15 @@
                  class="btn-list-sticky"
                  @click="openComponent" />
       </template>
+        <!-- 类型 -->
+        <template #buildtype="{ record }">
+            <a>{{ getBuildTypeName(record.buildtype) }}</a>
+        </template>
+        <!-- 状态 -->
+        <template #orderstatus="{ record }">
+            <a>{{ getOrderStatusName(record.orderstatus) }}</a>
+        </template>
+
       <template #createtime="{ record }">
         <a>{{ formatTime(record.createtime) }}</a>
       </template>
@@ -42,7 +51,12 @@ import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { queryAmountLog } from '@/services/go/TaAccount';
 import { QueryAmountLogReq } from '@/services/go/TaAccount/interface';
 import { getSelectedAccountId } from '@/services/bus/account';
-import { getOperateTypeEnumItemName, getOperateTypeName } from '@/common/constants/enumsName';
+import {
+    getBuildTypeName,
+    getOperateTypeEnumItemName,
+    getOperateTypeName,
+    getOrderStatusName
+} from '@/common/constants/enumsName';
 import { formatTime } from '@/common/methods';
 import Bus from '@/utils/eventBus/index';
 import { expandIcon } from '@/common/setup/table/clolumn';
@@ -73,6 +87,8 @@ export default defineComponent({
             tableList,
             formatTime,
             expandIcon,
+            getBuildTypeName,
+            getOrderStatusName
         };
     },
 });

+ 17 - 2
src/views/order/commodity_contract/components/commodity_contract_make_deal/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 成交 -->
+  <!-- 商品订单 - 成交 -->
   <section>
     <a-table :columns="columns"
              class="srcollYTable expandLeftTable"
@@ -20,6 +20,14 @@
                  class="btn-list-sticky"
                  @click="openComponent" />
       </template>
+        <!-- 类型 -->
+        <template #buildtype="{ record }">
+            <a>{{ getBuildTypeName(record.buildtype) }}</a>
+        </template>
+        <!-- 状态 -->
+        <template #orderstatus="{ record }">
+            <a>{{ getOrderStatusName(record.orderstatus) }}</a>
+        </template>
       <template #createtime="{ record }">
         <a>{{ formatTime(record.createtime) }}</a>
       </template>
@@ -42,7 +50,12 @@ import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { queryAmountLog } from '@/services/go/TaAccount';
 import { QueryAmountLogReq } from '@/services/go/TaAccount/interface';
 import { getSelectedAccountId } from '@/services/bus/account';
-import { getOperateTypeEnumItemName, getOperateTypeName } from '@/common/constants/enumsName';
+import {
+    getBuildTypeName,
+    getOperateTypeEnumItemName,
+    getOperateTypeName,
+    getOrderStatusName
+} from '@/common/constants/enumsName';
 import { formatTime } from '@/common/methods';
 import Bus from '@/utils/eventBus/index';
 import { expandIcon } from '@/common/setup/table/clolumn';
@@ -73,6 +86,8 @@ export default defineComponent({
             tableList,
             formatTime,
             expandIcon,
+            getBuildTypeName,
+            getOrderStatusName
         };
     },
 });

+ 17 - 2
src/views/order/commodity_contract/components/commodity_contract_settlement/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 交收 -->
+  <!-- 商品订单 - 交收 -->
   <section>
     <a-table :columns="columns"
              class="srcollYTable expandLeftTable"
@@ -23,6 +23,14 @@
       <template #createtime="{ record }">
         <a>{{ formatTime(record.createtime) }}</a>
       </template>
+        <!-- 类型 -->
+        <template #buildtype="{ record }">
+            <a>{{ getBuildTypeName(record.buildtype) }}</a>
+        </template>
+        <!-- 状态 -->
+        <template #orderstatus="{ record }">
+            <a>{{ getOrderStatusName(record.orderstatus) }}</a>
+        </template>
     </a-table>
     <component :is="componentId"
                v-if="componentId"
@@ -42,7 +50,12 @@ import { ComposeOrderTableParam } from '@/common/setup/table/interface';
 import { queryAmountLog } from '@/services/go/TaAccount';
 import { QueryAmountLogReq } from '@/services/go/TaAccount/interface';
 import { getSelectedAccountId } from '@/services/bus/account';
-import { getOperateTypeEnumItemName, getOperateTypeName } from '@/common/constants/enumsName';
+import {
+    getBuildTypeName,
+    getOperateTypeEnumItemName,
+    getOperateTypeName,
+    getOrderStatusName
+} from '@/common/constants/enumsName';
 import { formatTime } from '@/common/methods';
 import Bus from '@/utils/eventBus/index';
 import { expandIcon } from '@/common/setup/table/clolumn';
@@ -71,6 +84,8 @@ export default defineComponent({
             tableList,
             formatTime,
             expandIcon,
+            getBuildTypeName,
+            getOrderStatusName
         };
     },
 });

+ 1 - 1
src/views/order/commodity_contract/components/commodity_contract_summary/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 合约汇总 -->
+  <!-- 商品订单 - 合约汇总 -->
   <section>
     <a-table :columns="columns"
              class="srcollYTable expandLeftTable"