Handy_Cao hace 2 años
padre
commit
673120e67e

+ 172 - 2
src/business/trade/index.ts

@@ -1,7 +1,7 @@
 import { reactive, ref, shallowRef, computed } from 'vue'
 import { v4 } from 'uuid'
-import { ClientType, OrderSrc } from '@/constants/client'
-import { useLoginStore, useAccountStore } from '@/stores'
+import { ClientType, EBuildType, EDelistingType, EListingSelectType, EOperateType, EOrderDirection, EOrderOperateType, EPriceMode, ETradeMode, EValidType, OrderSrc } from '@/constants/client'
+import { useLoginStore, useAccountStore, useUserStore } from '@/stores'
 import {
     spotPresaleDestingOrder,
     spotPresaleTransferCancel,
@@ -16,6 +16,9 @@ import {
     hdWRDealOrder,
     thjProfitDrawApply,
     spotPresalePointPrice,
+    cancelOrder,
+    holderClose,
+    order
 } from '@/services/api/trade'
 import { formatDate } from "@/filters";
 import Long from 'long'
@@ -23,6 +26,7 @@ import { BuyOrSell } from '@/constants/order'
 
 const loginStore = useLoginStore()
 const accountStore = useAccountStore()
+const userStore = useUserStore()
 
 // 采购摘牌
 export function usePurchaseOrderDesting() {
@@ -471,4 +475,170 @@ export function useSpotPresalePointPrice(WRTradeDetailID = '0') {
         formData,
         formSubmit,
     }
+}
+
+// 撤单请求接口
+export function useCancelOrder() {
+    const loading = shallowRef(false)
+
+    const cancelSubmit = async (orderid: string, marketid: number) => {
+        /// 参数信息
+        const params = {
+            OperatorID: loginStore.loginId,
+            OrderSrc: OrderSrc.ORDERSRC_CLIENT,
+            AccountID: accountStore.accountId,
+            ClientSerialNo: v4(),
+            ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
+            ClientType: ClientType.Web,
+            OperateType: EOperateType.OPERATETYPE_ORDERCANCEL,
+        }
+        try {
+            loading.value = true
+            return await cancelOrder({
+                data: {
+                    ...params,
+                    OldOrderId: orderid
+                }
+            }, marketid)
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        cancelSubmit
+    }
+}
+
+// 按单平仓
+export function useHolderClose() {
+    const loading = shallowRef(false)
+
+    /// 参数信息
+    const params = {
+        ClientSerialNo: v4(),
+        ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
+        ClientType: ClientType.Web,
+        LoginID: loginStore.loginId,
+        AccountID: accountStore.accountId,
+        OrderSrc: OrderSrc.ORDERSRC_CLIENT,
+        OperatorID: loginStore.loginId,
+    }
+
+    const holderCloseSubmit = async (tradeid: string, goodsid: number, buyOrSell: number, marketid: number) => {
+        try {
+            loading.value = true
+            return await holderClose({
+                data: {
+                    TradeID: tradeid,
+                    GoodsID: goodsid,
+                    BuyOrSell: buyOrSell,
+                    MarketID: marketid,
+                    ...params
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        holderCloseSubmit
+    }
+}
+
+// 掉期商品摘牌请求
+export function useDelisting() {
+    const loading = shallowRef(false)
+
+    const onSubmit = async (goodsid: number, marketid: number, buyOrSell: EOrderDirection, orderid: string, priceMode: EPriceMode, orderPrice: number, maxSub: number, orderQty: number) => {
+        try {
+            loading.value = true
+            return await order({
+                data: {
+                    ClientSerialNo: v4(),
+                    ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
+                    ClientType: ClientType.Web,
+                    LoginID: loginStore.loginId,
+                    AccountID: accountStore.accountId,
+                    GoodsID: goodsid,
+                    MarketID: marketid,
+                    ValidType: EValidType.VALIDTYPE_DR,
+                    OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
+                    OrderSrc: OrderSrc.ORDERSRC_CLIENT,
+                    OperatorID: loginStore.loginId,
+                    ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_DELISTING,
+                    DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
+                    BuyOrSell: buyOrSell === EOrderDirection.BUY ? EOrderDirection.SELL : EOrderDirection.BUY,
+                    BuildType: EBuildType.BUILDTYPE_OPEN,
+                    TimevalidType: 1,
+                    MarketMaxSub: 0.0,
+                    ServiceTime: '',
+                    ValidTime: '',
+                    OrderFlag: 1,
+                    RelatedID: orderid,
+                    PriceMode: priceMode,
+                    CurtQuotePrice: 0.0,
+                    OrderPrice: priceMode === EPriceMode.PRICEMODE_LIMIT ? orderPrice : maxSub,
+                    OrderQty: orderQty,    
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        onSubmit
+    }
+}
+
+// 掉期商品挂牌请求
+export function useListing() {
+    const loading = shallowRef(false)
+
+    const onSubmit = async (goodsid: number, buyOrSell: number, orderid: string, priceMode: EPriceMode, orderPrice: number, maxSub: number, orderQty: number) => {
+        try {
+            loading.value = true
+            return await order({
+                data: {
+                    ClientSerialNo: v4(),
+                    ClientOrderTime: formatDate(new Date().toString(), 'YYYY-MM-DD HH:mm:ss'),
+                    ClientType: ClientType.Web,
+                    LoginID: loginStore.loginId,
+                    AccountID: accountStore.accountId,
+                    GoodsID: goodsid,
+                    MarketID: userStore.getMarketId('TRADEMODE_TJMD'),
+                    ValidType: EValidType.VALIDTYPE_DR,
+                    OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
+                    OrderSrc: OrderSrc.ORDERSRC_CLIENT,
+                    OperatorID: loginStore.loginId,
+                    ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_LISTING,
+                    DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
+                    BuyOrSell: buyOrSell === 0 ? EOrderDirection.SELL : EOrderDirection.BUY,
+                    BuildType: EBuildType.BUILDTYPE_OPEN,
+                    TimevalidType: 1,
+                    MarketMaxSub: priceMode === EPriceMode.PRICEMODE_LIMIT ? 0.0 : maxSub,
+                    ServiceTime: '',
+                    ValidTime: '',
+                    OrderFlag: 1,
+                    RelatedID: orderid,
+                    PriceMode: priceMode,
+                    CurtQuotePrice: 0.0,
+                    OrderPrice: priceMode === EPriceMode.PRICEMODE_LIMIT ? orderPrice : 0.0,
+                    OrderQty: orderQty,    
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        onSubmit
+    }
 }

+ 1113 - 1
src/constants/client.ts

@@ -52,4 +52,1116 @@ export enum OrderSrc {
     ORDERSRC_ENTRUSACCEPT = 10,
     /// 预埋触发
     ORDERSRC_PREPOSORDER = 11,
-}
+}
+
+/// 最后更新时间枚举
+export enum ELastUpdateTime {
+    /// 枚举常量字典最后更新时间
+    LastUpdateTime_DirctionaryUTime = 20,
+    /// 错误码字典最后更新时间
+    LastUpdateTime_ErrorcodeUTime = 21,
+    /// 市场更新时间
+    LastUpdateTime_MarketsUTime = 22,
+    /// 商品更新时间
+    LastUpdateTime_GoodsUTime = 23,
+    /// 终端配置参数更新时间
+    LastUpdateTime_ConfigUTime = 24,
+    /// 风险协议书更新时间
+    LastUpdateTime_RiskMsgUTime = 25,
+    /// 交易日
+    LastUpdateTime_TradeDate = 26,
+    /// 菜单更新时间
+    LastUpdateTime_MenuUTime = 27,
+    /// 交收商品更新时间
+    LastUpdateTime_DvGoodsUTime = 28,
+}
+
+/// 客户端类型
+export enum EClientType {
+    /// 保留为未填终端类型
+    CLIENTTYPE_NONE = 0,
+    /// PC管理端
+    CLIENTTYPE_PC_MANAGER_CLIENT = 1,
+    /// PC交易端
+    CLIENTTYPE_PC_TRADE_CLIENT = 2,
+    /// 手机客户端_安卓
+    CLIENTTYPE_MOBILE_CLIENT_ANDROID = 3,
+    /// 网页客户端
+    CLIENTTYPE_WEBPAGE_CLIENT = 4,
+    /// 微信客户端
+    CLIENTTYPE_WECHAT_CLIENT = 5,
+    /// 手机客户端_苹果
+    CLIENTTYPE_MOBILE_CLIENT_IOS = 6,
+    /// 网上开户客户端
+    CLIENTTYPE_USERACCOUNT_ONLINE = 7,
+    /// 无效终端编号
+    CLIENTTYPE_INVALID = 8,
+    /// 报价终端
+    CLIENTTYPE_QUOTE_CLIENT = 9,
+}
+
+/// 交易属性
+export enum ETradeProperty {
+    /// 收益权(可做空)
+    TRADEPROPERTY_CANSHORT = 1,
+    ///  所有权(不可做空)
+    TRADEPROPERTY_NOSHORT = 2,
+    /// 期权
+    TRADEPROPERTY_OPTION = 3,
+    /// 现货
+    TRADEPROPERTY_CANGOODS = 4,
+    /// 参考行情
+    TRADEPROPERTY_REFERENCEQUOTES = 5,
+    /// 通道交易
+    TRADEPROPERTY_CHANNELTRADE = 6,
+    /// 币交易
+    TRADEPROPERTY_COINEXCHANGE = 7,
+    /// 场外期权
+    TRADEPROPERTY_OTCOPTION = 8,
+}
+
+/// 交易模式
+export enum ETradeMode {
+    /// 做市
+    TRADEMODE_MARKETMAKE = 10,
+    /// 竞价
+    TRADEMODE_BIDDING = 13,
+    /// 通道交易
+    TRADEMODE_ENTRUST_HEDGE = 15,
+    /// 挂牌点选
+    TRADEMODE_LISTING_SELECT = 16,
+    /// 仓单贸易
+    TRADEMODE_SPOT_WRTRADE = 17,
+    /// 期权贸易
+    TRADEMODE_OPTION = 18,
+    /// 竞拍-降价式
+    TRADEMODE_AUCTIONCUT = 19,
+    /// 竞拍-竞价式
+    TRADEMODE_AUCTIONBID = 20,
+    /// 竞拍-大宗式
+    TRADEMODE_AUCTIONBULK = 21,
+    /// 受托竞价
+    TRADEMODE_ENTRUSTBID = 22,
+    /// 预售集采
+    TRADEMODE_PRESALE = 23,
+    /// 竞拍-降价式(无仓单)
+    TRADEMODE_AUCTIONCUTNOWR = 24,
+    /// 点价点选贸易
+    TRADEMODE_POINTANDSELECT = 25,
+    /// 挂牌期权
+    TRADEMODE_LISTINGOPTION = 26,
+    /// 招投标
+    TRADEMODE_TENDER = 27,
+    /// 币交易
+    TRADEMODE_COINEXCHANGE = 32,
+    /// 竞拍-荷兰式
+    TRADEMODE_AUCTIONDUTCH = 34,
+    /// 场外期权-单向
+    TRADEMODE_OTCOPTION_ONEWAY = 35,
+    /// 法币C2C
+    TRADEMODE_COINC2C = 36,
+    /// 预售一口价挂牌
+    TRADEMODE_CPTRADE_LISTING = 40,
+    /// 预售竞拍(大宗)
+    TRADEMODE_CPTRADE_AUCTION_BULK = 41,
+    /// 期现套利
+    TRADEMODE_FSARBITRAGE = 42,
+    /// 仓单回购
+    TRADEMODE_WRREPURCHASE = 43,
+    /// 现货贸易
+    TRADEMODE_SPOT_TRADE = 44,
+    /// 天津麦顿-商品掉期
+    TRADEMODE_TJMD = 46,
+    /// 廣陈优品-仓单预售
+    TRADEMODE_CDYS = 47,
+    /// 千海金-铂金宝
+    TRADEMODE_QHJ_BJB = 69,
+    /// 海商报业商城
+    TRADEMODE_HSBY_SHOP = 70,
+    /// 预售挂牌
+    TRADEMODE_CPTRADE_LS = 71,
+    /// AI预约竞拍
+    TRADEMODE_AUCTION_AI = 72,
+    /// 尚志金宝宝
+    TRADEMODE_SZDZ_JBB = 73,
+    /// 挂牌点选-尚志
+    TRADEMODE_SZDZ_LS = 75,
+    /// 竞拍-金点拍
+    TRADEMODE_SZDZ_JDP = 76,
+    /// 现货商城
+    TRADEMODE_SPOTSHOP = 77,
+    /// 报价系统
+    TRADEMODE_SPOTQUOTE = 78,
+    /// 挂牌系统
+    TRADEMODE_SPOTLISTING = 79,
+    /// 千海金-饰品回收
+    TRADEMODE_QHJ_SPHG = 97,
+    /// 参考行情
+    TRADEMODE_QHJ_CKHQ = 99,
+}
+
+/// 履约状态
+export enum EPerformanceStatus {
+    /// 待激活
+    PERFORMANCESTATUS_INI = 1,
+    /// 正常
+    PERFORMANCESTATUS_NORMAL = 2,
+    /// 处理错误
+    PERFORMANCESTATUS_ERROR = 3,
+    /// 违约待确认
+    PERFORMANCESTATUS_BREACHING = 4,
+    /// 违约
+    PERFORMANCESTATUS_BREACHED = 5,
+    /// 完成
+    PERFORMANCESTATUS_FINISHED = 6,
+    /// 违约已完成
+    PERFORMANCESTATUS_BREACHE_FINISHED = 7,
+    /// 释放冻结失败
+    PERFORMANCESTATUS_UNFREEZE_FAIL = 8,
+    /// 超时待处理
+    PERFORMANCESTATUS_TIMEOUT_WAIT = 9,
+    /// 超时关闭
+    PERFORMANCESTATUS_TIMEOUT_FINISHED = 10,
+}
+
+/// 履约类型
+export enum EPerformanceType {
+    /// 通用
+    PERFORMANCETYPE_NORMAL = 0,
+    /// 交割
+    PERFORMANCETYPE_DELIVERY = 1,
+    /// 仓单贸易
+    PERFORMANCETYPE_WRTRADE = 2,
+    /// 预售采集
+    PERFORMANCETYPE_PRESALE = 3,
+    /// 竞拍-降价式 (无仓单)
+    PERFORMANCETYPE_AUCTIONCUT = 4,
+    /// 挂牌期权 (无仓单)
+    PERFORMANCETYPE_LISTINGOPTION = 5,
+    /// 竞拍-降价式
+    PERFORMANCETYPE_AUCTIONLOWER = 6,
+    /// 竞拍-竞价式
+    PERFORMANCETYPE_AUCTIONUPPER = 7,
+    /// 竞拍-大宗式
+    PERFORMANCETYPE_AUCTIONBULK = 8,
+    /// 竞拍-荷兰式
+    PERFORMANCETYPE_AUCTIODUTCH = 9,
+    /// 法币C2C
+    PERFORMANCETYPE_COINC2C = 10,
+    /// 报价系统
+    PERFORMANCETYPE_SPOTQUOTE = 11,
+    /// 挂牌系统
+    PERFORMANCETYPE_SPOTLISTING = 12,
+}
+
+/// 付款方式
+export enum EPaymentType {
+    /// 冻结
+    freeze = 1,
+    /// 扣款
+    cut = 2,
+}
+
+/// 履约步骤控制状态
+export enum EHandleStatus {
+    /// 开始
+    PERFORMANCE_STEPHANDLESTATUS_BEGIN = 1,
+    /// 结束
+    PERFORMANCE_STEPHANDLESTATUS_FINISHED = 2,
+    /// 冻结请求
+    PERFORMANCE_STEPHANDLESTATUS_FREEZE_REQ = 3,
+    /// 冻结返回成功
+    PERFORMANCE_STEPHANDLESTATUS_FREEZE_RSP_SUC = 4,
+    /// 冻结返回失败
+    PERFORMANCE_STEPHANDLESTATUS_FREEZE_RSP_FAIL = 5,
+    /// 扣款请求
+    PERFORMANCE_STEPHANDLESTATUS_DEDUCT_REQ = 6,
+    /// 扣款返回成功
+    PERFORMANCE_STEPHANDLESTATUS_DEDUCT_RSP_SUC = 7,
+    /// 扣款返回失败
+    PERFORMANCE_STEPHANDLESTATUS_DEDUCT_RSP_FAIL = 8,
+    /// 仓单转移请求
+    PERFORMANCE_STEPHANDLESTATUS_RECEIPTTRANSFER_REQ = 9,
+    /// 仓单转移返回成功
+    PERFORMANCE_STEPHANDLESTATUS_RECEIPTTRANSFER_RSP_SUC = 10,
+    /// 仓单转移返回失败
+    PERFORMANCE_STEPHANDLESTATUS_RECEIPTTRANSFER_RSP_FAIL = 11,
+    /// 加钱请求
+    PERFORMANCE_STEPHANDLESTATUS_ADDMONEY_REQ = 12,
+    /// 加钱返回成功
+    PERFORMANCE_STEPHANDLESTATUS_ADDMONEY_RSP_SUC = 13,
+    /// 加钱返回失败
+    PERFORMANCE_STEPHANDLESTATUS_ADDMONEY_RSP_FAIL = 14,
+    /// 解冻仓单头寸请求
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WRPOSTION_REQ = 15,
+    /// 解冻仓单头寸返回成功
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WRPOSTION_RSP_SUC = 16,
+    /// 解冻仓单头寸返回失败
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WRPOSTION_RSP_FAIL = 17,
+    /// 解冻库位请求
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WAREHOUSE_REQ = 18,
+    /// 解冻库位返回成功
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WAREHOUSE_RSP_SUC = 19,
+    /// 解冻库位返回失败
+    PERFORMANCE_STEPHANDLESTATUS_UNFREZZE_WAREHOUSE_RSP_FAIL = 20,
+    /// 卖方剩余金额解冻请求
+    PERFORMANCE_STEPHANDLESTATUS_SELLER_UNFREZZE_REQ = 21,
+    /// 卖方剩余金额解冻成功
+    PERFORMANCE_STEPHANDLESTATUS_SELLER_UNFREZZE_RSP_SUC = 22,
+    /// 卖方剩余金额解冻失败
+    PERFORMANCE_STEPHANDLESTATUS_SELLER_UNFREZZE_RSP_FAIL = 23,
+}
+
+/// 履约步骤状态
+export enum EStepStatus {
+    /// 待开始
+    PERFORMANCE_STEPSTATUS_PENDING = 1,
+    /// 进行中
+    PERFORMANCE_STEPSTATUS_EXECUTING = 2,
+    /// 已完成
+    PERFORMANCE_STEPSTATUS_FINISHED = 3,
+    /// 延期(进行中)
+    PERFORMANCE_STEPSTATUS_EXECUTING_DELAY = 4,
+    /// 失败
+    PERFORMANCE_STEPSTATUS_FAILED = 5,
+    /// 自动完成
+    PERFORMANCE_STEPSTATUS_FINISHED_AUTO = 6,
+    /// 超时关闭
+    PERFORMANCE_STEPSTATUS_FINISHED_TIMEOUT = 7,
+}
+
+/// 履约步骤类型
+export enum EStepType {
+    /// 买方支付
+    PERFORMANCE_STEPTYPE_BUYER_PAYMENT = 1,
+    /// 卖方收款
+    PERFORMANCE_STEPTYPE_SELLER_RECEIVE = 2,
+    /// 买方自提
+    PERFORMANCE_STEPTYPE_BUYER_PICKUP = 3,
+    ///  卖方发货
+    PERFORMANCE_STEPTYPE_SELLER_SENDGOODS = 4,
+    /// 买方确认货
+    PERFORMANCE_STEPTYPE_BUYER_CONFIRMGOODS = 5,
+    /// 卖方发票
+    PERFORMANCE_STEPTYPE_SELLER_SENDINVOICE = 6,
+    /// 买方确认票
+    PERFORMANCE_STEPTYPE_BUYER_CONFIRMINVOICE = 7,
+    /// 仓单转移
+    PERFORMANCE_STEPTYPE_WRMOVE = 8,
+    /// 释放卖方履约前剩余保证金
+    PERFORMANCE_STEPTYPE_SELLER_UNFREEZE = 9,
+    /// 溢短
+    PERFORMANCE_STEPTYPE_OVER_SHORT = 10,
+    /// 生成合同
+    PERFORMANCE_STEPTYPE_BUILD_AGREEMENT = 11,
+    /// 运费
+    PERFORMANCE_STEPTYPE_BUILD_EXPRESSFEE = 12,
+    /// 确认付款(买方)
+    PERFORMANCE_STEPTYPE_COINC2C_CONFIRM_PAYMENT = 90,
+    /// 确认放行(卖方)
+    PERFORMANCE_STEPTYPE_COINC2C_CONFIRM_PASS = 91,
+    /// 买方支付(直接扣款)
+    PERFORMANCE_STEPTYPE_BUYER_PAYMENT_NOW = 92,
+}
+
+export enum EFinanceType {
+    /// -融资回购
+    FinanceBuyBack = 1,
+}
+
+/// 交个状态
+export enum EDeliveryStatus {
+    /// 待成交
+    DELIVERYSTATUS_PENDING = 1,
+    /// 已成交
+    DELIVERYSTATUS_TRADED = 2,
+    /// 成交失败
+    DELIVERYSTATUS_FAILED = 3,
+    /// 履约完成
+    DELIVERYSTATUS_PERFORMANCEFINISHED = 4,
+}
+
+/// 单据方向
+export enum EOrderDirection {
+    /// 订单买方向
+    BUY = 0,
+    /// 订单卖方向
+    SELL = 1,
+}
+
+/// 价格方式
+export enum EWrPriceType {
+    /// 固定价
+    fixed = 1,
+    /// 浮动价
+    float = 2,
+    /// 贸易圈
+    member = 3,
+    /// 协议指定
+    point = 4,
+}
+
+
+/// 价格类型
+export enum EPriceMode {
+    /// 市价
+    PRICEMODE_MARKET = 1,
+    /// 限价(固定价)
+    PRICEMODE_LIMIT = 2,
+    /// 浮动价
+    PRICEMODE_FLOAT = 3,
+}
+
+/// 订单状态
+export enum EOrderStatus {
+    ///  委托请求
+    REQUEST = 1,
+    ///  待冻结
+    WAITFREEZE = 2,
+    ///  委托成功
+    SUCCEED = 3,
+    ///  委托失败
+    FAILED = 4,
+    ///  配对成功
+    MATCHED = 5,
+    ///  已撤
+    CANCELED = 6,
+    ///  部成
+    LISTING_PARTTRADE = 7,
+    ///  已成
+    DEALED = 8,
+    ///  部成部撤
+    PARTIALCANCELED = 9,
+    ///   成交失败
+    DEALFAILED = 10,
+    ///  委托拒绝
+    DENIED = 11,
+    ///  经过摘牌(先摘后挂专用)
+    MATCH = 12,
+    ///  冻结成功(通道交易专用)
+    FREEZE_SUCCESS = 13,
+    ///  通道已撤
+    CHANNEL_CANCELED = 14,
+    ///  通道部成部撤
+    CHANNEL_PARTIALCANCELED = 15,
+    ///  成交失败违约(荷兰式竞拍专用)
+    BREACHDEALFAILED = 16,
+    ///  冻结PD成功
+    FREEZE_PD_SUCCESS = 17,
+    ///  冻结PD失败
+    FREEZE_PD_FAILED = 18,
+    ///  冻结能量成功
+    FREEZE_MP_SUCCESS = 19,
+    ///  冻结能量失败
+    FREEZE_MP_FAILED = 20,
+    ///  预约已报价
+    AI_QUOTE_SUCCESS = 21,
+    ///  过期未付
+    PAY_PAY_EXPIRED = 22,
+    ///  优惠券处理中
+    COUPPOSITION = 23,
+    /// 仓单生成失败
+    WR_FAILED = 24,
+    /// 首付扣款失败
+    FIRSTPAYMENT_DEDUCT_FAILED = 25,
+    /// 履约失败
+    PERFORMANCE_FAILED = 26,
+    /// 撤单解冻贷款失败
+    CANCELE_UNFREZZE_FAILED = 27,
+}
+
+/// 对冲内盘委托状态
+export enum EChannelInnerOrderStatus {
+    /// 委托请求
+    INNERSTATUS_ORDERREQ = 1,
+    /// 冻结成功
+    INNERSTATUS_FREEZESUCC = 2,
+    /// 委托失败
+    INNERSTATUS_ORDERFAIL = 3,
+    /// 委托部成部失败
+    INNERSTATUS_PARTIAL_TRADE_FAIL = 4,
+    /// 委托成功
+    INNERSTATUS_ORDERSUCC = 5,
+    /// 全部撤销
+    INNERSTATUS_ALLCANCEL = 6,
+    /// 部成部撤
+    INNERSTATUS_PARTIAL_TRADE_CANCELED = 7,
+    /// 部成部撤部失败
+    INNERSTATUS_PARTIAL_TRADE_CANCELED_FAIL = 8,
+    /// 全部成交
+    INNERSTATUS_ALLTRADE = 9,
+}
+
+/// 提货方式
+export enum ETakeMode {
+    /// 2:自提
+    oneself = 2,
+    /// 3:配送(邮寄)
+    distribution = 3,
+}
+
+/// 提货状态
+export enum ETakeOrderStatus {
+    /// 1:备货中
+    InStock = 1,
+    /// 2:待取货(自提)
+    UnPickUp = 2,
+    /// 3:已取货(自提)
+    PickUp = 3,
+    /// 4:待收货(邮寄)
+    UnRecived = 4,
+    /// 5:已收货(邮寄)
+    Recived = 5,
+    /// 6:自动收货(邮寄)
+    AutoRecived = 6,
+    /// 7:已拒绝
+    Rejiect = 7,
+    /// 8:已撤销
+    Cancel = 8,
+}
+
+/// 定投状态
+export enum ERegularlyStrategyStatus {
+    /// 1:正常
+    normal = 1,
+    /// 2:暂停
+    resume = 2,
+    /// 3:终止
+    stop = 3,
+}
+
+/// 定投状态
+export enum Etriggerstatus {
+    /// 1:成功
+    success = 1,
+    /// 2:失败
+    failure = 2,
+}
+
+/// 终端来源类型
+export enum ESrcType {
+    /// 1:管理端
+    manager = 1,
+    /// 2:终端
+    client = 2,
+}
+
+/// 定投类型
+export enum ERegularlyMode {
+    /// 按重量
+    Qty = 1,
+    /// 按金额
+    Amount = 2,
+}
+
+/// 定投频率
+export enum ERegularlyCycle {
+    /// 每周
+    Week = 1,
+    /// 每月
+    Month = 2,
+}
+
+/// 合同类型
+export enum EScfContractType {
+    /// 仓单回购
+    SCF_CONTRACT_TYPE_WRR = 1,
+    /// 仓单质押
+    SCF_CONTRACT_TYPE_WRM = 2,
+    /// 合作套保
+    SCF_CONTRACT_TYPE_CH = 3,
+    /// 资金贷款
+    SCF_CONTRACT_TYPE_LOAN = 4,
+    /// 融资单
+    SCF_CONTRACT_TYPE_ORDER = 5,
+    /// 融资回购
+    SCF_CONTRACT_TYPE_ORR = 6,
+}
+
+/// 合同状态
+export enum EScfContractStatus {
+    /// 合同状态 - 1:待确认
+    unConfirmed = 1,
+    /// 2:已确认
+    confirmed = 2,
+    /// 3:确认拒绝
+    refusedConfirmed = 3,
+    /// 4:已支付保证金
+    payedMargin = 4,
+    /// 5:已激活
+    activated = 5,
+    /// 6:已违约
+    defaulted = 6,
+    /// 7:到期结束 8:延期结束 9:违约结束 10:已注销 11:已关闭 99:未提交
+    limitedEnd = 7,
+    /// 8:延期结束
+    delayEnd = 8,
+    /// 9:违约结束
+    defaultedEnd = 9,
+    /// 10:已注销
+    cancelled = 10,
+    /// 11:已关闭
+    closed = 11,
+    /// 99:未提交
+    unsubmit = 99,
+}
+
+/// 提货状态
+export enum EPickUpGoodsStatus {
+    /// 1:正常
+    normal = 1,
+    /// 2:停用
+    stop = 2,
+    /// 3:注销
+    cancel = 3,
+}
+
+
+/// 关联商品类型
+export enum ERelatedGoodsType {
+    /// 期货合约
+    ERMS2_RELATED_GOODS_TYPE_FUTURE = 1,
+    /// 现货品种
+    ERMS2_RELATED_GOODS_TYPE_SPOT = 2,
+}
+
+/// 账户状态
+export enum EAccountStatus {
+    /// 待激活
+    ACCOUNTSTATUS_INACTIVE = 1,
+    /// 待审核
+    ACCOUNTSTATUS_PENDINGAUDIT = 2,
+    /// 待复审
+    ACCOUNTSTATUS_PENDINGREAUDIT = 3,
+    /// 正常
+    ACCOUNTSTATUS_NORMAL = 4,
+    /// 审核拒绝
+    ACCOUNTSTATUS_REJECT = 5,
+    /// 已注销
+    ACCOUNTSTATUS_CANCELLED = 6,
+}
+
+/// 用户类型
+export enum EUserInfoType {
+    /// 个人
+    USERINFOTYPE_PERSON = 1,
+    /// 企业
+    USERINFOTYPE_COMPANY = 2,
+}
+
+/// 仓单贸易议价申请状态
+export enum ETradeBargainApplyStatus {
+    /// 待确认
+    BARGAINAPPLYSTATUS_PENDING = 1,
+    /// 已确认
+    BARGAINAPPLYSTATUS_CONFIRMED = 2,
+    /// 已拒绝
+    BARGAINAPPLYSTATUS_REJECTED = 3,
+    /// 已撤销
+    BARGAINAPPLYSTATUS_CANCEL = 4,
+    /// 系统撤销
+    BARGAINAPPLYSTATUS_SYSCANCEL = 5,
+    /// 处理失败
+    BARGAINAPPLYSTATUS_FAILED = 6,
+}
+
+/// 仓单申请类型- 1:预约入库 2:预约出库 3:入库注册 4:出库注销
+export enum EWRApplyType {
+    /// 预约入库
+    WR_APPLYTYPE_APPOINT_IN = 1,
+    /// 预约出库
+    WR_APPLYTYPE_APPOINT_OUT = 2,
+    /// 入库注册
+    WR_APPLYTYPE_REJIEST_IN = 3,
+    /// 出库注销
+    WR_APPLYTYPE_CANCEL_OUT = 4,
+}
+
+/// 仓单申请状态
+export enum EWRApplyStatus {
+    /// 待初审
+    WR_APPLYSTATUS2_SUBMITTED = 1,
+    /// 初审通过
+    WR_APPLYSTATUS2_PASS = 2,
+    /// 初审拒绝
+    WR_APPLYSTATUS2_REJECT = 3,
+    /// 初审失败
+    WR_APPLYSTATUS2_FAILED = 4,
+    /// 复审通过
+    WR_APPLYSTATUS2_RECONFIRM_OK = 5,
+    /// 复审拒绝
+    WR_APPLYSTATUS2_RECONFIRM_REJECT = 6,
+    /// 复审失败
+    WR_APPLYSTATUS2_RECONFIRM_FAILED = 7,
+    /// 已撤销
+    WR_APPLYSTATUS2_RECONFIRM_CANCEL = 8,
+}
+
+/// 产品类型
+export enum EProductType {
+    /// 标准仓单
+    ERMCP_PRODUCT_TYPE_STANDARD_WR = 1,
+    /// 等标
+    ERMCP_PRODUCT_TYPE_STANDARD = 2,
+    /// 非标
+    ERMCP_PRODUCT_TYPE_NONSTANDARD = 3,
+}
+
+
+/// 订单类型
+export enum EOrderType {
+    /// 市价建仓
+    OPEN_MARKET = 1,
+    /// 限价建仓
+    OPEN_LIMIT = 2,
+    /// 市价平仓
+    CLOSE_MARKET = 3,
+    /// 限价平仓
+    CLOSE_LIMIT = 4,
+    /// 先平后建
+    CLOSETHENOPEN = 5,
+    /// 止盈止损
+    SPSL = 6,
+    /// 交割协议转让
+    DELIVERY_TRANSFER = 7,
+    /// 交割协议平仓
+    DELIVERY_CLOSE = 8,
+    /// 交割成交(所有权)
+    DELIVERY_TRADE = 9,
+    /// 受托市价
+    ENTRUST_MARKET = 10,
+    /// 受托限价
+    ENTRUST_LIMIT = 11,
+    /// 管理端协议转让
+    MANAGE_TRANSFER = 12,
+}
+
+/// 委托来源
+export enum EOrderSrc {
+    /// 客户端
+    ORDERSRC_CLIENT = 1,
+    /// 管理端
+    ORDERSRC_MANAGE = 2,
+    /// 风控服务
+    ORDERSRC_RISK = 3,
+    /// 交割服务
+    ORDERSRC_DELIVERY = 4,
+    /// 交易服务
+    ORDERSRC_TRADE = 5,
+    /// 交易日结
+    ORDERSRC_DAYEND = 6,
+    /// 商品强平
+    ORDERSRC_EXPIREFORCECLOSE = 7,
+    /// 管理端商品退市强平
+    ORDERSRC_MANAGEFORCECLOSE = 8,
+    /// 交易接口
+    ORDERSRC_TRADEINTERFACE = 9,
+    /// 交收服务商被动
+    ORDERSRC_ENTRUSACCEPT = 10,
+    /// 预埋触发
+    ORDERSRC_PREPOSORDER = 11,
+}
+
+/// 运行阶段
+export enum ERunStep {
+    /// 集合竞价
+    RUNSTEP_BIDDINGPRICE = 1,
+    /// 连续竞价(交割)
+    RUNSTEP_BIDDINGCONTINUOUS = 2,
+    /// 补充交割
+    RUNSTEP_SUPPLEMENTDELIVERY = 3,
+    /// 确认行权
+    RUNSTEP_CONFIRMEXERCISE = 4,
+}
+
+/// 止盈止损单单据状态
+export enum ETriggerOrderStatus {
+    /// 待触发
+    Triggering = 1,
+    /// 已触发
+    Triggered = 2,
+    /// 已撤单
+    Canceled = 3,
+    /// 已失效
+    Invalid = 4,
+    /// 委托成功
+    Success = 5,
+    /// 委托失败
+    Failed = 6,
+}
+
+/// 有效类型
+export enum EValidType {
+    /// 当日有效
+    VALIDTYPE_DR = 1,
+    /// 本周有效
+    VALIDTYPE_BZ = 2,
+    /// 指定日期有效
+    VALIDTYPE_ZDRQ = 3,
+    /// 一直有效
+    VALIDTYPE_YZ = 4,
+    /// 指定时间有效
+    VALIDTYPE_GTT = 5,
+}
+
+/// 触发条件
+export  enum ETriggerOperator {
+    /// 大于等于
+    TRIGGEROPERATOR_GREATEROREQUAL = 1,
+    /// 小于等于
+    TRIGGEROPERATOR_LESSOREQUAL = 2,
+}
+
+/// 期权类型
+export enum EOptionType {
+    /// 基金配售
+    OPTIONTYPE_CALL = 1,
+    /// 认沽
+    OPTIONTYPE_PUT = 2,
+    /// 基金配售 + 认沽
+    OPTIONTYPE_CALL_PUT = 3,
+}
+
+/// 升贴水类型
+export enum EPriceMoveType {
+    /// 品牌
+    PRICEMOVETYPE_BRAND = 1,
+    /// 品质
+    PRICEMOVETYPE_QUALITY = 2,
+    /// 规格
+    PRICEMOVETYPE_SPECIFICATION = 3,
+    /// 仓库
+    PRICEMOVETYPE_WAREHOUSE = 4,
+    /// 月份
+    PRICEMOVETYPE_MONTH = 5,
+}
+
+/// 止盈止损委托类型
+export enum ESPSLType {
+    /// 止盈
+    SPSLTYPE_SP = 1,
+    /// 止损
+    SPSLTYPE_SL = 2,
+    /// 撤销
+    SPSLTYPE_CANCEL = 3,
+    /// 止盈止损价
+    SPSLTYPE_SPSL = 4,
+}
+
+/// 履约步骤启动类型
+export enum EStepLanchType {
+    /// 系统自动
+    PERFORMANCE_STEPLANCHTYPE_SYSTEM = 1,
+    /// 手动
+    PERFORMANCE_STEPLANCHTYPE_MANUAL = 2,
+}
+
+/// 仓单贸易类型
+export enum EWRTradeType {
+    /// 挂牌
+    WRTRADEORDERTYPE_LISTING = 1,
+    /// 摘牌
+    WRTRADEORDERTYPE_DELISTING = 2,
+}
+
+/// 成交类型
+export enum ETradeType {
+    /// 正常委托成交
+    NORMAL_ORDER_DEAL = 1,
+    /// 风控斩仓成交
+    DIRECTED_MM_DEAL = 2,
+    /// 修正持仓成交
+    DELIVERY_AGREECLOSE_DEAL = 3,
+    /// 管理端斩仓成交
+    DELIVERY_AGREEREDUCE_DEAL = 4,
+    /// 锁仓赠送成交
+    EXPIRE_FORCE = 5,
+    /// 基金配售
+    RISK_FORCE = 6,
+    /// 场外手动成交
+    AGREECLOSE_MANAGE_DEAL = 7,
+    /// API成交
+    WAREHOUSETOPOSITION = 8,
+    ///  协议转让成交
+    DELIVERY_TRANSFER = 9,
+    /// 受托竞价成交(接单)
+    ENTRUSTBID_ACCEPT = 10,
+    /// 协议转让成交
+    MANAGE_PROTO_TRANSFER = 11,
+    /// 管理端强平成交
+    MANAGE_FORCE_CLOSE = 12,
+    /// 违约平仓成交
+    BREACK_CLOSE = 13,
+    /// 场外期权单向成交
+    TRADETYPE_OPTIONONEWAY = 14,
+    /// 冻结头寸解冻申请
+    TRADETYPE_FREEZEPOS_UNFREEZE_REQUEST = 15,
+    /// 冻结头寸商品配售
+    TRADETYPE_FREEZEPOS_GOODS_RATION = 16,
+    /// 冻结头寸商品转让
+    TRADETYPE_FREEZEPOS_GOODS_TRANSFER = 17,
+    /// 冻结头寸商品回购
+    TRADETYPE_FREEZEPOS_GOODS_BUYBACK = 18,
+    /// 冻结头寸商品提货
+    TRADETYPE_FREEZEPOS_GOODS_PICKUP = 19,
+    /// 冻结头寸结算解冻
+    TRADETYPE_FREEZEPOS_RECKON_UNFREEZE = 20,
+    /// 转换外部商品
+    TRADETYPE_CONVERT_OUTGOODS = 21,
+    /// 预售商品头寸转入
+    TRADETYPE_CP_POSITION_TRANSFER_IN = 22,
+    /// 预售商品头寸转入注销
+    TRADETYPE_CP_POSITION_TRANSFER_IN_CANCEL = 23,
+    /// 预售商品成交
+    TRADETYPE_CP_PRESALE_DEAL = 24,
+    /// 预售商品卖家增加头寸
+    TRADETYPE_CP_PRESALE_SELLER_ADD = 25,
+    /// 预售商品结束清理
+    TRADETYPE_CP_PRESALE_CLEAR = 26,
+    /// 融资买入成交
+    TRADETYPE_FINANCE_ORDERBUY = 27,
+    /// 提货减仓成交
+    TRADETYPE_PICKUP_DEAL = 28,
+}
+
+/// 操作类型
+export enum EOperateType {
+    /// 委托撤单
+    OPERATETYPE_ORDERCANCEL = 1,
+    /// 预埋单撤单
+    PREORDER_ORDERCANCEL = 20,
+}
+
+/// 性别
+export enum ESex {
+    /// 女
+    SEX_FEMALE = 0,
+    /// 男
+    SEX_MALE = 1,
+}
+
+/// 操作类型
+export enum EChannelOperateType {
+    /// 正常下单
+    ORDER = 1,
+    /// 斩仓委托
+    RISK = 2,
+    /// 强平委托
+    TRADE = 3,
+    /// 人工核单
+    MANUAL = 4,
+    /// 止盈止损
+    SPSLOrder = 5,
+    /// API委托
+    API = 6,
+}
+
+/// 下单类型
+export enum EBuildType {
+    /// 建仓
+    BUILDTYPE_OPEN = 1,
+    /// 平仓
+    BUILDTYPE_CLOSE = 2,
+    /// 先平后建
+    BUILDTYPE_CLOSETHENOPEN = 3,
+}
+
+/// 挂牌点选类型
+export enum EListingSelectType {
+    /// 挂牌
+    LISTINGSELECTTYPE_LISTING = 1,
+    /// 摘牌
+    LISTINGSELECTTYPE_DELISTING = 2,
+    /// 先摘后挂
+    LISTINGSELECTTYPE_DELISTINGTHENLISTING = 3,
+}
+
+/// 摘牌类型
+export enum EDelistingType {
+    /// 价格最优
+    DELISTINGTYPE_PRICE = 1,
+    /// 点选成交
+    DELISTINGTYPE_SELECTED = 2,
+}
+
+/// 交货模式
+export enum EPerformanceWay {
+    /// 履约计划
+    PERFORMANCEWAY_PALN_PERFORMANCE = 1,
+    /// 分步履约
+    PERFORMANCEWAY_STEP_PERFORMANCE = 2,
+    /// 分步提货
+    PERFORMANCEWAY_STEP_TAKE = 3,
+}
+
+
+/// 费用算法
+export enum EFeeAlgorithm {
+    /// 比率
+    FEEALGORITHM_RATIO = 1,
+    /// 固定
+    FEEALGORITHM_FIXED = 2,
+}
+
+/// 履约步骤执行方
+export enum EExecuteSide {
+    /// 买方
+    PERFORMANCE_EXECUTESIDE_BUYER = 1,
+    /// 卖方
+    PERFORMANCE_EXECUTESIDE_SELLER = 2,
+}
+
+/// 期货下单价格类型
+export enum ATPPriceType {
+    /// 对手价
+    OPPONENT = 0,
+    /// 最新价
+    LAST = 1,
+    /// 市价
+    MARKET = 2,
+    /// 超价
+    SUPER = 3,
+}
+
+/// 订单操作类型
+export enum EOrderOperateType {
+    /// 正常下单
+    ORDEROPERATETYPE_NORMAL = 1,
+    /// 斩仓
+    ORDEROPERATETYPE_RISK = 2,
+    /// 转单
+    ORDEROPERATETYPE_TRANSFER = 3,
+    /// 结算撤单
+    ORDEROPERATETYPE_RECKON_CANCEL = 4,
+    /// 系统卖出(适用于先平后建的卖出)
+    ORDEROPERATETYPE_SYS_CLOSE = 5,
+    /// 行情源报价
+    ORDEROPERATETYPE_QUOTEPRICE = 6,
+    /// (结算)到期强平
+    ORDEROPERATETYPE_ONTIME_CLOSE = 7,
+    /// (结算)协议转让
+    ORDEROPERATETYPE_DEAL_CLOSE = 8,
+    /// 系统对冲单
+    ORDEROPERATETYPE_SYS_HEDGE = 9,
+    /// (结算)到期无效
+    ORDEROPERATETYPE_RECKON_INVALID = 10,
+    /// 交割协议转让
+    ORDEROPERATETYPE_DELIVERY_TRANSFER = 11,
+    /// 交割协议平仓
+    ORDEROPERATETYPE_DELIVERY_CLOSE = 12,
+    /// 交割成交(所有权)
+    ORDEROPERATETYPE_DELIVERY_TRADE = 13,
+    /// 管理端强行平仓
+    ORDEROPERATETYPE_MANAGEFORCE_CLOSE = 14,
+    /// 管理端协议转让
+    ORDEROPERATETYPE_MANAGE_TRANSFER = 15,
+    /// 管理端强行平仓阶段2
+    ORDEROPERATETYPE_MANAGEFORCE_CLOSE_LEVEL2 = 16,
+    /// 违约平仓
+    ORDEROPERATETYPE_BREACK_CLOSE = 17,
+    /// 管理端强行撤单
+    ORDEROPERATETYPE_MANAGEFORCE_CANCEL = 18,
+    /// 预埋单委托
+    ORDEROPERATETYPE_PREPOSORDER_ORDER = 19,
+    /// 预埋单撤单
+    ORDEROPERATETYPE_PREPOSORDER_CANCEL = 20,
+    /// 风控撤单
+    ORDEROPERATETYPE_RISK_CANCEL = 21,
+    /// (结算)会员到期强平
+    ORDEROPERATETYPE_ONTIME_MEMBER_CLOSE = 22,
+    /// 融资买入
+    ORDEROPERATETYPE_BUYBYFINANCE = 23,
+}
+
+/// 业务类型
+///
+/// - AuthSignup: 三方登录注册业务
+/// - MobileSignin: 手机号码登录
+export enum CheckMobileType {
+    AuthSignup,
+    MobileSignin,
+}
+
+/// 仓库类型
+export enum WareHouseType {
+    /// 厂库
+    factory = 1,
+    /// 自有库
+    own =  2,
+    /// 合作库
+    cooperation = 3,
+}
+
+
+/// 账户类型
+export enum EUserType {
+    /// 交易所
+    USERTYPE_EXCHANGE = 1,
+    /// 机构
+    USERTYPE_AREA = 2,
+    /// 会员子机构
+    USERTYPE_SUBAREA = 3,
+    /// 经纪人
+    USERTYPE_BROKER = 4,
+    /// 投资者
+    USERTYPE_INVESTOR = 5,
+    /// 客户(风管云平台)
+    USERTYPE_CUSTOMER = 6,
+    /// 企业成员(风管云平台)
+    USERTYPE_ENTERPRISE_MEMBERS = 7,
+}
+
+/// 母账号类型
+export enum EHedgeAccountType {
+    /// 下单母账号
+    HEDGEACCOUNTTYPE_NORMAL = 1,
+    /// 跟单母账号
+    HEDGEACCOUNTTYPE_PROGRAMMATIC = 2,
+}
+
+/// 签约状态
+export enum ESignStaus {
+    /// 未签约
+    UNSIGN = 1,
+    /// 签约待审核
+    WAITCONFIRM_SIGN = 2,
+    /// 签约中
+    SIGNING = 3,
+    /// 已签约
+    SIGNED = 4,
+    /// 解约待审核
+    CANCELSIGN = 5,
+    /// 解约中
+    CANCELSIGNING = 6,
+    /// 已解约
+    CANCELSIGNED = 7,
+    /// 已解绑
+    UNBINDED = 8,
+    /// 绑卡中
+    BINGDING = 9,
+    /// 审核拒绝
+    CONFIRM_REFUSE = 10,
+}
+
+/// 关联模式
+export enum ERelateMode {
+    /// 1:自动关联
+    AUTO = 1,
+    /// 2:手动关联
+    MANUAL = 2,
+    /// 3:解绑关联
+    UNLINK = 3,
+}
+
+/// 关联状态
+export enum ELinkStatus {
+    /// 成功
+    SUCCESS = 1,
+    /// 失败
+    FAILD = 2,
+    /// 解绑
+    UNBIND = 3,
+}
+
+
+

+ 6 - 0
src/constants/funcode.ts

@@ -89,4 +89,10 @@ export enum FunCode {
 
     SpotPresalePointPriceReq = 1441877, // 铁合金预售点价请求
     SpotPresalePointPriceRsp = 1441878, // 铁合金预售点价响应
+    OrderReq                 = 196609,  // 交易委托请求(0, 3, 1)
+    OrderRsp                 = 196610,  // 交易委托应答(0, 3, 2)
+    CancelOrderReq           = 196611,  // 撤单请求(0, 3, 3)
+    CancelOrderRsp           = 196612,  // 撤单应答(0, 3, 4)
+    HolderCloseReq           = 196713,  // 按单平仓请求(196713)
+    HolderCloseRsp           = 196714,  // 按单平仓应答(196714)
 } 

+ 1 - 1
src/packages/mobile/views/order/list/components/hisswaporder/detail/Index.vue

@@ -5,7 +5,7 @@
             <template #header>
                 <app-navbar title="详细" @back="closed" />
             </template>
-            <div v-if="selectedRow" class="order-detail__container g-form__container">
+            <div v-if="props" class="order-detail__container g-form__container">
                 <CellGroup title="掉期委托信息">
                     <Cell title="商品代码/名称" :value="selectedRow.goodscode+'/'+selectedRow.goodsname"/>
                     <Cell title="方向" :value="getBuyOrSellName(selectedRow.buyorsell)" />

+ 1 - 1
src/packages/mobile/views/order/list/components/hisswaptrade/detail/Index.vue

@@ -5,7 +5,7 @@
             <template #header>
                 <app-navbar title="详细" @back="closed" />
             </template>
-            <div v-if="selectedRow" class="order-detail__container g-form__container">
+            <div v-if="props" class="order-detail__container g-form__container">
                 <CellGroup title="掉期成交信息">
                     <Cell title="商品代码/名称" :value="selectedRow.goodscode+'/'+selectedRow.goodsname"/>
                     <Cell title="方向" :value="getBuyOrSellName(selectedRow.buyorsell)" />

+ 23 - 3
src/packages/mobile/views/order/list/components/swaporder/detail/Index.vue

@@ -5,7 +5,7 @@
             <template #header>
                 <app-navbar title="详细" @back="closed" />
             </template>
-            <div v-if="selectedRow" class="order-detail__container g-form__container">
+            <div v-if="props" class="order-detail__container g-form__container">
                 <CellGroup title="掉期委托信息">
                     <Cell title="商品代码/名称" :value="selectedRow.goodscode+'/'+selectedRow.goodsname"/>
                     <Cell title="方向" :value="getBuyOrSellName(selectedRow.buyorsell)" />
@@ -21,7 +21,7 @@
                 <Empty />
             </div>
             <template #footer v-if="selectedRow.orderstatus === 3 || selectedRow.orderstatus === 7">
-                <Button type="primary" block round>撤销</Button>
+                <Button type="primary" block round @click="onCancelSumit">撤销</Button>
             </template>
         </app-view>
     </app-modal>
@@ -30,12 +30,15 @@
 <script lang="ts" setup>
 import { shallowRef, PropType } from 'vue'
 import AppModal from '@/components/base/modal/index.vue'
-import { CellGroup, Cell, Button } from 'vant'
+import { CellGroup, Cell, Button, showFailToast } from 'vant'
 import { getBuyOrSellName, getWRTradeOrderStatusName } from '@/constants/order'
 import { formatDate, formatDecimal } from '@/filters'
+import { useCancelOrder } from '@/business/trade'
+import { dialog, fullloading } from '@/utils/vant'
 
 const showModal = shallowRef(true)
 const refresh = shallowRef(false) // 是否刷新父组件数据
+const { cancelSubmit } = useCancelOrder()
 
 const props = defineProps({
     selectedRow: {
@@ -44,6 +47,23 @@ const props = defineProps({
     }
 })
 
+const onCancelSumit = () => {
+    dialog({
+        message: '确认要撤销吗?',
+        showCancelButton: true,
+    }).then(() => {
+        const { orderid = '', marketid = 0 } = props.selectedRow ?? {}
+        /// loding....
+        fullloading((hideLoading) => {
+            cancelSubmit(orderid, marketid).then(() => {
+                hideLoading('撤销成功')
+            }).catch((err) => {
+                showFailToast(err)
+            })
+        })
+    })
+}
+
 // 关闭弹窗
 const closed = (isRefresh = false) => {
     refresh.value = isRefresh

+ 28 - 9
src/packages/mobile/views/order/list/components/swaporder/list/Index.vue

@@ -42,7 +42,7 @@
                 </div>
                 <div class="g-order-list__btnbar">
                     <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
-                    <Button size="small" v-if="(item.orderstatus === 3 || item.orderstatus === 7)" @click="showComponent('cancel', item)" round>撤销</Button>
+                    <Button size="small" v-if="(item.orderstatus === 3 || item.orderstatus === 7)" @click="onCancelSumit(item)" round>撤销</Button>
                 </div>
             </div>
         </div>
@@ -53,19 +53,23 @@
 
 <script lang="ts" setup>
 import { shallowRef, defineAsyncComponent } from 'vue'
-import { Button } from 'vant'
+import { Button, showFailToast } from 'vant'
 import { useComponent } from '@/hooks/component'
 import { useRequest } from '@/hooks/request'
 import { queryTradeOrderDetail } from '@/services/api/order'
-import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { getBuyOrSellName, getWRTradeOrderStatusName } from '@/constants/order'
 import { formatDate, formatDecimal } from '@/filters'
+import { useCancelOrder } from '@/business/trade'
+import { dialog } from '@/utils/vant'
+import { fullloading } from '@/utils/vant'
+
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 
 const componentMap = new Map<string, unknown>([
-    ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))],
-    ['cancel', defineAsyncComponent(() => import('../detail/Index.vue'))],
+    ['detail', defineAsyncComponent(() => import('../detail/Index.vue'))]
 ])
 
+const { cancelSubmit } = useCancelOrder()
 const dataList = shallowRef<Model.TradeOrderDetailRsp[]>([])
 const selectedRow = shallowRef<Model.TradeOrderDetailRsp>()
 const error = shallowRef(false)
@@ -91,10 +95,25 @@ const { loading, pageIndex, pageCount, run } = useRequest(queryTradeOrderDetail,
     }
 })
 
+const onCancelSumit = (item: Model.TradeOrderDetailRsp) => {
+    dialog({
+        message: '确认要撤销吗?',
+        showCancelButton: true,
+    }).then(() => {
+        const { orderid = '', marketid = 0 } = item ?? {}
+        /// loding....
+        fullloading((hideLoading) => {
+            cancelSubmit(orderid, marketid).then(() => {
+                hideLoading('撤销成功')
+            }).catch((err) => {
+                showFailToast(err)
+            })
+        })
+    })
+}
+
 const showComponent = (componentName: string, row: Model.TradeOrderDetailRsp) => {
-    if (componentName === 'detail') {
-        selectedRow.value = row
-        openComponent(componentName)
-    }
+    selectedRow.value = row
+    openComponent(componentName)
 }
 </script>

+ 1 - 1
src/packages/mobile/views/order/list/components/swaptrade/detail/Index.vue

@@ -5,7 +5,7 @@
             <template #header>
                 <app-navbar title="详细" @back="closed" />
             </template>
-            <div v-if="selectedRow" class="order-detail__container g-form__container">
+            <div v-if="props" class="order-detail__container g-form__container">
                 <CellGroup title="掉期成交信息">
                     <Cell title="商品代码/名称" :value="selectedRow.goodscode+'/'+selectedRow.goodsname"/>
                     <Cell title="方向" :value="getBuyOrSellName(selectedRow.buyorsell)" />

+ 1 - 0
src/packages/mobile/views/order/position/components/spot/pickup/Index.vue

@@ -64,6 +64,7 @@ import { validateRules } from '@/constants/regex'
 import { getReceiptTypeName } from '@/constants/receipt'
 import { getAppointmentModelOutList } from '@/constants/order'
 import { useWrOutInApply } from '@/business/trade'
+
 import AppModal from '@/components/base/modal/index.vue'
 import AppSelect from '@mobile/components/base/select/index.vue'
 import AppContact from '@mobile/components/modules/contact/index.vue'

+ 2 - 3
src/packages/mobile/views/swap/detail/Index.vue

@@ -12,8 +12,8 @@
         <div class="trade">
                 <div class="trade-section sell" v-if="dataList.length">
                     <app-list :columns="columns" :data-list="dataList">
-                        <template #operate="{ row }">
-                            <Button size="small" round @click="delisting(row)">摘牌</Button>
+                        <template>
+                            <Button size="small" round>摘牌</Button>
                         </template>
                     </app-list>
                 </div>
@@ -43,7 +43,6 @@ const goodsId = getQueryStringToNumber('id')
 const tabIndex = shallowRef(0)
 const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
 const error = shallowRef(false)
-
 const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
 
 const { pageIndex } = useRequest(queryTjmdTradeOrderDetail, {

+ 22 - 9
src/packages/mobile/views/swap/list/Index.vue

@@ -16,16 +16,18 @@ import { computed } from 'vue'
 import { v4 } from 'uuid'
 import { useRequest } from '@/hooks/request'
 import { queryQuoteGoodsList } from '@/services/api/swap'
-import { useFuturesStore } from '@/stores'
+import { useFuturesStore, useUserStore } from '@/stores'
 import quoteSocket from '@/services/websocket/quote'
 import AppList from '@mobile/components/base/list/index.vue'
 
 const futuresStore = useFuturesStore()
+const userStore = useUserStore()
 const subscribeId = v4()
 
 const { dataList } = useRequest(queryQuoteGoodsList, {
     params: {
         usertype: 0,
+        marketids: userStore.getMarketId('TRADEMODE_TJMD').toString()
     },
     onSuccess: (res) => {
         const goodsCodes = res.data.map((e) => e.refgoodscode)
@@ -35,23 +37,34 @@ const { dataList } = useRequest(queryQuoteGoodsList, {
 })
 
 const tableList = computed(() => {
-    return dataList.value.map(({ goodsid, goodsname, refgoodscode }) => {
+    return dataList.value.map(({ goodsid, goodsname, refgoodscode, decimalplace }) => {
         const quote = futuresStore.getQuoteDayInfoByCode(refgoodscode)
-        const { last = 0 } = quote.value ?? {}
+        const { last = 0, opened = 0, presettle = 0 } = quote.value ?? {}
+        const { change = 0, amplitude = 0 } = futuresStore.quoteList.find(obj => obj.goodscode === refgoodscode) ?? {}
+        const applies = (amplitude*100.0).toFixed(2)
+        const riseValue = change.toFixed(decimalplace)
+        const lastPrice = last.toFixed(decimalplace)
+        const openedPrice = opened.toFixed(decimalplace)
+        const presettlePrice = presettle.toFixed(decimalplace)
+
         return {
             goodsid,
             goodsname,
-            last,
+            lastPrice,
+            riseValue,
+            applies,
+            openedPrice, 
+            presettlePrice,
         }
     })
 })
 
 const columns: Model.TableColumn[] = [
     { prop: 'goodsname', label: '商品/标的' },
-    { prop: 'last', label: '当前价' },
-    { prop: 'goodsid', label: '涨跌' },
-    { prop: 'goodsid', label: '幅度' },
-    { prop: 'goodsid', label: '今开' },
-    { prop: 'goodsid', label: '昨结' },
+    { prop: 'lastPrice', label: '当前价' },
+    { prop: 'riseValue', label: '涨跌' },
+    { prop: 'applies', label: '幅度' },
+    { prop: 'openedPrice', label: '今开' },
+    { prop: 'presettlePrice', label: '昨结' },
 ]
 </script>

+ 34 - 0
src/services/api/trade/index.ts

@@ -165,4 +165,38 @@ export function spotPresalePointPrice(config: RequestConfig<Proto.SpotPresalePoi
         responseCode: 'SpotPresalePointPriceRsp',
         marketId: 64201
     })
+}
+
+/**
+ * 挂牌撤单
+ */
+export function cancelOrder(config: RequestConfig<Proto.CancelOrderReq>, marketid: number) {
+    return http.mqRequest<Proto.CancelOrderRsp>({
+        data: config.data,
+        requestCode: 'CancelOrderReq',
+        responseCode: 'CancelOrderRsp',
+        marketId: marketid
+    })
+}
+
+/**
+ * 交易下单
+ */
+export function order(config: RequestConfig<Proto.OrderReq>) {
+    return http.mqRequest<Proto.OrderRsp>({
+        data: config.data,
+        requestCode: 'OrderReq',
+        responseCode: 'OrderRsp'
+    })
+}
+
+/**
+ * 按单平仓
+ */
+export function holderClose(config: RequestConfig<Proto.HolderCloseReq>) {
+    return http.mqRequest<Proto.HolderCloseRsp>({
+        data: config.data,
+        requestCode: 'HolderCloseReq',
+        responseCode: 'HolderCloseRsp',
+    })
 }

+ 1 - 1
src/stores/modules/futures.ts

@@ -64,7 +64,7 @@ export const useFuturesStore = defineStore(() => {
                 totalturnover,
                 opened,
                 highest,
-                lowest,
+                lowest
             }
             res.push(item)
             return res

+ 8 - 0
src/stores/modules/user.ts

@@ -4,6 +4,7 @@ import { queryLoginData } from '@/services/api/account'
 import { useLoginStore } from './login'
 import { defineStore } from '../store'
 import eventBus from '@/services/bus'
+import { ETradeMode } from '@/constants/client'
 
 /**
  * 用户存储对象
@@ -65,6 +66,12 @@ export const useUserStore = defineStore(() => {
         }
     }
 
+    // 获取市场ID
+    const getMarketId = (tradeMode: keyof typeof ETradeMode) => {
+        const { marketid } = state.userData.markets.find(obj => obj.trademode === ETradeMode[tradeMode]) ?? {}
+        return marketid ?? 0
+    }
+
     // 获取用户数据
     const getUserDataInfo = <K extends keyof Model.LoginQueryRsp>(key: K) => {
         return state.userData[key]!
@@ -92,5 +99,6 @@ export const useUserStore = defineStore(() => {
         getUserDataInfo,
         getSystemParamValue,
         userChangeNtf,
+        getMarketId
     }
 })

+ 100 - 3
src/types/proto/trade.d.ts

@@ -180,14 +180,14 @@ declare global {
 
         // 要素类型明细
         interface DGFactoryItems {
-            DGFactoryItemTypeID: number = 1; // 要素项类型ID
+            DGFactoryItemTypeID: number; // 要素项类型ID
             DGFactoryItemID: number; // 预约要素项类型值
             ItemTypeMode: number; // 要素项类型模式
         }
 
         // 仓单贸易浮动价商品配置信息
         interface WRGoodsInfo {
-            GoodsID: number = 1; // 配置商品ID
+            GoodsID: number; // 配置商品ID
             GoodsCode: string; // 配置商品代码
             PriceFactor: number; // 商品价格系数
             PriceMove: number; // 商品升贴水值
@@ -249,7 +249,7 @@ declare global {
             UserID: number; // 用户ID
             AccountID: number; // 资金账号
             WRTradeOrderID: number; // 仓单贸易委托单ID
-            FreezeQty: number = 7; // 冻结数量
+            FreezeQty: number; // 冻结数量
             OrderTime: string; // 接收委托交易的时间
             ClientSerialNo: string; // 客户端流水号
         }
@@ -393,5 +393,102 @@ declare global {
             WRTradeDetailID: number; // 预售成交明细ID
             ClientSerialNo: string; // 客户端流水号
         }
+
+        // 撤单请求
+        interface CancelOrderReq {
+            Header?: IMessageHead; // 消息头
+            ClientSerialNo?: string; // 客户端流水号
+            ClientOrderTime?: string; // 客户端委托时间
+            ClientType?: number; // 终端类型
+            OperateType?: number; // 操作类型
+            OldOrderId?: string; // 原委托单号
+            AccountID?: number; // 交易账号
+            OrderSrc?: number; // 单据来源
+            OperatorID?: number; // 操作员账号ID
+        }
+
+        // 撤单应答
+        interface CancelOrderRsp {
+            Header?: IMessageHead; // 消息头
+            RetCode?: number; // 返回码
+            RetDesc?: string; // 描述信息
+            ExchActionID?: number; // 交易所操作号
+            OrderTime?: string; // 接收委托交易的时间
+        }
+
+        // 交易委托请求
+        interface OrderReq {
+            Header?: IMessageHead; // 消息头
+            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; // 下单类型
+            CurtQuotePrice?: number; // 保留,计算冻结金额使用
+            SpPrice?: number; // 止盈价格
+            SlPrice?: number; // 止损价格
+            PriceMode?: number; // 取价方式
+            TimevalidType?: number; // 时间有效类型
+            TriggerType?: number; // 预埋单触发类型
+            TriggerPrice?: number; // 预埋单触发价格
+            ListingSelectType?: number; // 挂牌点选类型
+            DelistingType?: number; // 摘牌类型
+            RelatedID?: string; // 关联单号
+            OptionType?: number; // 期权类型(1:认购(看涨)2:认沽(看跌))
+            Premium?: number; // 权利金
+            TriggerOperator?: number; // 触发条件(1:大于等于2:小于等于)
+            ServiceTime?: string; // 服务端时间
+            CouponTypeID?: number; // 优惠券类型ID(买方)
+            UsedQty?: number; // 使用数量
+            ValidTime?: string; // 指定有效日期
+            ReceiveInfoID?: number; // 收货地址ID
+            OrderFlag?: number; // 委托标识-1:按量
+            OrderAmount?: number; // 委托金额OrderFlag=2必填
+        }
+
+        // 交易委托应答
+        interface OrderRsp {
+            Header?: IMessageHead; // 消息头
+            RetCode?: number; // 返回码
+            RetDesc?: string; // 描述信息
+            OrderID?: number; // 一级生成的订单号
+            OrderTime?: string; // 接收委托交易的时间
+        }
+
+        // 按单平仓请求 0 3 105
+        interface HolderCloseReq {
+            Header?: IMessageHead; // 消息头
+            TradeID?: string; // uint64 持仓单号
+            ClientSerialNo?: string; // string 客户端流水号
+            ClientOrderTime?: string; // string 客户端委托时间
+            ClientType?: number; // uint32 终端类型
+            LoginID?: number; // uint64 登陆账号
+            AccountID?: number; // uint64 交易账号
+            GoodsID?: number; // uint32 商品ID
+            BuyOrSell?: number; // uint32 买卖方向
+            MarketID?: number; // uint32 市场ID
+            OrderSrc?: number; // uint32 单据来源
+            OperatorID?: number; // uint64 操作员账号ID
+        }
+        
+        // 按单平仓应答 0 3 106
+        interface HolderCloseRsp {
+            Header?: IMessageHead; // 消息头
+            RetCode?: number; // 返回码
+            RetDesc?: string; // 描述信息
+            OrderID?: number; // 一级生成的订单号
+            OrderTime?: string; // 接收委托交易的时间
+        }
     }
 }