Kaynağa Gözat

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

li.shaoyi 4 yıl önce
ebeveyn
işleme
afdd332517

+ 1 - 1
public/config/app.config.json

@@ -1,3 +1,3 @@
 {
-    "apiUrl": "http://192.168.31.135:8080/cfg?key=test_135"
+    "apiUrl": "http://192.168.31.139:8080/cfg?key=test_139"
 }

+ 10 - 12
src/hooks/margin.ts

@@ -2,22 +2,20 @@ import { TradeMode } from "@/common/constants/enumCommon"
 import { getMarketByTradeMode } from "@/services/bus/market"
 import { ref } from "vue"
 import { queryTjmdTodayAccountMargin } from "../services/go/Tjmd"
-import { TjmdTodayAccountMarginReq } from "../services/go/Tjmd/interface"
+import { QueryTjmdTodayAccountMarginReq, TjmdTodayAccountMarginReq } from "../services/go/Tjmd/interface"
+
 
 // 注意:这个 保证金和 仓单贸易 里的保证金不一样
 // 目前是掉期市场
-
-// 查询 今日保证金
-const allTodayMargin = ref<TjmdTodayAccountMarginReq[]>([])
-export const useTodayMargin = () => {
-    if (allTodayMargin.value.length === 0) {
-        queryTjmdTodayAccountMargin({}).then(res => {
-            allTodayMargin.value = res
-        })
-    }
+export const useTodayMargin = (param: QueryTjmdTodayAccountMarginReq) => {
+    // 查询 今日保证金
+    const todayMargin = ref<TjmdTodayAccountMarginReq[]>([])
+    queryTjmdTodayAccountMargin(param).then(res => {
+        todayMargin.value = res
+    })
     // 通过 市场 ID 查找 保证金信息
     function findTodayMarginByMarketId(marketid: number) {
-        return allTodayMargin.value.find(e => e.marketid === marketid)
+        return todayMargin.value.find(e => e.marketid === marketid)
     }
 
     // 获取 结算保证金值
@@ -38,7 +36,7 @@ export const useTodayMargin = () => {
             const temp = findTodayMarginByMarketId(marketInfo.marketid)?.infoc
             if (temp) {
                 result[0] = temp.MarginAlgorithm
-                result[1] = temp.ReckonMarginValue
+                result[1] = temp.MarketMarginValue
             }
         }
         return result

+ 9 - 3
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/delisting/index.vue

@@ -161,8 +161,8 @@ import { _closeModal } from '@/common/setup/modal/modal';
 import { useTradeRule } from '@/common/setup/trade';
 import { getGoodsAgreeunitByGoodsId } from '@/services/bus/goods';
 import { geLoginID_number } from '@/services/bus/login';
-import { getMarketByTradeMode } from '@/services/bus/market';
-import { QueryQuoteGoodsListRsp, QueryTjmdTradeOrderDetailRsp } from '@/services/go/Tjmd/interface';
+import { getMarketByTradeMode, getMarketIdsByTradeMode } from '@/services/bus/market';
+import { QueryQuoteGoodsListRsp, QueryTjmdTodayAccountMarginReq, QueryTjmdTradeOrderDetailRsp } from '@/services/go/Tjmd/interface';
 import { diaoQiOrder } from '@/services/socket/order';
 import { OrderReq } from '@/services/socket/order/interface';
 import { MinusOutlined, PlusOutlined } from '@ant-design/icons-vue';
@@ -174,6 +174,7 @@ import { useUserType } from '../setup';
 import { FormParam } from './interface';
 import { handleForm, useBlocksPrice, useBlocksNumber } from './setup';
 import { useTodayMargin } from '@/hooks/margin';
+import { getSelectedAccountId } from '@/services/bus/account';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
@@ -194,8 +195,13 @@ export default defineComponent({
         },
     },
     setup(props, context) {
+        const marginParam: QueryTjmdTodayAccountMarginReq = {
+            accountid: getSelectedAccountId()!.toString(),
+            goodsid: props.selectedRow.goodsid,
+            marketids: getMarketIdsByTradeMode(TradeMode.DiaoQi),
+        };
         // 获取保证金比例
-        const { getReckonMarginValueByTradeMode } = useTodayMargin();
+        const { getReckonMarginValueByTradeMode } = useTodayMargin(marginParam);
         // 控制弹窗
         const { visible, cancel } = _closeModal(context);
         // 表单

+ 18 - 13
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/post_buying/index.vue

@@ -151,25 +151,23 @@ import { queryTableList } from '@/common/setup/table';
 import { useListingTradeNumAndPrice } from '@/common/setup/trade';
 import { ListingTradeNumAndPrice } from '@/common/setup/trade/interface';
 import { useTodayMargin } from '@/hooks/margin';
+import { getSelectedAccountId } from '@/services/bus/account';
 import { getGoodsAgreeunitByGoodsCode, getGoodsByCode, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
 import { geLoginID_number } from '@/services/bus/login';
-import { getMarketByTradeMode } from '@/services/bus/market';
+import { getMarketByTradeMode, getMarketIdsByTradeMode } from '@/services/bus/market';
+import { queryTradePosition } from '@/services/go/ermcp/order';
 import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
-import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
-import { QueryQuoteGoodsListRsp } from '@/services/go/Tjmd/interface';
+import { QueryTjmdTodayAccountMarginReq } from '@/services/go/Tjmd/interface';
 import { diaoQiOrder } from '@/services/socket/order';
 import { OrderReq } from '@/services/socket/order/interface';
 import { MinusOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons-vue';
 import moment from 'moment';
 import { v4 as uuidv4 } from 'uuid';
 import { defineComponent, PropType, ref } from 'vue';
+import { RefGoodsList } from '../../interface';
 import { useUserType } from '../setup';
 import { FormParam } from './interface';
-import { handleForm, isFloat, useBuySellDirection, usePrice, useNum } from './setup';
-import { queryTradePosition } from '@/services/go/ermcp/order';
-import { WrOrderQuote } from '@/services/go/wrtrade/interface';
-import { RefGoodsList } from '../../interface';
-import { getGoodsPrice } from '@/views/market/spot_trade/components/buy-sell-market/setup';
+import { handleForm, isFloat, useBuySellDirection, useNum, usePrice } from './setup';
 
 export default defineComponent({
     emits: ['cancel', 'update'],
@@ -186,8 +184,13 @@ export default defineComponent({
         const { tableList, queryTable } = queryTableList<QueryTradePositionRsp>();
         queryTable(queryTradePosition);
 
+        const marginParam: QueryTjmdTodayAccountMarginReq = {
+            accountid: getSelectedAccountId()!.toString(),
+            goodsid: props.selectedRow.goodsid,
+            marketids: getMarketIdsByTradeMode(TradeMode.DiaoQi),
+        };
         // 获取保证金比例
-        const { getReckonMarginTypeAndValueByTradeMode } = useTodayMargin();
+        const { getReckonMarginTypeAndValueByTradeMode } = useTodayMargin(marginParam);
         // 控制弹窗
         const { visible, cancel } = _closeModal(context);
         // 表单
@@ -228,17 +231,19 @@ export default defineComponent({
         // 最大数量
         const getMaxNum = () => {
             let result = 0;
+            const goodscode = props.selectedRow.goodscode;
             const [marginType, marginValue] = getReckonMarginTypeAndValueByTradeMode(TradeMode.DiaoQi);
             // 可用资金
             const temp = +canUseMoney();
             const money = temp > 0 ? temp : 0;
-            if (marginType && money && formState.FixedPrice) {
+            const price = isFloat() ? getQuoteDayInfoByCodeFindPrice(goodscode) : formState.FixedPrice;
+            if (marginType && money && price && price !== '--') {
                 // 保证金方式 1:比率 2:固定
                 if (marginType === 1) {
                     // 合约单位
-                    const agreeunit = getGoodsAgreeunitByGoodsCode(props.selectedRow.goodscode);
+                    const agreeunit = getGoodsAgreeunitByGoodsCode(goodscode);
                     // 最大可挂牌数量=可用/(价格*合约单位*保证金比例
-                    result = money / (((formState.FixedPrice * marginValue) / 100) * agreeunit);
+                    result = money / (((+price * marginValue) / 100) * agreeunit);
                 } else {
                     // 最大可挂牌数量=可用/保证金固定值
                     result = money / marginValue;
@@ -325,7 +330,7 @@ export default defineComponent({
             canUseMoney,
             accountList,
             ...usePrice(),
-            ...useNum(),
+            ...useNum(getMaxNum),
             getPrice,
         };
     },

+ 5 - 2
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/components/post_buying/setup.ts

@@ -67,9 +67,12 @@ export const usePrice = () => {
     return { increasePrice, decreasePrice };
 };
 
-export const useNum = () => {
+export const useNum = (getMaxNum: Function) => {
     function increaseNum() {
-        formState.OrderQty++;
+        const max = getMaxNum()
+        if (max && formState.OrderQty < max) {
+            formState.OrderQty++;
+        }
     }
     function decreaseNum() {
         if (formState.OrderQty) {

+ 1 - 0
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/interface.ts

@@ -5,4 +5,5 @@ export interface RefGoodsList extends QueryQuoteDayRsp {
     goodsname: string
     refgoodscode: string
     orderid: number
+    goodsid: number
 }

+ 1 - 0
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_swap/setup.ts

@@ -42,6 +42,7 @@ export const useSwapList = () => {
                     const result: RefGoodsList = {
                         ...quote,
                         goodsname: el.goodsname,
+                        goodsid: el.goodsid,
                         goodscode: el.goodscode,
                         refgoodsname: el.refgoodsname,
                         refgoodscode: el.refgoodscode

+ 91 - 91
src/views/order/financing_manager/components/financing_manager_contract/components/buyback/index.vue

@@ -1,98 +1,98 @@
 <template>
-    <!-- 回购仓单 -->
-    <Drawer
-        :title="'回购仓单'"
-        :placement="'right'"
-        :visible="visible"
-        class="delistingBottom"
-        @cancel="cancel"
-    >
-        <div class="listed">
-            <a-form class="inlineForm dialogForm" ref="formRef" :model="formState" :rules="rules">
-                <div class="formBar">
-                    <a-row :gutter="24">
-                        <a-col :span="12">
-                            <a-form-item label="品种">
-                                <span class="white ml10">{{selectedRow.deliverygoodsname}}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="仓库">
-                                <span class="white ml10">{{selectedRow.warehousename}}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="履约商品">
-                                <span class="white ml10">{{selectedRow.wrtypename}}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="购买数量">
-                                <span
-                                    class="white ml10"
-                                >{{ selectedRow.wrqty + " " + selectedRow.enumdicname }}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="已回购数量">
-                                <span
-                                    class="white ml10"
-                                >{{ selectedRow.buybackwrpositionqty + " " + selectedRow.enumdicname }}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="待回购数量">
-                                <span
-                                    class="white ml10"
-                                >{{ selectedRow.remainwrpositionqty + " " + selectedRow.enumdicname }}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="本次回购数量" name="num" class="relative">
-                                <a-input-number
-                                    class="commonInput ml10"
-                                    :min="1"
-                                    v-model:value="formState.num"
-                                    style="width: 200px"
-                                />
+  <!-- 回购仓单 -->
+  <Drawer :title="'回购仓单'"
+          :placement="'right'"
+          :visible="visible"
+          class="delistingBottom"
+          @cancel="cancel">
+    <div class="listed">
+      <a-form class="inlineForm dialogForm"
+              ref="formRef"
+              :model="formState"
+              :rules="rules">
+        <div class="formBar">
+          <a-row :gutter="24">
+            <a-col :span="12">
+              <a-form-item label="品种">
+                <span class="white ml10">{{selectedRow.deliverygoodsname}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="仓库">
+                <span class="white ml10">{{selectedRow.warehousename}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="商品">
+                <span class="white ml10">{{selectedRow.wrtypename}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="购买数量">
+                <span
+                      class="white ml10">{{ selectedRow.wrqty + " " + selectedRow.enumdicname }}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="已回购数量">
+                <span
+                      class="white ml10">{{ selectedRow.buybackwrpositionqty + " " + selectedRow.enumdicname }}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="待回购数量">
+                <span
+                      class="white ml10">{{ selectedRow.remainwrpositionqty + " " + selectedRow.enumdicname }}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="本次回购数量"
+                           name="num"
+                           class="relative">
+                <a-input-number class="commonInput ml10"
+                                :min="1"
+                                v-model:value="formState.num"
+                                style="width: 200px" />
 
-                                <span class="input-enumdicname-absolute">吨</span>
-                                <!-- 本次可回购数量=min{资金方对应仓单头寸可用数量,融资合同剩余待回购数量} -->
-                                <div
-                                    class="tip"
-                                >{{ "本次可回购数量" + selectedRow.remainwrpositionqty + " " + selectedRow.enumdicname }}</div>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <!--(回购数量/合同剩余数量) * 合同剩余金额 -->
-                            <a-form-item label="本次回购金额">
-                                <span
-                                    class="white ml10"
-                                >{{ (((formState.num === 0 ? 1 : formState.num) * selectedRow.remainamount) / selectedRow.remainwrpositionqty).toFixed(2) + " 元" }}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="12">
-                            <a-form-item label="剩余保证金">
-                                <span class="white ml10">{{ selectedRow.initmargin + " 元" }}</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
+                <span class="input-enumdicname-absolute">吨</span>
+                <!-- 本次可回购数量=min{资金方对应仓单头寸可用数量,融资合同剩余待回购数量} -->
+                <div class="tip">
+                  {{ "本次可回购数量" + selectedRow.remainwrpositionqty + " " + selectedRow.enumdicname }}
                 </div>
-                <a-row :gutter="24">
-                    <a-col :span="24" class="fixedBtns">
-                        <a-form-item class="btnCenter">
-                            <a-button
-                                class="listedBtn"
-                                :loading="loading"
-                                :disabled="loading"
-                                @click="submit"
-                            >提交</a-button>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-            </a-form>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <!--(回购数量/合同剩余数量) * 合同剩余金额 -->
+              <a-form-item label="本次回购金额">
+                <span
+                      class="white ml10">{{ (((formState.num === 0 ? 1 : formState.num) * selectedRow.remainamount) / selectedRow.remainwrpositionqty).toFixed(2) + " 元" }}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="剩余保证金">
+                <span class="white ml10">{{ selectedRow.initmargin + " 元" }}</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
         </div>
-    </Drawer>
+        <a-row :gutter="24">
+          <a-col :span="24"
+                 class="fixedBtns">
+            <a-form-item class="btnCenter">
+              <a-button class="listedBtn"
+                        v-if="selectedRow.buybackwrpositionqty !== selectedRow.remainwrpositionqty"
+                        :loading="loading"
+                        :disabled="loading"
+                        @click="submit">提交</a-button>
+              <a-button class="listedBtn"
+                        v-else
+                        @click="cancel">提交</a-button>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+  </Drawer>
 </template>
 
 <script lang="ts">