Bläddra i källkod

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

Zhou.xiaoning 4 år sedan
förälder
incheckning
c205940e49

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

@@ -70,14 +70,14 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
     const rules = getRules()
     // 是否有规则
     const hasRule = () => rules.length > 0;
+    const { buymarginvalue, buymarginalgorithm } = rules[0]
     //保证金模式 1: 比率 2: 固定
-    const marginMethod = (buymarginalgorithm: number) => buymarginalgorithm === 1
+    const marginMethod = () => buymarginalgorithm === 1
     const { fixedprice, orderqty, pricemove } = selectedRow;
     // 获取摘牌最大可摘量
     function getMaxNum() {
         let result = 0;
         if (hasRule()) {
-            const { buymarginvalue, buymarginalgorithm } = rules[0]
             // 可用资金
             const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
             if (!isBuy()) {
@@ -88,13 +88,13 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
                         // 估算总价
                         const predictTotal = pricemove + (goodsPrice.value as number);
                         // 买方履约保证金比例*估算总价
-                        const marginMoney = marginMethod(buymarginalgorithm) ? (buymarginvalue * predictTotal) : (buymarginvalue + predictTotal)
+                        const marginMoney = marginMethod() ? (buymarginvalue * predictTotal) : (buymarginvalue + predictTotal)
                         // 浮动价 摘买 最大数量=min{可用资金/(买方履约保证金比例*估算总价),挂牌数量}
                         result = Math.min(orderqty, canUseMoney / marginMoney)
                     }
                 } else {
                     // 买方履约保证金比例*挂牌价格
-                    const marginMoney = marginMethod(buymarginalgorithm) ? (buymarginvalue * fixedprice) : (buymarginvalue + fixedprice)
+                    const marginMoney = marginMethod() ? (buymarginvalue * fixedprice) : (buymarginvalue + fixedprice)
                     //  一口价 摘买 最大数量=min{挂牌数量,可用资金/(买方履约保证金比例*挂牌价格)
                     result = Math.min(orderqty, canUseMoney / marginMoney)
                 }
@@ -145,11 +145,8 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
         let result = 0
         if (hasRule()) {
             const { buymarginvalue, sellmarginvalue } = rules[0]
-            if (isBuy()) {
-                result = sellmarginvalue * getMoney()
-            } else {
-                result = buymarginvalue * getMoney()
-            }
+            const margin = isBuy() ? sellmarginvalue : buymarginvalue
+            result = marginMethod() ? margin * getMoney() : margin + getMoney()
         }
         return Number(result.toFixed(2))
     }

+ 5 - 5
src/views/market/spot_trade/components/buy-sell-market/components/financing_delisting/setup.ts

@@ -93,13 +93,13 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
     // 是否有规则
     const hasRule = () => rules.length > 0;
     //保证金模式 1: 比率 2: 固定
-    const marginMethod = (buymarginalgorithm: number) => buymarginalgorithm === 1
+    const { buymarginvalue, buymarginalgorithm } = rules[0]
+    const marginMethod = () => buymarginalgorithm === 1
     const { fixedprice, orderqty, pricemove } = selectedRow;
     // 获取摘牌最大可摘量
     function getMaxNum() {
         let result = 0;
         if (hasRule()) {
-            const { buymarginvalue, buymarginalgorithm } = rules[0]
             // 可用资金
             const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
             if (!isBuy()) {
@@ -110,13 +110,13 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
                         // 估算总价
                         const predictTotal = pricemove + (goodsPrice.value as number);
                         // 买方履约保证金比例*估算总价
-                        const marginMoney = marginMethod(buymarginalgorithm) ? (buymarginvalue * predictTotal) : (buymarginvalue + predictTotal)
+                        const marginMoney = marginMethod() ? (buymarginvalue * predictTotal) : (buymarginvalue + predictTotal)
                         // 浮动价 摘买 最大数量=min{可用资金/(买方履约保证金比例*估算总价),挂牌数量}
                         result = Math.min(orderqty, canUseMoney / marginMoney)
                     }
                 } else {
                     // 买方履约保证金比例*挂牌价格
-                    const marginMoney = marginMethod(buymarginalgorithm) ? (buymarginvalue * fixedprice) : (buymarginvalue + fixedprice)
+                    const marginMoney = marginMethod() ? (buymarginvalue * fixedprice) : (buymarginvalue + fixedprice)
                     //  一口价 摘买 最大数量=min{挂牌数量,可用资金/(买方履约保证金比例*挂牌价格)
                     result = Math.min(orderqty, canUseMoney / marginMoney)
                 }
@@ -167,7 +167,7 @@ export function handleNumAndMoney(enumName: EnumRouterName, buyOrSell: BuyOrSell
         let result = 0
         if (hasRule()) {
             if (selecedFinance.value) {
-                result = selecedFinance.value.marginratio * getMoney()
+                result = marginMethod() ? selecedFinance.value.marginratio * getMoney() : selecedFinance.value.marginratio * getMoney()
             }
         }
         return Number(result.toFixed(2))

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

@@ -98,7 +98,7 @@
             </a-col>
             <a-col :span="24"
                    class="relative mt20">
-              <a-form-item :label="isFloat() ? '估算金额' : '牌金额'">
+              <a-form-item :label="isFloat() ? '估算金额' : '牌金额'">
                 <span class="white ml8">{{getMoney()}}</span>
               </a-form-item>
             </a-col>

+ 7 - 3
src/views/market/spot_trade/components/post_buying/setup.ts

@@ -36,13 +36,16 @@ export function handleNumAndPrice(enumName: EnumRouterName, selectedRow: WrOrder
     const getSelectedAccount = () => accountList.find((e) => e.accountid === formState.accountid);
     // 交易规则
     const rules = getRules()
+    const { buymarginvalue, buymarginalgorithm } = rules[0]
+    //保证金模式 1: 比率 2: 固定
+    const marginMethod = () => buymarginalgorithm === 1
     // 挂牌最大数量
     function getMaxNum() {
         // 可用资金
         const canUseMoney = Number(getCanUseMoney(getSelectedAccount() as AccountListItem))
         // 挂牌最大数量=可用资金/(买方履约保证金比例*挂牌价格)
-        const margin = getMargin()
-        return margin ? Math.floor(canUseMoney / getMargin()) : selectedRow.minivalue
+        const margin = marginMethod() ? (buymarginvalue * formState.FixedPrice) : (buymarginvalue + formState.FixedPrice)
+        return Math.floor(canUseMoney / margin)
     }
     //  摘牌金额
     function getMoney() {
@@ -66,7 +69,8 @@ export function handleNumAndPrice(enumName: EnumRouterName, selectedRow: WrOrder
         const { buymarginvalue } = rules[0]
         // 浮动价 履约保证金=估算总额*买方履约保证金比例
         // 一口价 履约保证金=挂牌金额*买方履约保证金比例
-        return Number((getMoney() * buymarginvalue).toFixed(2))
+        const margin = marginMethod() ? (buymarginvalue * getMoney()) : (buymarginvalue + getMoney())
+        return Number((margin).toFixed(2))
     }
     return { getMaxNum, getMoney, getMargin }
 }

+ 3 - 2
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/setup.ts

@@ -92,10 +92,11 @@ export function handleNumAndPrice() {
     // 履约保证金
     function getMargin() {
         if (hasRules()) {
-            const { sellmarginvalue } = getRules()[0]
+            const { sellmarginvalue, buymarginalgorithm } = getRules()[0]
             // 浮动价 履约保证金=估算总额*买方履约保证金比例
             // 一口价 履约保证金=挂牌金额*买方履约保证金比例
-            return Number((getMoney() * sellmarginvalue).toFixed(2))
+            const margin = buymarginalgorithm === 1 ? getMoney() * sellmarginvalue : getMoney() + sellmarginvalue
+            return Number(margin.toFixed(2))
         } else {
             return 0
         }

+ 3 - 2
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/setup.ts

@@ -91,10 +91,11 @@ export function handleNumAndPrice() {
     // 履约保证金
     function getMargin() {
         if (hasRules()) {
-            const { sellmarginvalue } = getRules()[0]
+            const { sellmarginvalue, buymarginalgorithm } = getRules()[0]
             // 浮动价 履约保证金=估算总额*买方履约保证金比例
             // 一口价 履约保证金=挂牌金额*买方履约保证金比例
-            return Number((getMoney() * sellmarginvalue).toFixed(2))
+            const margin = buymarginalgorithm === 1 ? getMoney() * sellmarginvalue : getMoney() + sellmarginvalue
+            return Number(margin.toFixed(2))
         } else {
             return 0
         }