Sfoglia il codice sorgente

修改挂牌求购

huangbin 3 anni fa
parent
commit
a6fa6bdd4b
1 ha cambiato i file con 98 aggiunte e 34 eliminazioni
  1. 98 34
      src/views/market/market-spot/components/post_buying/index.vue

+ 98 - 34
src/views/market/market-spot/components/post_buying/index.vue

@@ -7,22 +7,40 @@
                     <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
+                                    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="!isFloat()">
+                        <a-col :span="24" v-if="getListingMode(ListingMode.fix)">
                             <a-form-item label="挂牌价格" name="FixedPrice">
-                                <a-input-number class="commonInput" style="width: 260px" :min="0" v-model:value="formState.FixedPrice" />
+                                <a-input-number
+                                    class="commonInput"
+                                    style="width: 260px"
+                                    :min="0"
+                                    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-input-number
+                                    class="commonInput"
+                                    style="width: 260px"
+                                    v-model:value="formState.PriceMove"
+                                />
                             </a-form-item>
                         </a-col>
-                        <a-col :span="24" v-if="isFloat()">
+                        <a-col :span="24" v-if="getListingMode(ListingMode.float)">
                             <a-form-item label="估算价">
                                 <span class="white">{{ getPrice() }}</span>
                             </a-form-item>
@@ -30,18 +48,34 @@
 
                         <a-col :span="24">
                             <a-form-item label="挂牌数量" name="OrderQty">
-                                <a-input-number class="commonInput" style="width: 260px" :min="0" :max="getMaxNum()" v-model:value="formState.OrderQty" />
+                                <a-input-number
+                                    class="commonInput"
+                                    style="width: 260px"
+                                    :min="0"
+                                    :max="getMaxNum()"
+                                    v-model:value="formState.OrderQty"
+                                />
                                 <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
                             </a-form-item>
                         </a-col>
-                        <a-col :span="24" v-if="!isWR()">
+                        <a-col :span="24" v-if="getAuctionwrType(AuctionwrType.noWr)">
                             <a-form-item label="交收月" name="DeliveryMonth">
-                                <a-month-picker style="width: 260px" v-model:value="formState.DeliveryMonth" :allowClear="false" class="commonDatePicker dialogDatePicker" />
+                                <a-month-picker
+                                    style="width: 260px"
+                                    v-model:value="formState.DeliveryMonth"
+                                    :allowClear="false"
+                                    class="commonDatePicker dialogDatePicker"
+                                />
                             </a-form-item>
                         </a-col>
                         <a-col :span="24" class="mt-10">
                             <a-form-item>
-                                <a-slider :min="0" v-model:value="formState.OrderQty" :max="getMaxNum()" class="formSlider" />
+                                <a-slider
+                                    :min="0"
+                                    v-model:value="formState.OrderQty"
+                                    :max="getMaxNum()"
+                                    class="formSlider"
+                                />
                                 <div class="unit">
                                     <span>{{ getMaxNum() ? selectedRow.minivalue : 0 }}</span>
                                     <span>{{ getMaxNum() }}{{ selectedRow.enumdicname }}</span>
@@ -50,20 +84,38 @@
                         </a-col>
                         <a-col :span="24">
                             <a-form-item label="起摘数量" name="DelistMinQty" class="relative">
-                                <a-input-number class="commonInput" :suffix="selectedRow.enumdicname" v-model:value="formState.DelistMinQty" :min="0" style="width: 260px !important" />
-                                <div class="tip-listing"> 最小单位:{{ selectedRow.minivalue }}{{ selectedRow.enumdicname }}</div>
+                                <a-input-number
+                                    class="commonInput"
+                                    :suffix="selectedRow.enumdicname"
+                                    v-model:value="formState.DelistMinQty"
+                                    :min="0"
+                                    style="width: 260px !important"
+                                />
+                                <div
+                                    class="tip-listing"
+                                >最小单位:{{ selectedRow.minivalue }}{{ selectedRow.enumdicname }}</div>
                             </a-form-item>
                         </a-col>
                         <a-col :span="24">
                             <a-form-item label="履约方式" class="inputIconBox">
-                                <span :class="['clickBox', formState.permanceTempName ? 'white' : '']" style="width: 260px" @click="handlePermance">{{ formState.permanceTempName ? formState.permanceTempName : '选择履约模板' }}</span>
-                                <svg class="icon svg-icon" aria-hidden="true" @click="handlePermance">
+                                <span
+                                    :class="['clickBox', formState.permanceTempName ? 'white' : '']"
+                                    style="width: 260px"
+                                    @click="handlePermance"
+                                >{{ formState.permanceTempName ? formState.permanceTempName : '选择履约模板' }}</span>
+                                <svg
+                                    class="icon svg-icon"
+                                    aria-hidden="true"
+                                    @click="handlePermance"
+                                >
                                     <use xlink:href="#icon-moban" />
                                 </svg>
                             </a-form-item>
                         </a-col>
                         <a-col :span="24" class="relative mt20">
-                            <a-form-item :label="isFloat() ? '估算金额' : '挂牌金额'">
+                            <a-form-item
+                                :label="getListingMode(ListingMode.float) ? '估算金额' : '挂牌金额'"
+                            >
                                 <span class="white ml8">{{ getMoney() }}</span>
                             </a-form-item>
                         </a-col>
@@ -103,7 +155,12 @@
         </div>
     </Drawer>
     <!-- 选择履约模板 -->
-    <Permance v-if="showPermance" :marketid="formState.marketid" @cancel="choosePermance" @update="choosePermance" />
+    <Permance
+        v-if="showPermance"
+        :marketid="formState.marketid"
+        @cancel="choosePermance"
+        @update="choosePermance"
+    />
 </template>
 
 <script lang="ts">
@@ -126,7 +183,8 @@ import { validateAction } from '@/common/setup/form';
 import { FormParam, TempWrOrderQuoteDetail } from './interface';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { handleIs } from '../buy-sell-market/setup';
-import { BuyOrSell } from '@/common/constants/enumCommon';
+import { getAuctionwrType, getListingMode } from '@/views/market/market-spot/setup'
+import { BuyOrSell, ListingMode, AuctionwrType } from '@/common/constants/enumCommon';
 import { getCanUseMoney } from '@/services/bus/account';
 import { message } from 'ant-design-vue';
 import Permance from '@/common/components/permanceTemp/choosePermancePlanTmp.vue';
@@ -159,7 +217,6 @@ export default defineComponent({
     },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
-        const { isWR, isFloat } = handleIs(props.enumName, BuyOrSell.buy);
         const { rules, formState, formRef } = handleForm(props.selectedRow);
         const loading = ref<boolean>(false);
         const accountList = getAccountTypeList([2]);
@@ -175,8 +232,8 @@ export default defineComponent({
         const market = getMarketByTradeMode(17);
         if (market) {
             formState.marketid = market.marketid;
-        }else{
-           message.error('市场信息异常,请稍后重试');
+        } else {
+            message.error('市场信息异常,请稍后重试');
         }
 
         const { getMaxNum, getMoney, getMargin, getPrice } = handleNumAndPrice(props.enumName, props.selectedRow);
@@ -239,7 +296,7 @@ export default defineComponent({
                         // MatchUserIDs: 0, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
                         OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
                         DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID  // 有仓单求购
-                        WRPriceType: isFloat() ? 2 : 1, // 价格方式 1:固定价 2:浮动价
+                        WRPriceType: getListingMode(ListingMode.float) ? 2 : 1, // 价格方式 1:固定价 2:浮动价
                         FixedPrice: res.FixedPrice, // 固定价格
                         PriceFactor: 1, // 价格系数(浮动价时填写)
                         PriceMove: res.PriceMove ? res.PriceMove : 0, // 升贴水(浮动价时填写)
@@ -257,21 +314,21 @@ export default defineComponent({
                         Attachment2: '', // 附件2
                         Remark: '', // 备注
                         ApplyID: 0, // 申请ID
-                        WRTradeGoods: isFloat() ? [wrGoodsInfo] : [],
+                        WRTradeGoods: getListingMode(ListingMode.float) ? [wrGoodsInfo] : [],
                         CanPart: 1, // 是否允许部份摘牌0:不允许;1:允许
                         WRStandardID: props.selectedRow.wrstandardid,
-                        HasWr: isWR(), // 无仓单挂牌  是否有无仓单
+                        HasWr: getAuctionwrType(AuctionwrType.hasWr) ? 1 : 0, // 无仓单挂牌  是否有无仓单
                         DelistMinQty: res.DelistMinQty, // 起摘数量
-                        DeliveryMonth: isWR() ? '' : moment(res.DeliveryMonth).format('YYYY-MM'),
+                        DeliveryMonth: getAuctionwrType(AuctionwrType.hasWr) ? '' : moment(res.DeliveryMonth).format('YYYY-MM'),
                         FactoryItems:
                             props.selectedRow.wrResult != undefined
                                 ? props.selectedRow.wrResult.flatMap((it) => {
-                                      return {
-                                          DGFactoryItemTypeID: it.dgfactoryitemtypeid, // uint64 要素项类型ID
-                                          DGFactoryItemID: it.dgfactoryitemid, // uint64 预约要素项类型值
-                                          ItemTypeMode: 1, // uint32 要素项类型模式
-                                      };
-                                  })
+                                    return {
+                                        DGFactoryItemTypeID: it.dgfactoryitemtypeid, // uint64 要素项类型ID
+                                        DGFactoryItemID: it.dgfactoryitemid, // uint64 预约要素项类型值
+                                        ItemTypeMode: 1, // uint32 要素项类型模式
+                                    };
+                                })
                                 : [], // DGFactoryItems 要素类型明细集合(没有仓单要素ID填写)
                     };
                     requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
@@ -289,8 +346,6 @@ export default defineComponent({
             rules,
             formState,
             formRef,
-            isFloat,
-            isWR,
             getMaxNum,
             getMoney,
             getMargin,
@@ -300,6 +355,7 @@ export default defineComponent({
             showPermance,
             handlePermance,
             choosePermance,
+            getAuctionwrType, getListingMode, ListingMode, AuctionwrType,
         };
     },
 });
@@ -366,14 +422,22 @@ export default defineComponent({
     text-align: center;
     border: 0;
     &:hover {
-        background: linear-gradient(0deg, @m-blue0-hover 0%, @m-blue2-hover 100%);
+        background: linear-gradient(
+            0deg,
+            @m-blue0-hover 0%,
+            @m-blue2-hover 100%
+        );
         color: @m-white0-hover;
     }
 }
 .cancelBtn:extend(.listedBtn) {
     background: linear-gradient(0deg, @m-grey12 0%, @m-grey13 100%) !important;
     &:hover {
-        background: linear-gradient(0deg, @m-grey12-hover 0%, @m-grey13-hover 100%) !important;
+        background: linear-gradient(
+            0deg,
+            @m-grey12-hover 0%,
+            @m-grey13-hover 100%
+        ) !important;
         color: @m-white0-hover;
     }
 }