Handy_Cao hace 1 año
padre
commit
1b9455c919

+ 1 - 1
oem/tss/config/appconfig.json

@@ -3,7 +3,7 @@
   "appName": "TCE",
   "version": "1.0.11",
   "versionCode": "100011",
-  "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
+  "apiUrl": "http://192.168.31.158:16240/cfg?key=dev_104",
   "tradeChannel": "ws",
   "modules": [
     "register"

+ 7 - 7
oem/tss/config/router.json

@@ -14,6 +14,13 @@
                 "children": [
                     {
                         "authType": 2,
+                        "sort": 3,
+                        "title": "pcroute.bottom.bottom_pricing_detail2",
+                        "code": "bottom_pricing_detail2",
+                        "component": "views/footer/pricing/detail2/index.vue"
+                    },
+                    {
+                        "authType": 2,
                         "sort": 1,
                         "title": "pcroute.bottom.bottom_pricing_position",
                         "code": "bottom_pricing_position",
@@ -22,13 +29,6 @@
                     {
                         "authType": 2,
                         "sort": 2,
-                        "title": "pcroute.bottom.bottom_pricing_detail",
-                        "code": "bottom_pricing_detail",
-                        "component": "views/footer/pricing/detail/index.vue"
-                    },
-                    {
-                        "authType": 2,
-                        "sort": 2,
                         "title": "pcroute.bottom.bottom_pricing_order",
                         "code": "bottom_pricing_order",
                         "component": "views/footer/pricing/order/index.vue"

+ 1 - 1
public/config/appconfig.json

@@ -4,7 +4,7 @@
   "appTitle": "多元世纪交易中心",
   "version": "1.0.8",
   "versionCode": "10008",
-  "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
+  "apiUrl": "http://192.168.31.158:16240/cfg?key=dev_104",
   "tradeChannel": "ws",
   "modules": [
     "register",

+ 2 - 2
src/packages/pc/views/footer/pricing/detail2/index.vue

@@ -36,7 +36,7 @@
          <!-- 风险率 -->
          <template #riskRate="{ row }">
             <span :class="row.tHDetailEx.depositRate <= row.tHDetailEx.promptDepositRate ? 'g-price-up' : ''">
-                {{ parsePercent(row.tHDetailEx.depositRate) }}
+                {{ parsePercent(row.tHDetailEx.riskRate) }}
             </span>
         </template>
          <!-- 交易时间 -->
@@ -62,7 +62,7 @@
 </template>
 
 <script lang="ts" setup> 
-import { shallowRef, defineAsyncComponent, onUnmounted, computed } from 'vue'
+import { shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
 import { getBuyOrSellName } from '@/constants/order'
 import { formatDecimal, formatDate, parsePercent, handlePriceColor } from '@/filters'
 import { getGoodsUnitName } from '@/constants/unit'

+ 18 - 0
src/stores/modules/position.ts

@@ -135,6 +135,7 @@ export const useSBYJOrderStore = defineStore(() => {
         state.orderList.forEach((e) => {
             e.tHDetailEx.depositRate = calcDepositRate(e)
             e.tHDetailEx.floatPL = calcFloatpl(e)
+            e.tHDetailEx.riskRate = calRiskRate(e)
         })
         // 任务 #5753
         return state.orderList.filter((e) => e.tHDetailEx.holderQty > 0)
@@ -165,6 +166,23 @@ export const useSBYJOrderStore = defineStore(() => {
         return depositRate
     }
 
+    // 计算风险率 
+    const calRiskRate = (e: Model.SBYJMyOrderRsp) => {
+        // 已付定金+补充定金
+        const useMargin = e.tHDetailEx.payedDeposit+e.tHDetailEx.restockDeposit
+
+        const quote = futuresStore.getGoodsQuote(e.tHDetailEx.goodsID)
+        const { ask = 0, bid = 0, agreeunit = 0 } = quote.value ?? {}
+        const price = e.tHDetailEx.buyOrSell === BuyOrSell.Buy ? bid : ask // 根据方向取买卖价
+
+        // 计算浮动盈亏 (价格 * 手数 * 合约乘数 - 持仓金额) * 方向标识
+        const float = price ? price * e.tHDetailEx.holderQty * agreeunit - e.tHDetailEx.holderAmount : 0
+        const floatpl = float * (e.tHDetailEx.buyOrSell === BuyOrSell.Buy ? 1 : -1)
+        // 计算风险率 占用/占用+浮动盈亏
+        const  riskRate = useMargin/(useMargin+floatpl)
+        return riskRate
+    }
+
     // 获取订单列表
     const getSBYJMyOrders = async () => {
         if (!state.loading) {

+ 2 - 0
src/types/model/order.d.ts

@@ -1544,6 +1544,8 @@ declare namespace Model {
         floatPL: number;
         /// 订单定金率
         depositRate: number;
+        /// 风险率
+        riskRate: number;
         /// 可退定金
         refundableDeposit: number;
         /// 交易时间