ソースを参照

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/MTP2.0_WEB

jk 4 年 前
コミット
08978b1ac7

+ 1 - 1
src/common/components/drawer/index.vue

@@ -263,7 +263,7 @@ export default defineComponent({
         right: 0;
     }
 }
-.bottomListed.delistingBottom {
+.bottomListed.delistingBottom,.bottomListed.top486,.bottomListed.top600 {
     .position(fixed, auto, 0, -2px, auto);
     width: 100%;
     height: 100%;

+ 141 - 136
src/views/market/spot_trade/components/post_buying/index.vue

@@ -1,116 +1,78 @@
 <template>
-  <!-- 挂牌求购 -->
-  <Drawer :title="'挂牌求购'"
-          :placement="'right'"
-          :visible="visible"
-          @cancel="cancel"
-          class="top">
-    <div class="post_buying">
-      <a-form class="inlineForm dialogForm"
-              ref="formRef"
-              :model="formState"
-              :rules="rules">
-        <div class="formBar">
-          <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="!isFloat()">
-              <a-form-item label="挂牌价格"
-                           name="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-form-item>
-            </a-col>
-            <a-col :span="24"
-                   v-if="isFloat()">
-              <a-form-item label="估算价">
-                <span class="white">{{ getPrice() }}</span>
-              </a-form-item>
-            </a-col>
+    <!-- 挂牌求购 -->
+    <Drawer :title="'挂牌求购'" :placement="'right'" :visible="visible" @cancel="cancel" class="top">
+        <div class="post_buying">
+            <a-form class="inlineForm dialogForm" ref="formRef" :model="formState" :rules="rules">
+                <div class="formBar">
+                    <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="!isFloat()">
+                            <a-form-item label="挂牌价格" name="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-form-item>
+                        </a-col>
+                        <a-col :span="24" v-if="isFloat()">
+                            <a-form-item label="估算价">
+                                <span class="white">{{ getPrice() }}</span>
+                            </a-form-item>
+                        </a-col>
 
-            <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" />
-                <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="24"
-                   v-if="!isWR()">
-              <a-form-item label="交收月"
-                           name="DeliveryMonth">
-                <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" />
-                <div class="unit">
-                  <span>{{ getMaxNum() ? selectedRow.minivalue : 0 }}</span>
-                  <span>{{ getMaxNum() }}{{ selectedRow.enumdicname }}</span>
-                </div>
-              </a-form-item>
-            </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-form-item>
-            </a-col>
-            <a-col :span="24"
-                   class="relative mt20">
-              <a-form-item :label="isFloat() ? '估算金额' : '挂牌金额'">
-                <span class="white ml8">{{ getMoney() }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="24"
-                   v-if="getMargin()">
-              <a-form-item :label="getMargin() ? '履约保证金' : ''">
-                <!-- <a-row>
+                        <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" />
+                                <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="24" v-if="!isWR()">
+                            <a-form-item label="交收月" name="DeliveryMonth">
+                                <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" />
+                                <div class="unit">
+                                    <span>{{ getMaxNum() ? selectedRow.minivalue : 0 }}</span>
+                                    <span>{{ getMaxNum() }}{{ selectedRow.enumdicname }}</span>
+                                </div>
+                            </a-form-item>
+                        </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-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">
+                                    <use xlink:href="#icon-moban" />
+                                </svg>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="24" class="relative mt20">
+                            <a-form-item :label="isFloat() ? '估算金额' : '挂牌金额'">
+                                <span class="white ml8">{{ getMoney() }}</span>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="24" v-if="getMargin()">
+                            <a-form-item :label="getMargin() ? '履约保证金' : ''">
+                                <!-- <a-row>
                                 <a-col :span="8">-->
-                <span class="white ml8">{{ getMargin() }}</span>
-                <!-- </a-col>
+                                <span class="white ml8">{{ getMargin() }}</span>
+                                <!-- </a-col>
                                     <a-col :span="4" class="tr">
                                         <span class="grey1">可用资金</span>
                                     </a-col>
@@ -120,31 +82,28 @@
                                         >{{getCanUseMoney(getSelectedAccount())}}</span>
                                     </a-col>
                                 </a-row>-->
-              </a-form-item>
-            </a-col>
-            <a-col :span="24">
-              <a-form-item label="可用资金">
-                <span class="white ml8">{{ getCanUseMoney(getSelectedAccount()) }}</span>
-              </a-form-item>
-            </a-col>
-          </a-row>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :span="24">
+                            <a-form-item label="可用资金">
+                                <span class="white ml8">{{ getCanUseMoney(getSelectedAccount()) }}</span>
+                            </a-form-item>
+                        </a-col>
+                    </a-row>
+                </div>
+                <a-row :gutter="24">
+                    <a-col :span="24" class="fixedBtns">
+                        <a-form-item class="btnCenter">
+                            <a-button class="listedBtn" @click="submit" :loading="loading">买入</a-button>
+                            <a-button class="ml10 cancelBtn" @click="cancel" :disabled="loading">取消</a-button>
+                        </a-form-item>
+                    </a-col>
+                </a-row>
+            </a-form>
         </div>
-        <a-row :gutter="24">
-          <a-col :span="24"
-                 class="fixedBtns">
-            <a-form-item class="btnCenter">
-              <a-button class="listedBtn"
-                        @click="submit"
-                        :loading="loading">买入</a-button>
-              <a-button class="ml10 cancelBtn"
-                        @click="cancel"
-                        :disabled="loading">取消</a-button>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-  </Drawer>
+    </Drawer>
+    <!-- 选择履约模板 -->
+    <Permance v-if="showPermance" :marketid="formState.marketid" @cancel="choosePermance" @update="choosePermance" />
 </template>
 
 <script lang="ts">
@@ -169,11 +128,21 @@ import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { handleIs } from '../buy-sell-market/setup';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { getCanUseMoney } from '@/services/bus/account';
+import { message } from 'ant-design-vue';
+import Permance from '@/common/components/permanceTemp/choosePermancePlanTmp.vue';
+import { QueryPermancePlanTmpRsp } from '@/services/go/wrtrade/interface';
+import { getMarketByTradeMode } from '@/services/bus/market';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
     name: ModalEnum.spot_trade_warehouse_post_buying,
-    components: { Des, Drawer, PlusOutlined, MinusOutlined },
+    components: {
+        Des,
+        Drawer,
+        Permance,
+        PlusOutlined,
+        MinusOutlined,
+    },
     props: {
         selectedRow: {
             type: Object as PropType<TempWrOrderQuoteDetail>,
@@ -202,10 +171,42 @@ export default defineComponent({
         }
         formState.DeliveryMonth = props.selectedRow.deliverymonth ? moment(props.selectedRow.deliverymonth) : props.time;
 
+        // 17=仓单贸易市场
+        const market = getMarketByTradeMode(17);
+        if (market) {
+            formState.marketid = market.marketid;
+        }else{
+           message.error('市场信息异常,请稍后重试');
+        }
+
         const { getMaxNum, getMoney, getMargin, getPrice } = handleNumAndPrice(props.enumName, props.selectedRow);
         if (getMaxNum()) {
             formState.OrderQty = props.selectedRow.minivalue;
         }
+
+        const showPermance = ref<boolean>(false);
+        function choosePermance(value: QueryPermancePlanTmpRsp | false) {
+            if (value) {
+                formState.permanceTempName = value.templatename;
+                formState.permaceTempId = value.autoid;
+            }
+            showPermance.value = false;
+        }
+        function openPermance() {
+            showPermance.value = true;
+        }
+
+        // 点选履约模板
+        function handlePermance() {
+            // 必须先选择市场再选择对应的履约模板
+            if (!formState.marketid) {
+                message.info('请先选择市场');
+                return;
+            }
+
+            openPermance();
+        }
+
         function submit() {
             const marketInfo = getMarketRunByTradeMode(17);
             if (marketInfo) {
@@ -225,6 +226,7 @@ export default defineComponent({
                         ClientSerialNo: uuidv4(), // 客户端流水号
                         // OperateSrc: 2,
                         ClientType: 4,
+                        MarketID: res.marketid,
                         // MarketID: marketInfo.marketid,
                         LadingBillId: 0, // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
                         // LadingBillId: 'uint642081626946446000001', // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
@@ -245,7 +247,7 @@ export default defineComponent({
                         // 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
+                        PerformanceTemplateID: res.permaceTempId, // 履约计划模板ID
                         UserID: getUserId(),
                         OperatorID: getUserId(), // 操作员账号ID
                         BuyOrSell: 0, // 买卖方向 0买1卖
@@ -295,6 +297,9 @@ export default defineComponent({
             getSelectedAccount,
             getCanUseMoney,
             getPrice,
+            showPermance,
+            handlePermance,
+            choosePermance,
         };
     },
 });

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

@@ -8,6 +8,9 @@ export interface FormParam {
     PriceMove: number,
     DeliveryMonth: Moment,
     DelistMinQty: number,
+    permanceTempName:string;
+    permaceTempId:number;
+    marketid:number | undefined;
 }
 
 

+ 12 - 2
src/views/market/spot_trade/components/post_buying/setup.ts

@@ -19,7 +19,10 @@ function initFormData(): FormParam {
         OrderQty: 0,
         PriceMove: 0,
         DelistMinQty: 0,
-        DeliveryMonth: moment()
+        DeliveryMonth: moment(),
+        permanceTempName: '',
+        permaceTempId:0,
+        marketid: undefined,
     }
 }
 const formState: UnwrapRef<FormParam> = reactive(initFormData())
@@ -74,7 +77,14 @@ export function handleNumAndPrice(enumName: EnumRouterName, selectedRow: WrOrder
                 result = Math.round(canUseMoney / margin)
             }
         }
-        return +result.toFixed(0)
+
+        if (buymarginvalue !== 0) {
+            return +result.toFixed(0)
+        } else {
+            // 当市场设置的买保证金为0时,不做数量限制
+            return 10000
+        }
+        
     }
     //  摘牌金额
     function getMoney() {