huangbin 4 vuotta sitten
vanhempi
commit
5983b71166

+ 6 - 6
src/services/proto/warehousetrade/interface.ts

@@ -32,8 +32,8 @@ export interface HdWROrderReq {
     Remark: string; // string 备注
     ApplyID: number; // uint64 申请ID
     CanPart: number; // uint32 是否允许部份摘牌0:不允许;1:允许
-    MatchAccIDsString : string; // string 仓单贸易对手用户ID集合(指定对手时填写)
-    DeliveryMonth : string; // string 交收月
+    MatchAccIDsString: string; // string 仓单贸易对手用户ID集合(指定对手时填写)
+    DeliveryMonth: string; // string 交收月
     HasWr: number; // uint32 是否有仓单-0:没有仓单 1:有仓单
     WRStandardID: number; // uint32 现货品种ID
     FactoryItems: DGFactoryItems; // DGFactoryItems 要素类型明细集合(没有仓单要素ID填写)
@@ -50,7 +50,7 @@ export interface HdWROrderRsp {
     ClientSerialNo: string; // string 客户端流水号
 }
 // 持仓单摘牌请求 0 22 17
-export interface  HdWRDealOrderReq {
+export interface HdWRDealOrderReq {
     UserID: number; // uint32 用户ID
     AccountID: number; // uint64 资金账号
     RelatedWRTradeOrderID: string; // uint64 关联委托单号(摘牌委托关联挂牌委托单ID)
@@ -63,7 +63,7 @@ export interface  HdWRDealOrderReq {
     OperatorID: number; // uint64 操作员账号ID
     BuyOrSell: number; // uint32 买卖方向
     ApplyID: number; // uint64 申请ID
-    LadingBillId: number; // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
+    LadingBillId?: string; // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
     SubNum: number; // uint64 提单子单号(wrholdlb的SubNum字段),卖的时候填写
     WRFactorTypeId: number; // uint64 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
     TradeDate: string; // string 交易日
@@ -73,7 +73,7 @@ export interface  HdWRDealOrderReq {
 // 持仓单摘牌应答 0 22 18
 export interface HdWRDealOrderRsp {
     RetCode: number; // int32 返回码
-    RetDesc : string; // string 描述信息
+    RetDesc: string; // string 描述信息
     UserID: number; // uint32 用户ID
     AccountID: number; // uint64 资金账号
     WRTradeOrderID: number; // uint64 仓单贸易委托单ID
@@ -154,7 +154,7 @@ export interface WRListingCancelOrderRsp {
     RetCode: number; // int32 返回码
     RetDesc: string; // string 描述信息
     WRTradeCancelID: number; // uint64 仓单贸易撤单号
-    OldWRTradeOrderID : number; // uint64 目标仓单贸易委托单ID
+    OldWRTradeOrderID: number; // uint64 目标仓单贸易委托单ID
     UserID: number; // uint32 用户ID
     AccountID: number; // uint64 资金账号
     CancelQty: number; // uint64 撤单数量

+ 126 - 128
src/views/market/spot_trade/components/buy-sell-market/components/delisting/index.vue

@@ -1,122 +1,5 @@
 <template>
-    <!-- 仓单贸易&仓单预售 买/卖 摘牌 -->
-    <Drawer
-        :title="'摘牌'"
-        :placement="'top'"
-        :visible="visible"
-        width="486px"
-        height="479px"
-        @cancel="cancel"
-        class="top"
-    >
-        <div class="delisting">
-            <div class="formBar">
-                <a-form
-                    class="inlineForm dialogForm"
-                    ref="formRef"
-                    :model="formState"
-                    :rules="rules"
-                >
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="交易账户" name="accountid">
-                                <a-select
-                                    class="inlineFormSelect"
-                                    style="width: 260px"
-                                    v-model:value="formState.accountid"
-                                    placeholder="请选择"
-                                >
-                                    <a-select-option
-                                        v-for="item in accountList"
-                                        :value="item.accountid"
-                                        :key="item.accountid"
-                                    >{{item.accountid}}</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="挂牌方">
-                                <span class="white">{{selectedRow.username}}</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="挂牌价格">
-                                <span class="yellow">{{selectedRow.fixedprice}}</span>
-                            </a-form-item>
-                            <a-row :gutter="24">
-                                <a-col :span="24"></a-col>
-                            </a-row>
-                            <a-form-item label="挂牌数量">
-                                <span class="white">{{selectedRow.orderqty}}吨</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="现货仓单" name>
-                                <a-select
-                                    class="inlineFormSelect"
-                                    style="width: 260px"
-                                    placeholder="请选择"
-                                >
-                                    <a-select-option value="8271930000-01(120吨)">8271930000-01(120吨)</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="摘牌数量" name="num">
-                                <a-input-number
-                                    class="dialogInput"
-                                    style="width: 260px"
-                                    v-model:value="formState.num"
-                                    suffix="吨"
-                                />
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt-20">
-                            <a-form-item>
-                                <a-slider
-                                    :min="0"
-                                    v-model:value="formState.num"
-                                    :max="selectedRow.orderqty"
-                                    class="formSlider"
-                                />
-                                <div class="unit">
-                                    <span>1</span>
-                                    <span>{{selectedRow.orderqty}}</span>
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">&nbsp;</a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt-20">
-                            <a-form-item label="挂牌金额">
-                                <span class="white">50400.00</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <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-col>
-                    </a-row>
-                </a-form>
-            </div>
-        </div>
-    </Drawer>
-  <!-- 仓单贸易  一口价    摘牌 -->
+  <!-- 仓单贸易&仓单预售 买/卖 摘牌 -->
   <Drawer :title="'摘牌'"
           :placement="'top'"
           :visible="visible"
@@ -165,8 +48,7 @@
               </a-form-item>
             </a-col>
           </a-row>
-          <a-row :gutter="24"
-                 v-if="isBuy()">
+          <a-row :gutter="24">
             <a-col :span="24">
               <a-form-item label="现货仓单"
                            name>
@@ -227,6 +109,124 @@
       </div>
     </div>
   </Drawer>
+  <!-- 仓单贸易  一口价    摘牌 -->
+  <Drawer :title="'摘牌'"
+          :placement="'top'"
+          :visible="visible"
+          width="486px"
+          height="479px"
+          @cancel="cancel"
+          class="top">
+    <div class="delisting">
+      <div class="formBar">
+        <a-form class="inlineForm dialogForm"
+                ref="formRef"
+                :model="formState"
+                :rules="rules">
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="交易账户"
+                           name="accountid">
+                <a-select class="inlineFormSelect"
+                          style="width: 260px"
+                          v-model:value="formState.accountid"
+                          placeholder="请选择">
+                  <a-select-option v-for="item in accountList"
+                                   :value="item.accountid"
+                                   :key="item.accountid">
+                    {{item.accountid}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="挂牌方">
+                <span class="white">{{selectedRow.username}}</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="挂牌价格">
+                <span class="yellow">{{selectedRow.fixedprice}}</span>
+              </a-form-item>
+              <a-row :gutter="24">
+                <a-col :span="24"></a-col>
+              </a-row>
+              <a-form-item label="挂牌数量">
+                <span class="white">{{selectedRow.orderqty}}吨</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24"
+                 v-if="isSale() && !isSale()">
+            <a-col :span="24">
+              <a-form-item label="现货仓单"
+                           name="LadingBillId">
+                <a-select class="inlineFormSelect"
+                          style="width: 260px"
+                          v-model:value="formState.LadingBillId"
+                          placeholder="请选择">
+                  <a-select-option v-for="item in wrHoldList"
+                                   :value="item.id"
+                                   :key="item.id">
+                    {{item.name}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="摘牌数量"
+                           name="num">
+                <a-input-number class="dialogInput"
+                                style="width: 260px"
+                                v-model:value="formState.num"
+                                suffix="吨" />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="mt-20">
+              <a-form-item>
+                <a-slider :min="0"
+                          v-model:value="formState.num"
+                          :max="selectedRow.orderqty"
+                          class="formSlider" />
+                <div class="unit">
+                  <span>1</span>
+                  <span>{{selectedRow.orderqty}}</span>
+                </div>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">&nbsp;</a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="mt-20">
+              <a-form-item label="挂牌金额">
+                <span class="white">50400.00</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <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-col>
+          </a-row>
+        </a-form>
+      </div>
+    </div>
+  </Drawer>
 </template>
 
 <script lang="ts">
@@ -242,11 +242,9 @@ import moment from 'moment';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { HdWRDealOrderReq } from '@/services/proto/warehousetrade/interface';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { message } from 'ant-design-vue';
-import { handleForm, handleIs } from './setup';
+import { handleForm, handleIs, handleSpotWarrant } from './setup';
 import { validateAction } from '@/common/setup/form';
 import { ListingForm } from './interface';
-import Long from 'long';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 export default defineComponent({
@@ -275,11 +273,10 @@ export default defineComponent({
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         const accountList = getAccountTypeList([2]);
-        const data = props.selectedRow;
         const { rules, formState, formRef } = handleForm(props.selectedRow);
-        console.log('data', data);
         const loading = ref<boolean>(false);
         const { isSale, isBuy } = handleIs(props.enumName, props.buyOrSell);
+        const { wrHoldList } = handleSpotWarrant(props.enumName, props.buyOrSell, props.selectedRow);
 
         function submit() {
             validateAction<ListingForm>(formRef, formState).then((res) => {
@@ -298,7 +295,7 @@ export default defineComponent({
                     OperatorID: getUserId(), // uint64 操作员账号ID
                     BuyOrSell: 0, // uint32 买卖方向
                     ApplyID: 0, // uint64 申请ID
-                    LadingBillId: 0, // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
+                    // LadingBillId: 0, // uint64 提单id(wrholdlb的LadingBillId字段),卖的时候填写
                     SubNum: 0, // uint64 提单子单号(wrholdlb的SubNum字段),卖的时候填写
                     WRFactorTypeId: props.parantSelectedRow.wrfactortypeid, // uint64 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
                     TradeDate: moment().format('YYYYMMDD'), // string 交易日
@@ -309,7 +306,7 @@ export default defineComponent({
                 // 摘买方向
                 if (isBuy()) {
                     param.BuyOrSell = 1;
-                    param.LadingBillId = Long.fromString('2081627550296000001');
+                    param.LadingBillId = res.LadingBillId;
                 } else {
                     param.BuyOrSell = 0;
                 }
@@ -324,8 +321,9 @@ export default defineComponent({
             visible,
             cancel,
             accountList,
+            wrHoldList,
             submit,
-            isBuy,
+            isSale,
             rules,
             formState,
             formRef,

+ 6 - 0
src/views/market/spot_trade/components/buy-sell-market/components/delisting/interface.ts

@@ -1,4 +1,10 @@
 export interface ListingForm {
     accountid: undefined | number,
     num: number,
+    LadingBillId: string,
+}
+
+export interface Wrhold {
+    id: string,
+    name: string,
 }

+ 24 - 2
src/views/market/spot_trade/components/buy-sell-market/components/delisting/setup.ts

@@ -1,17 +1,21 @@
 import { BuyOrSell } from "@/common/constants/enumCommon";
 import { EnumRouterName } from "@/common/constants/enumRouterName";
-import { WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
+import { queryTableList } from '@/common/export/commonTable';
+import { queryHoldLB } from '@/services/go/wrtrade';
+import { WrHoldLB, WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
 import { reactive, ref, UnwrapRef } from "vue";
-import { ListingForm } from "./interface";
+import { ListingForm, Wrhold } from "./interface";
 
 export function handleForm(data: WrOrderQuoteDetail) {
     const formRef = ref();
     const formState: UnwrapRef<ListingForm> = reactive({
         accountid: undefined,
         num: 0,
+        LadingBillId: '',
     })
     const rules = {
         accountid: [{ required: true, message: '请选择交易账户' }],
+        LadingBillId: [{ required: true, message: '请选择现货仓单' }],
         num: [{ required: true, message: '请输入摘牌数量', trigger: 'blur', type: 'number', min: 1, ma: data.orderqty }],
 
     }
@@ -36,4 +40,22 @@ export function handleIs(enumName: EnumRouterName, buyOrSell: BuyOrSell) {
         return buyOrSell === BuyOrSell.buy
     }
     return { isSale, isBuy }
+}
+
+// 处理现货仓单
+export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuoteDetail) {
+    const { isSale, isBuy } = handleIs(enumName, buyOrSell)
+    const wrHoldList = ref<Wrhold[]>([])
+    if (isBuy()) {
+        if (isSale()) {
+            const { queryTable } = queryTableList<WrHoldLB>();
+            queryTable(queryHoldLB).then(res => {
+                wrHoldList.value = res.filter(e => e.wrfactortypeid === selectedRow.wrtradeorderid).map(e => {
+                    const { wrholdeno, enableqty, ladingbillid } = e
+                    return { id: ladingbillid, name: `${wrholdeno}(${enableqty})` }
+                })
+            })
+        }
+    }
+    return { wrHoldList }
 }