huangbin %!s(int64=4) %!d(string=hai) anos
pai
achega
a280d37d5f

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

@@ -276,7 +276,7 @@ export default defineComponent({
         const { rules, formState, formRef } = handleForm(props.selectedRow);
         const loading = ref<boolean>(false);
         const { isSale, isBuy } = handleIs(props.enumName, props.buyOrSell);
-        const { wrHoldList } = handleSpotWarrant(props.enumName, props.buyOrSell, props.selectedRow, loading);
+        const { wrHoldList } = handleSpotWarrant(props.enumName, props.buyOrSell, props.parantSelectedRow, loading);
 
         function submit() {
             validateAction<ListingForm>(formRef, formState).then((res) => {

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

@@ -2,7 +2,7 @@ import { BuyOrSell } from "@/common/constants/enumCommon";
 import { EnumRouterName } from "@/common/constants/enumRouterName";
 import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { queryHoldLB } from '@/services/go/wrtrade';
-import { WrHoldLB, WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
+import { WrHoldLB, WrOrderQuote, WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
 import { reactive, Ref, ref, UnwrapRef } from "vue";
 import { ListingForm, Wrhold } from "./interface";
 
@@ -43,13 +43,13 @@ export function handleIs(enumName: EnumRouterName, buyOrSell: BuyOrSell) {
 }
 
 // 处理现货仓单
-export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuoteDetail, loading: Ref<boolean>) {
+export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuote, loading: Ref<boolean>) {
     const { isSale, isBuy } = handleIs(enumName, buyOrSell)
     const wrHoldList = ref<Wrhold[]>([])
     if (isBuy()) {
         if (!isSale()) {
             queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
-                wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === selectedRow.wrtradeorderid).map((e: WrHoldLB) => {
+                wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
                     const { wrholdeno, enableqty, ladingbillid } = e
                     return { id: ladingbillid, name: `${wrholdeno}(${enableqty})` }
                 })

+ 157 - 120
src/views/market/spot_trade/components/post_buying/index.vue

@@ -1,79 +1,97 @@
 <template>
-    <!-- 发布求购 -->
-    <Drawer :title="'发布求购'" :placement="'top'" :visible="visible" @cancel="cancel" class="top">
-        <div class="post_buying">
-            <div class="formBar">
-                <a-form class="inlineForm dialogForm" :form="form">
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="交易账户">
-                                <a-select
-                                    class="inlineFormSelect"
-                                    default-value="1"
-                                    style="width: 260px"
-                                >
-                                    <a-select-option value="1">2647247233 周星星</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="基   差">
-                                <a-input class="commonInput stepper" style="width: 260px" />
-                                <div class="minusBtn">
-                                    <MinusOutlined />
-                                </div>
-                                <div class="plusBtn">
-                                    <PlusOutlined />
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="挂牌数量">
-                                <a-input
-                                    class="commonInput stepper"
-                                    suffix="吨"
-                                    style="width: 260px"
-                                />
-                                <div class="minusBtn">
-                                    <MinusOutlined />
-                                </div>
-                                <div class="plusBtn">
-                                    <PlusOutlined />
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24" class="mt-10">
-                            <a-form-item>
-                                <!-- <a-progress class="formProgress"
-                            :percent="30"
-                                style="width: 260px;" />-->
-                                <a-slider :min="0" :max="300" class="formSlider" />
-                                <div class="unit">
-                                    <span>0</span>
-                                    <span>80吨</span>
-                                </div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="起摘数量" class="relative">
-                                <a-input class="commonInput" suffix="吨" style="width: 260px" />
-                                <div class="tip">最小单位:1吨</div>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-row :gutter="24" type="flex" justify="center">
-                        <a-col :span="24" class="mt20">
-                            <a-form-item class="tc">
-                                <a-button class="listedBtn" @click="submit">买入</a-button>
-                                <a-button class="listedBtn ml10">融资买入</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"
+          @cancel="cancel"
+          class="top">
+    <div class="post_buying">
+      <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-col :span="24"
+                   v-if="isFixed()">
+              <a-form-item label="挂牌价格"
+                           name="FixedPrice">
+                <a-input-number class="commonInput"
+                                style="width: 260px"
+                                v-model:value="formState.FixedPrice" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24"
+                   v-else>
+              <a-form-item label="基差"
+                           name="PriceMove">
+                <a-input-number class="commonInput"
+                                style="width: 260px"
+                                v-model:value="formState.PriceMove" />
+              </a-form-item>
+            </a-col>
+
+            <a-col :span="24">
+              <a-form-item label="挂牌数量"
+                           name="OrderQty">
+                <a-input-number class="commonInput"
+                                style="width: 260px"
+                                v-model:value="formState.OrderQty" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24"
+                   class="mt-10">
+              <a-form-item>
+                <a-slider :min="0"
+                          :max="300"
+                          class="formSlider" />
+                <div class="unit">
+                  <span>0</span>
+                  <span>99999999</span>
+                </div>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="起摘数量"
+                           class="relative">
+                <a-input class="commonInput"
+                         style="width: 260px" />
+                <!-- <div class="tip">最小单位:1吨</div> -->
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24"
+                 type="flex"
+                 justify="center">
+            <a-col :span="24"
+                   class="mt20">
+              <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">
@@ -87,11 +105,15 @@ import { PlusOutlined, MinusOutlined } from '@ant-design/icons-vue';
 import { hdWROrder, wRListingCancelOrder } from '@/services/proto/warehousetrade';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { HdWROrderReq } from '@/services/proto/warehousetrade/interface';
-import { getInTaAccount, getUserId } from '@/services/bus/account';
+import { getAccountTypeList, getInTaAccount, getUserId } from '@/services/bus/account';
 import { v4 as uuidv4 } from 'uuid';
 import moment from 'moment';
 import { getMarketRunByTradeMode } from '@/services/bus/market';
 import { WrOrderQuote } from '@/services/go/wrtrade/interface';
+import { handleForm } from './setup';
+import { validateAction } from '@/common/setup/form';
+import { FormParam } from './interface';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
 
 export default defineComponent({
     emits: ['cancel'],
@@ -102,57 +124,67 @@ export default defineComponent({
             type: Object as PropType<WrOrderQuote>,
             default: {},
         },
+        enumName: {
+            default: '',
+            type: String as PropType<EnumRouterName>,
+        },
     },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
+        const accountList = getAccountTypeList([2]);
+        const { rules, formState, formRef } = handleForm();
+        function isFixed() {
+            return props.enumName === EnumRouterName.warehouse_receipt_trade_price;
+        }
         function submit() {
             const marketInfo = getMarketRunByTradeMode(17);
             if (marketInfo) {
-
-                // 只有有仓单的有求购  无仓单不能求购
-                const param = {
-                    AccountID: getInTaAccount(), // 默认内部资金账号第一个
-                    ClientSerialNo: uuidv4(), // 客户端流水号
-                    // OperateSrc: 2,
-                    ClientType: 4,
-                    // MarketID: marketInfo.marketid,
-                    LadingBillId: 0, // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
-                    // LadingBillId: 'uint642081626946446000001', // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
-                    TradeDate: moment(marketInfo.tradedate).format('YYYYMMDD'), // 交易日 string
-                    // SubNum: '0', // 提单子单号
-                    SubNum: 0,
-                    // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-                    WRFactorTypeId: props.selectedRow.wrfactortypeid, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-                    IsSpecified: 0, // 是否指定对手 0:不指定 1:指定 uint32
-                    // MatchUserIDs: 0, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
-                    OrderQty: 123, // 委托数量(可挂部分数据量) ======
-                    DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID  // 有仓单求购
-                    WRPriceType: 1, // 价格方式 1:固定价 2:浮动价
-                    FixedPrice: 321, // 固定价格
-                    PriceFactor: 1, // 价格系数(浮动价时填写)
-                    PriceMove: 0, // 升贴水(浮动价时填写)
-                    TimevalidType: 4, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
-                    // ValidTime: moment('2021-08-25 00:00:00').format('YYYY-MM-DD HH:mm:ss'), // 有效期限
-                    ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss'),
-                    FirstRatio: 0, // 首付比例
-                    PerformanceTemplateID: 0, // 履约计划模板ID
-                    UserID: getUserId(),
-                    OperatorID: getUserId(), // 操作员账号ID
-                    BuyOrSell: 0, // 买卖方向 0买1卖
-                    PriceDisplayMode: 1, // 浮动价显示方式 1:合并显示 2:分开显示
-                    CanBargain: 0, // 挂牌是否可议价0:不可1:可-摘牌是否议价
-                    Attachment1: '', // 附件1
-                    Attachment2: '', // 附件2
-                    Remark: '222', // 备注
-                    ApplyID: 0, // 申请ID
-                    WRTradeGoods: [],
-                    CanPart: 1, // 是否允许部份摘牌0:不允许;1:允许
-                    WRStandardID: props.selectedRow.wrstandardid,
-                    HasWr: 1, // 无仓单挂牌  是否有无仓单
-                };
-                requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
-                    cancel();
+                validateAction<FormParam>(formRef, formState).then((res) => {
+                    // 只有有仓单的有求购  无仓单不能求购
+                    const param = {
+                        AccountID: res.accountid, // 默认内部资金账号第一个
+                        ClientSerialNo: uuidv4(), // 客户端流水号
+                        // OperateSrc: 2,
+                        ClientType: 4,
+                        // MarketID: marketInfo.marketid,
+                        LadingBillId: 0, // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
+                        // LadingBillId: 'uint642081626946446000001', // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
+                        TradeDate: moment(marketInfo.tradedate).format('YYYYMMDD'), // 交易日 string
+                        // SubNum: '0', // 提单子单号
+                        SubNum: 0,
+                        // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
+                        WRFactorTypeId: props.selectedRow.wrfactortypeid, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
+                        IsSpecified: 0, // 是否指定对手 0:不指定 1:指定 uint32
+                        // MatchUserIDs: 0, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
+                        OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
+                        DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID  // 有仓单求购
+                        WRPriceType: 1, // 价格方式 1:固定价 2:浮动价
+                        FixedPrice: res.FixedPrice, // 固定价格
+                        PriceFactor: 1, // 价格系数(浮动价时填写)
+                        PriceMove: res.PriceMove, // 升贴水(浮动价时填写)
+                        TimevalidType: 4, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
+                        // ValidTime: moment('2021-08-25 00:00:00').format('YYYY-MM-DD HH:mm:ss'), // 有效期限
+                        ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss'),
+                        FirstRatio: 0, // 首付比例
+                        PerformanceTemplateID: 0, // 履约计划模板ID
+                        UserID: getUserId(),
+                        OperatorID: getUserId(), // 操作员账号ID
+                        BuyOrSell: 0, // 买卖方向 0买1卖
+                        PriceDisplayMode: 1, // 浮动价显示方式 1:合并显示 2:分开显示
+                        CanBargain: 0, // 挂牌是否可议价0:不可1:可-摘牌是否议价
+                        Attachment1: '', // 附件1
+                        Attachment2: '', // 附件2
+                        Remark: '222', // 备注
+                        ApplyID: 0, // 申请ID
+                        WRTradeGoods: [],
+                        CanPart: 1, // 是否允许部份摘牌0:不允许;1:允许
+                        WRStandardID: props.selectedRow.wrstandardid,
+                        HasWr: 1, // 无仓单挂牌  是否有无仓单
+                    };
+                    requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
+                        cancel();
+                    });
                 });
             }
         }
@@ -160,6 +192,11 @@ export default defineComponent({
             submit,
             cancel,
             visible,
+            accountList,
+            rules,
+            formState,
+            formRef,
+            isFixed,
         };
     },
 });

+ 6 - 0
src/views/market/spot_trade/components/post_buying/interface.ts

@@ -0,0 +1,6 @@
+export interface FormParam {
+    accountid: undefined | number,
+    FixedPrice: number,
+    OrderQty: number,
+    PriceMove: number,
+}

+ 19 - 0
src/views/market/spot_trade/components/post_buying/setup.ts

@@ -0,0 +1,19 @@
+import { reactive, ref, UnwrapRef } from "vue";
+import { FormParam } from "./interface";
+
+export function handleForm() {
+    const formRef = ref();
+    const formState: UnwrapRef<FormParam> = reactive({
+        accountid: undefined,
+        FixedPrice: 0,
+        OrderQty: 0,
+        PriceMove: 0,
+    })
+    const rules = {
+        FixedPrice: [{ required: true, message: '请输入挂牌价格', trigger: 'blur', type: 'number', }],
+        OrderQty: [{ required: true, message: '请输入挂牌数量', trigger: 'blur', type: 'number', min: 1 }],
+        PriceMove: [{ required: true, message: '请输入基差', trigger: 'blur', type: 'number' }],
+        accountid: [{ required: true, message: '请输入交易账号' }],
+    }
+    return { rules, formState, formRef }
+}