huangbin 4 år sedan
förälder
incheckning
f2eed6827e

+ 56 - 49
src/views/market/spot_trade/components/buy-sell-market/components/delisting/index.vue

@@ -3,8 +3,21 @@
   <Drawer :title="'摘牌'"
           :placement="'top'"
           :visible="visible">
-    <!-- 挂牌 -->
-    摘牌
+    <a-form class="inlineForm dialogForm"
+            ref="formRef">
+      <a-form-item label="摘牌数量">
+        <a-input class="commonInput"
+                 suffix="吨"
+                 v-model:value="num"
+                 style="width: 140px" />
+      </a-form-item>
+      <a-form-item class="tc">
+        <a-button class="listedBtn"
+                  @click="submit">卖出</a-button>
+        <a-button class="ml10 cancelBtn"
+                  @click="cancel">取消</a-button>
+      </a-form-item>
+    </a-form>
   </Drawer>
 </template>
 
@@ -21,10 +34,13 @@ import moment from 'moment';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { HdWRDealOrderReq } from '@/services/proto/warehousetrade/interface';
 import { Long } from '@/services/socket/login/interface/long';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { message } from 'ant-design-vue';
 
 export default defineComponent({
     name: ModalEnum.spot_trade_warehouse_delisting,
     components: { Drawer },
+    emits: ['cancel'],
     props: {
         selectedRow: {
             type: Object as PropType<WrOrderQuoteDetail>,
@@ -36,58 +52,49 @@ export default defineComponent({
         },
     },
 
-    /**
-     *  *             const param = {
-                MarketID: MarketID,
-                AccountID: AccountId.toString(), // 资金账号
-                RelatedWRTradeOrderID: WRTradeOrderID, // 关联委托单号(摘牌委托关联挂牌委托单ID)
-                WRTransferUserID: WRTransferUserID, // 仓单贸易委托单ID
-                OrderQty: OrderQty, // 委托数量
-                OrderSrc: 0, // 委托来源
-                OperatorID: 0, // 操作员账号ID
-                BuyOrSell: enums.BuyOrSell.BuyOrSell_BUY, // 买卖方向
-                ApplyID: 0, // 申请ID
-                TradeDate: moment().format('YYYYMMDD'), // 交易日
-                LadingBillId: LadingBillID,
-                SubNum: 0, // 提单子单号(wrholdlb的SubNum字段),卖的时候填写
-                WRFactorTypeId: WRFactorTypeID,
-            }
-     * @param props
-     */
-    setup(props) {
+    setup(props, context) {
+        const { visible, cancel } = _closeModal(context);
         const data = props.selectedRow;
         console.log('data', data);
-
+        const num = ref<number>(0);
         const loading = ref<boolean>(false);
+        function submit() {
+            if (!num.value) {
+                message.error('请输入数量!');
+                return;
+            }
+            // 摘卖方向
+            const param: HdWRDealOrderReq = {
+                UserID: getUserId(), // uint32 用户ID
+                AccountID: Number(getSelectedAccountId() as Long), // uint64 资金账号
+                RelatedWRTradeOrderID: Number(props.selectedRow.wrtradeorderid), // uint64 关联委托单号(摘牌委托关联挂牌委托单ID)
+                WRTransferUserID: props.selectedRow.userid, // uint32 仓单受让用户
+                OrderQty: num.value, // uint64 委托数量
+                OrderSrc: 0, // uint32 委托来源
+                ClientSerialNo: uuidv4(), // string 客户端流水号
+                ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // string 客户端委托时间
+                ClientType: 4, // uint32 终端类型
+                OperatorID: getUserId(), // uint64 操作员账号ID
+                BuyOrSell: 1, // uint32 买卖方向
+                ApplyID: 0, // uint64 申请ID
+                LadingBillId: 0, // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
+                SubNum: 0, // uint64 提单子单号(wrholdlb的SubNum字段),卖的时候填写
+                WRFactorTypeId: 0, // uint64 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
+                TradeDate: moment().format('YYYYMMDD'), // string 交易日
+                DeliveryMonth: '', // string 交收月
+                HasWr: 1, // uint32 是否有仓单-0:没有仓单 1:有仓单
+            };
+            // console.log(param);
+            requestResultLoadingAndInfo(HdWRDealOrder, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
+                cancel(true);
+            });
+        }
 
-        // 摘卖方向
-        const param: HdWRDealOrderReq = {
-            UserID: getUserId(), // uint32 用户ID
-            AccountID: Number(getSelectedAccountId() as Long), // uint64 资金账号
-            RelatedWRTradeOrderID: Number(props.selectedRow.wrtradeorderid), // uint64 关联委托单号(摘牌委托关联挂牌委托单ID)
-            WRTransferUserID: props.selectedRow.userid, // uint32 仓单受让用户
-            OrderQty: 1, // uint64 委托数量
-            OrderSrc: 0, // uint32 委托来源
-            ClientSerialNo: uuidv4(), // string 客户端流水号
-            ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // string 客户端委托时间
-            ClientType: 4, // uint32 终端类型
-            OperatorID: getUserId(), // uint64 操作员账号ID
-            BuyOrSell: 1, // uint32 买卖方向
-            ApplyID: 0, // uint64 申请ID
-            LadingBillId: 0, // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
-            SubNum: 0, // uint64 提单子单号(wrholdlb的SubNum字段),卖的时候填写
-            WRFactorTypeId: 0, // uint64 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
-            TradeDate: moment().format('YYYYMMDD'), // string 交易日
-            DeliveryMonth: '', // string 交收月
-            HasWr: 1, // uint32 是否有仓单-0:没有仓单 1:有仓单
-        };
-        debugger;
-        // console.log(param);
-        requestResultLoadingAndInfo(HdWRDealOrder, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
-            // cancel(true);
-        });
         return {
-            visible: true,
+            visible,
+            cancel,
+            submit,
+            num,
         };
     },
 });