li.shaoyi 2 سال پیش
والد
کامیت
ee6b51b385
28فایلهای تغییر یافته به همراه377 افزوده شده و 98 حذف شده
  1. 2 2
      app/package.json
  2. BIN
      oem/gcszt/app/splashscreen/1080x1920.png
  3. BIN
      oem/gcszt/app/splashscreen/480x853.png
  4. BIN
      oem/gcszt/app/splashscreen/720x1280.png
  5. 1 1
      oem/gcszt/config/router.json
  6. 2 2
      oem/qdhs/config/appconfig.json
  7. 1 0
      package.json
  8. 1 1
      public/config/appconfig.json
  9. 1 0
      src/constants/funcode.ts
  10. 2 12
      src/packages/gcszt/router/index.ts
  11. 0 6
      src/packages/gcszt/views/mine/Index.vue
  12. 0 31
      src/packages/gcszt/views/order/delivery/Index.vue
  13. 6 20
      src/packages/gcszt/views/order/position/Index.vue
  14. 0 0
      src/packages/mobile/assets/themes/base/iconfont.less
  15. 6 1
      src/packages/mobile/router/index.ts
  16. 6 1
      src/packages/mobile/views/mine/Index.vue
  17. 6 2
      src/packages/mobile/views/mine/index.less
  18. 96 0
      src/packages/mobile/views/order/inout/components/add/index.vue
  19. 107 0
      src/packages/mobile/views/order/inout/components/in/list/index.vue
  20. 75 0
      src/packages/mobile/views/order/inout/components/out/list/index.vue
  21. 37 0
      src/packages/mobile/views/order/inout/index.vue
  22. 1 1
      src/packages/mobile/views/order/list/components/goodstrade/list/Index.vue
  23. 2 2
      src/packages/pc/views/footer/capital/summary/index.vue
  24. 2 2
      src/packages/pc/views/footer/inout/in/confirm/index.vue
  25. 1 0
      src/services/bus/types.ts
  26. 6 8
      src/services/websocket/message.ts
  27. 8 6
      src/stores/modules/account.ts
  28. 8 0
      src/types/proto/notify.d.ts

+ 2 - 2
app/package.json

@@ -1,6 +1,6 @@
 {
-  "name": "trading",
-  "version": "1.0.1",
+  "name": "trading-beta",
+  "version": "1.0.9",
   "main": "main.js",
   "dependencies": {
     "electron-updater": "^6.1.4",

BIN
oem/gcszt/app/splashscreen/1080x1920.png


BIN
oem/gcszt/app/splashscreen/480x853.png


BIN
oem/gcszt/app/splashscreen/720x1280.png


+ 1 - 1
oem/gcszt/config/router.json

@@ -128,7 +128,7 @@
                                 "authType": 2,
                                 "sort": 2,
                                 "title": "月清挂牌",
-                                "code": "market_trade_goods_50103",
+                                "code": "market_trade_goods_50104",
                                 "component": "views/market/trade/goods/list/index.vue"
                             }
                         ]

+ 2 - 2
oem/qdhs/config/appconfig.json

@@ -1,8 +1,8 @@
 {
   "appId": "com.muchinfo.qdhs",
   "appName": "青岛海商",
-  "version": "1.0.8",
-  "versionCode": "100008",
+  "version": "1.0.9",
+  "versionCode": "100009",
   "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
   "tradeChannel": "ws",
   "modules": [

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "dev:tc": "vue-cli-service serve --mode tc",
     "dev:tjmd": "vue-cli-service serve --mode tjmd",
     "dev:gcszt": "vue-cli-service serve --mode gcszt",
+    "dev:gcszt@pc": "vue-cli-service serve --mode gcszt@pc",
     "build:mobile": "set \"NODE_ENV=production\" && vue-cli-service build --mode mobile",
     "build:pc": "set \"NODE_ENV=production\" && vue-cli-service build --mode pc",
     "build:gstj": "set \"NODE_ENV=production\" && vue-cli-service build --mode gstj",

+ 1 - 1
public/config/appconfig.json

@@ -3,7 +3,7 @@
   "appName": "多元世纪交易中心",
   "version": "1.0.5",
   "versionCode": "10005",
-  "apiUrl": "http://192.168.31.169:8080/cfg?key=test_169",
+  "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
   "tradeChannel": "ws",
   "modules": [
     "register",

+ 1 - 0
src/constants/funcode.ts

@@ -55,6 +55,7 @@ export enum FunCode {
     MarketStatusChangeNtf = 131089, // 市场状态变更通知
     PosChangedNtf = 131075, // 头寸变化通知
     RiskControlNtf = 131086, // 风控通知
+    RiskToWebNtf = 131139, // 风控消息管理端通知客户端
 
     // 行情内容
     QuoteBeat = 0x12, // 心跳

+ 2 - 12
src/packages/gcszt/router/index.ts

@@ -196,18 +196,8 @@ const routes: Array<RouteRecordRaw> = [
         path: 'position',
         name: 'order-position',
         component: () => import('../views/order/position/Index.vue'),
-      },
-      {
-        path: 'delivery',
-        name: 'order-delivery',
-        component: () => import('../views/order/delivery/Index.vue'),
-      },
-      {
-        path: 'performance',
-        name: 'order-performance',
-        component: () => import('@mobile/views/order/performance/Index.vue'),
-      },
-    ],
+      }
+    ]
   },
   {
     path: '/mine',

+ 0 - 6
src/packages/gcszt/views/mine/Index.vue

@@ -53,12 +53,6 @@
                 <li @click="routerTo('order-list')">
                     <Iconfont label-direction="bottom" icon="g-icon-order--line">我的订单</Iconfont>
                 </li>
-                <li @click="routerTo('order-delivery')">
-                    <Iconfont label-direction="bottom" icon="g-icon-delivery--line">交货提货</Iconfont>
-                </li>
-                <li @click="routerTo('order-performance')">
-                    <Iconfont label-direction="bottom" icon="g-icon-performance--line">履约信息</Iconfont>
-                </li>
             </ul>
         </app-block>
         <app-block class="g-navmenu">

+ 0 - 31
src/packages/gcszt/views/order/delivery/Index.vue

@@ -1,31 +0,0 @@
-<template>
-    <app-view>
-        <template #header>
-            <app-navbar title="交收提货" />
-        </template>
-        <Tabs class="van-tabs--list" v-model:active="active" :swipe-threshold="4">
-            <Tab title="点选交收单">
-                <component :is="componentMap.get('online')" />
-            </Tab>
-            <Tab title="线下交收单">
-                <component :is="componentMap.get('offline')" />
-            </Tab>
-            <Tab title="现货提货单">
-                <component :is="componentMap.get('spot')" />
-            </Tab>
-        </Tabs>
-    </app-view>
-</template>
-
-<script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
-import { Tab, Tabs } from 'vant'
-
-const componentMap = new Map<string, unknown>([
-    ['online', defineAsyncComponent(() => import('@mobile/views/order/delivery/components/online/list/Index.vue'))], // 点选交收单
-    ['offline', defineAsyncComponent(() => import('@mobile/views/order/delivery/components/offline/list/Index.vue'))], // 线下交收单
-    ['spot', defineAsyncComponent(() => import('@mobile/views/order/delivery/components/spot/list/Index.vue'))], // 现货提货单
-])
-
-const active = shallowRef(0)
-</script>

+ 6 - 20
src/packages/gcszt/views/order/position/Index.vue

@@ -2,28 +2,21 @@
     <app-view>
         <template #header>
             <app-navbar title="我的持仓">
-                <template #right v-if="selectedComponent.detail">
-                    <div class="button-more" @click="openComponent(selectedComponent.name)">
+                <template #right>
+                    <div class="button-more" @click="openComponent('detail')">
                         <span>明细</span>
                     </div>
                 </template>
             </app-navbar>
         </template>
-        <Tabs class="van-tabs--list" v-model:active="active" :swipe-threshold="4">
-            <template v-for="(item, index) in components" :key="index">
-                <Tab :title="item.title" :name="index">
-                    <component :is="item.component" />
-                </Tab>
-            </template>
-        </Tabs>
-        <component ref="componentRef" :is="selectedComponent.detail" @closed="closeComponent"
-            v-if="componentId && selectedComponent.detail" />
+        <component :is="components[0].component" />
+        <component ref="componentRef" :is="components[0].detail" @closed="closeComponent"
+            v-if="componentId" />
     </app-view>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, defineAsyncComponent } from 'vue'
-import { Tab, Tabs } from 'vant'
+import { defineAsyncComponent } from 'vue'
 import { useComponent } from '@/hooks/component'
 
 const components = [
@@ -33,14 +26,7 @@ const components = [
         component: defineAsyncComponent(() => import('@mobile/views/order/position/components/goods/list/Index.vue')),
         detail: defineAsyncComponent(() => import('@mobile/views/order/position/components/goods/detail/Index.vue')),
     },
-    {
-        name: 'spot',
-        title: '现货持仓',
-        component: defineAsyncComponent(() => import('@mobile/views/order/position/components/spot/list/Index.vue')),
-    },
 ]
 
-const active = shallowRef(0)
-const selectedComponent = computed(() => components[active.value])
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 </script>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
src/packages/mobile/assets/themes/base/iconfont.less


+ 6 - 1
src/packages/mobile/router/index.ts

@@ -392,7 +392,12 @@ const routes: Array<RouteRecordRaw> = [
         name: 'order-performance',
         component: () => import('../views/order/performance/Index.vue'),
       },
-    ],
+      {
+        path: 'inout',
+        name: 'order-inout',
+        component: () => import('../views/order/inout/index.vue'),
+      }
+    ]
   },
   {
     path: '/mine',

+ 6 - 1
src/packages/mobile/views/mine/Index.vue

@@ -33,7 +33,7 @@
                         </li>
                         <li>
                             <span>净值</span>
-                            <span>{{ currentAccount.netvalue?.toFixed(2) }}</span>
+                            <span>{{ currentAccount.hazardValue?.toFixed(2) }}</span>
                         </li>
                     </ul>
                     <ul>
@@ -78,6 +78,11 @@
                     <Iconfont label-direction="bottom" icon="g-icon-performance--line">履约信息</Iconfont>
                 </li>
             </ul>
+            <ul>
+                <li @click="routerTo('order-inout')">
+                    <Iconfont label-direction="bottom" icon="g-icon-inout--line">持仓过户</Iconfont>
+                </li>
+            </ul>
         </app-block>
         <app-block class="g-navmenu">
             <CellGroup>

+ 6 - 2
src/packages/mobile/views/mine/index.less

@@ -137,13 +137,17 @@
         ul {
             display: flex;
             background-color: #fff;
-            padding: .24rem;
+            padding-top: .24rem;
+
+            &:last-child {
+                padding-bottom: .24rem;
+            }
 
             li {
-                flex: 1;
                 display: flex;
                 flex-direction: column;
                 align-items: center;
+                width: calc(~'100% / 4');
 
                 .g-icon {
                     font-size: .56rem;

+ 96 - 0
src/packages/mobile/views/order/inout/components/add/index.vue

@@ -0,0 +1,96 @@
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
+        <app-view class="g-form">
+            <template #header>
+                <app-navbar title="新增" @back="closed" />
+            </template>
+            <Form ref="formRef" class="g-form__container" @submit="formSubmit">
+                <CellGroup inset>
+                    <Field v-model="formData.InUserID" :rules="formRules.InUserID" name="InUserID" label="转入客户"
+                        placeholder="必填" />
+                </CellGroup>
+            </Form>
+            <template #footer>
+                <div class="g-form__footer inset">
+                    <Button type="danger" @click="formRef?.submit" round block>提交</Button>
+                </div>
+            </template>
+        </app-view>
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, reactive, computed } from 'vue'
+import { CellGroup, Button, Field, Form, FormInstance, FieldRule } from 'vant'
+import { fullloading, dialog } from '@/utils/vant'
+import { BuyOrSell } from '@/constants/order'
+import { useRequest } from '@/hooks/request'
+import { holderTransferApply } from '@/services/api/trade'
+import { getUserInfo } from '@/services/api/user'
+import { usePosition } from '@/business/position'
+import { useLoginStore } from '@/stores'
+import AppModal from '@/components/base/modal/index.vue'
+
+const showModal = shallowRef(true)
+const refresh = shallowRef(false) // 是否刷新父组件数据
+const formRef = shallowRef()
+const loginStore = useLoginStore()
+const { positionList } = usePosition(16)
+
+// 可用商品列表
+const goodsList = computed(() => positionList.value.filter((e) => e.enableqty > 0))
+// 选中的商品
+const selectedGoods = shallowRef<Model.TradePositionRsp>()
+//可用数量
+const enableqty = computed(() => selectedGoods.value?.enableqty ?? 0)
+
+const formData = reactive<Partial<Proto.HolderTransferDetail>>({
+    OutUserID: loginStore.userId, // 转出方用户ID,必填
+    BuyOrSell: BuyOrSell.Buy, // 转出方买卖方向,必填
+    TransferType: 1, // 转让类型-1.协议转让
+})
+
+// 表单验证规则
+const formRules: { [key: string]: FieldRule[] } = {
+    ReceiverName: [{
+        required: true,
+        message: '请输入收货人',
+    }],
+    Address: [{
+        required: true,
+        message: '请输入详细地址',
+    }],
+}
+
+// 表单提交
+const formSubmit = () => {
+    fullloading((hideLoading) => {
+        const { marketid, goodsid } = selectedGoods.value ?? {}
+        formData.GoodsID = goodsid
+        holderTransferApply({
+            data: {
+                Header: {
+                    MarketID: marketid
+                },
+                HolderTransferDetails: [formData]
+            }
+        }).then(() => {
+            hideLoading()
+            closed(true)
+        }).catch((err) => {
+            hideLoading(err, 'fail')
+        })
+    })
+}
+
+// 关闭弹窗
+const closed = (isRefresh = false) => {
+    refresh.value = isRefresh
+    showModal.value = false
+}
+
+// 暴露组件属性给父组件调用
+defineExpose({
+    closed,
+})
+</script>

+ 107 - 0
src/packages/mobile/views/order/inout/components/in/list/index.vue

@@ -0,0 +1,107 @@
+<!-- 持仓过户-我的转入 -->
+<template>
+    <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
+        :page-count="pageCount" @refresh="run">
+        <div class="g-order-list">
+            <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
+                <div class="g-order-list__titlebar">
+                    <div class="left">
+                        <h4>{{ item.goodsdisplay }}</h4>
+                        <span>{{ item.applytime }}</span>
+                    </div>
+                    <div class="right">
+                        <span>{{ getTransferApplyStatusName(item.transferapplystatus) }}</span>
+                    </div>
+                </div>
+                <div class="g-order-list__content">
+                    <ul>
+                        <li>
+                            <span>转出方</span>
+                            <span>{{ item.outusername }}</span>
+                        </li>
+                        <li>
+                            <span>转让数量</span>
+                            <span>{{ item.qty }}</span>
+                        </li>
+                        <li>
+                            <span>转让价格</span>
+                            <span>{{ item.transferprice }}</span>
+                        </li>
+                        <li>
+                            <span>冻结天数</span>
+                            <span>{{ item.freezedays }}</span>
+                        </li>
+                        <li>
+                            <span>商品价格</span>
+                            <span>{{ item.goodscurprice }}</span>
+                        </li>
+                        <li>
+                            <span>手续费</span>
+                            <span>{{ item.outcharge }}</span>
+                        </li>
+                    </ul>
+                </div>
+                <div class="g-order-list__btnbar">
+                    <Button size="small" v-if="item.transferapplystatus === 2" @click="onCancelSumit(item)"
+                        round>确认</Button>
+                </div>
+            </div>
+        </div>
+    </app-pull-refresh>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { Button } from 'vant'
+import { useRequest } from '@/hooks/request'
+import { queryInTradePositionTransfer } from '@/services/api/transfer'
+import { getTransferApplyStatusName } from '@/constants/order'
+import { handleRequestBigNumber } from '@/filters'
+import { holderTransferConfirm } from '@/services/api/trade'
+import { dialog } from '@/utils/vant'
+import { fullloading } from '@/utils/vant'
+
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const dataList = shallowRef<Model.InTradePositionTransferRsp[]>([])
+const error = shallowRef(false)
+const pullRefreshRef = shallowRef()
+
+const { loading, pageIndex, pageCount, run } = useRequest(queryInTradePositionTransfer, {
+    params: {
+        pagesize: 20,
+    },
+    onSuccess: (res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res.data)
+    },
+    onError: () => {
+        error.value = true
+    }
+})
+
+const onCancelSumit = (item: Model.InTradePositionTransferRsp) => {
+    dialog({
+        message: '是否确认接收此转入请求?',
+        showCancelButton: true,
+    }).then(() => {
+        fullloading((hideLoading) => {
+            holderTransferConfirm({
+                data: {
+                    Header: {
+                        MarketID: item.marketid
+                    },
+                    ApplyID: handleRequestBigNumber(item.applyid)
+                }
+            }).then(() => {
+                hideLoading('确认成功')
+                pullRefreshRef.value?.refresh()
+            }).catch((err) => {
+                hideLoading(err, 'fail')
+            })
+        })
+    })
+}
+</script>

+ 75 - 0
src/packages/mobile/views/order/inout/components/out/list/index.vue

@@ -0,0 +1,75 @@
+<!-- 持仓过户-我的转出 -->
+<template>
+    <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
+        :page-count="pageCount" @refresh="run">
+        <div class="g-order-list">
+            <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
+                <div class="g-order-list__titlebar">
+                    <div class="left">
+                        <h4>{{ item.goodsdisplay }}</h4>
+                        <span>{{ item.applytime }}</span>
+                    </div>
+                    <div class="right">
+                        <span>{{ getTransferApplyStatusName(item.transferapplystatus) }}</span>
+                    </div>
+                </div>
+                <div class="g-order-list__content">
+                    <ul>
+                        <li>
+                            <span>转入方</span>
+                            <span>{{ item.inusername }}</span>
+                        </li>
+                        <li>
+                            <span>转让数量</span>
+                            <span>{{ item.qty }}</span>
+                        </li>
+                        <li>
+                            <span>转让价格</span>
+                            <span>{{ item.transferprice }}</span>
+                        </li>
+                        <li>
+                            <span>冻结天数</span>
+                            <span>{{ item.freezedays }}</span>
+                        </li>
+                        <li>
+                            <span>商品价格</span>
+                            <span>{{ item.goodscurprice }}</span>
+                        </li>
+                        <li>
+                            <span>手续费</span>
+                            <span>{{ item.outcharge }}</span>
+                        </li>
+                    </ul>
+                </div>
+            </div>
+        </div>
+    </app-pull-refresh>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { useRequest } from '@/hooks/request'
+import { queryOutTradepositiontransfer } from '@/services/api/transfer'
+import { getTransferApplyStatusName } from '@/constants/order'
+
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+
+const dataList = shallowRef<Model.OutTradepositiontransferRsp[]>([])
+const error = shallowRef(false)
+const pullRefreshRef = shallowRef()
+
+const { loading, pageIndex, pageCount, run } = useRequest(queryOutTradepositiontransfer, {
+    params: {
+        pagesize: 20,
+    },
+    onSuccess: (res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res.data)
+    },
+    onError: () => {
+        error.value = true
+    }
+})
+</script>

+ 37 - 0
src/packages/mobile/views/order/inout/index.vue

@@ -0,0 +1,37 @@
+<template>
+    <app-view>
+        <template #header>
+            <app-navbar title="持仓过户">
+                <template #right>
+                    <Icon name="add" size=".4rem" @click="openComponent('add')" />
+                </template>
+            </app-navbar>
+        </template>
+        <Tabs class="van-tabs--list" v-model:active="active">
+            <Tab title="我的转入">
+                <component :is="componentMap.get('in')" />
+            </Tab>
+            <Tab title="我的转出">
+                <component :is="componentMap.get('out')" />
+            </Tab>
+        </Tabs>
+        <component ref="componentRef" :is="componentMap.get(componentId)" @closed="closeComponent"
+            v-if="componentId" />
+    </app-view>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, defineAsyncComponent } from 'vue'
+import { Tab, Tabs, Icon } from 'vant'
+import { useComponent } from '@/hooks/component'
+
+const componentMap = new Map<string, unknown>([
+    ['add', defineAsyncComponent(() => import('./components/add/index.vue'))], // 新增
+    ['in', defineAsyncComponent(() => import('./components/in/list/index.vue'))], // 我的转入
+    ['out', defineAsyncComponent(() => import('./components/out/list/index.vue'))], // 我的转出
+])
+
+const active = shallowRef(0)
+
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+</script>

+ 1 - 1
src/packages/mobile/views/order/list/components/goodstrade/list/Index.vue

@@ -6,7 +6,7 @@
             <div class="g-order-list__box" v-for="(item, index) in dataList" :key="index">
                 <div class="g-order-list__titlebar">
                     <div class="left">
-                        <h5>{{ item.goodscode }}/{{ item.goodsname }}</h5>
+                        <h4>{{ item.goodscode }}/{{ item.goodsname }}</h4>
                     </div>
                     <div class="right">
                         <span>{{ item.tradeid }}</span>

+ 2 - 2
src/packages/pc/views/footer/capital/summary/index.vue

@@ -3,7 +3,7 @@
     <app-table :data="accountStore.accountComputedList" v-model:columns="tableColumns" :row-key="rowKey"
         :expand-row-keys="expandKeys" @row-click="rowClick">
         <!-- 净值 -->
-        <template #netvalue="{ value }">
+        <template #hazardValue="{ value }">
             {{ formatDecimal(value) }}
         </template>
         <!-- 浮动盈亏 -->
@@ -56,7 +56,7 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'accountid', label: '资金账号', width: 160 },
     { prop: 'balance', label: '期初余额', decimal: 2 },
     { prop: 'currentbalance', label: '期末余额', decimal: 2 },
-    { prop: 'netvalue', label: '净值' },
+    { prop: 'hazardValue', label: '净值' },
     { prop: 'avaiableMoney', label: '可用资金', decimal: 2 },
     { prop: 'usedmargin', label: '占用资金', decimal: 2 },
     { prop: 'freezeMargin', label: '预扣保证金', decimal: 2 },

+ 2 - 2
src/packages/pc/views/footer/inout/in/confirm/index.vue

@@ -41,10 +41,10 @@ const onSubmit = () => {
             ApplyID: handleRequestBigNumber(props.selectedRow.applyid)
         }
     }).then(() => {
-        ElMessage.success('提交成功')
+        ElMessage.success('确认成功')
         onCancel(true)
     }).catch((err) => {
-        ElMessage.error('提交失败:' + err)
+        ElMessage.error('确认失败:' + err)
     })
 }
 </script>

+ 1 - 0
src/services/bus/types.ts

@@ -17,6 +17,7 @@ export enum EventCode {
     OrderRsp, // 委托回应通知
     PosChangedNtf, // 头寸变化通知
     RiskControlNtf, // 风控通知
+    RiskToWebNtf, // 风控消息管理端通知客户端
 }
 
 /**

+ 6 - 8
src/services/websocket/message.ts

@@ -83,21 +83,19 @@ export async function pushMessage50(pkg: Package50, contentType: 'encrypted' | '
             }, delay, funCode.toString())
             break
         }
-        case FunCode.RiskControlNtf: {
+        case FunCode.RiskToWebNtf: {
             try {
                 //console.log('接收到风控通知', funCode)
-                const showMessage = (notify: Proto.RiskControlNtf) => {
-                    eventBus.$emit('RiskControlNtf', `账户风险率已达${notify.RiskRate.toFixed(2)}%,风险等级为${notify.RiskLevel},详情请查看风控通知!`)
-                }
                 if (contentType === 'encrypted') {
-                    const res = await decodeProto<Proto.RiskControlNtf>('RiskControlNtf', content)
-                    showMessage(res)
+                    const res = await decodeProto<Proto.RiskToWebNtf>('RiskToWebNtf', content)
+                    eventBus.$emit('RiskToWebNtf', res.Content)
                 } else {
                     const res = new TextDecoder().decode(content)
-                    showMessage(JSON.parse(res))
+                    const data = JSON.parse(res)
+                    eventBus.$emit('RiskToWebNtf', data.Content)
                 }
             } catch (err) {
-                console.error('报文解析失败', FunCode.MarketStatusChangeNtf, err)
+                console.error('报文解析失败', FunCode.RiskToWebNtf, err)
             }
             break
         }

+ 8 - 6
src/stores/modules/account.ts

@@ -28,6 +28,7 @@ export const useAccountStore = defineStore(() => {
             avaiableMoney: number; // 可用资金
             netvalue: number; // 净值
             profitLoss: number; // 浮动盈亏
+            hazardValue: number; // 风险净值
             hazardRatio: number; // 风险率
         })[] = []
 
@@ -45,8 +46,8 @@ export const useAccountStore = defineStore(() => {
             // 根据系统参数“307 账户净值是否减冻结资金 - 0:不减 1:减“
             // 0.净值=期末余额+市值+浮动盈亏(收益权)
             // 1.净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
-            const param037 = userStore.getSystemParamValue('037')
-            const free = param037 === '1' ? item.otherfreezemargin + item.outamountfreeze : 0 // 冻结资金
+            const param307 = userStore.getSystemParamValue('307')
+            const free = param307 === '1' ? item.otherfreezemargin + item.outamountfreeze : 0 // 冻结资金
             const netvalue = item.currentbalance + profitLoss + marketValue - free
 
             // 计算冻结资金 = 冻结+其它冻结+手续费冻结+出金冻结
@@ -67,14 +68,14 @@ export const useAccountStore = defineStore(() => {
             }
 
             // 计算风险净值 = 期末余额 + 浮动盈亏(收益权) - 其他冻结 - 出金冻结
-            let valueAtRisk = item.currentbalance + profitLoss - item.otherfreezemargin - item.outamountfreeze
+            let hazardValue = item.currentbalance + profitLoss - item.otherfreezemargin - item.outamountfreeze
 
             // 根据系统参数“087 风险净值是否加上市值 - 0:不加 1:加“
             const param087 = userStore.getSystemParamValue('087')
 
             if (param087 === '1') {
                 // 风险净值 = 期末余额 + 市值(所有权) + 浮动盈亏(收益权) - 其他冻结 - 出金冻结
-                valueAtRisk += marketValue
+                hazardValue += marketValue
             }
 
             // 计算风险率
@@ -85,10 +86,10 @@ export const useAccountStore = defineStore(() => {
 
             if (param132 === '1') {
                 // 风险率 = 占用 / 风险净值
-                hazardRatio = item.usedmargin / valueAtRisk
+                hazardRatio = item.usedmargin / hazardValue
             } else {
                 // 风险率 = (占用 - 授信金额) / (风险净值 - 授信金额)
-                hazardRatio = (item.usedmargin - item.mortgagecredit) / (valueAtRisk - item.mortgagecredit)
+                hazardRatio = (item.usedmargin - item.mortgagecredit) / (hazardValue - item.mortgagecredit)
             }
 
             result.push({
@@ -97,6 +98,7 @@ export const useAccountStore = defineStore(() => {
                 avaiableMoney,
                 netvalue,
                 profitLoss,
+                hazardValue,
                 hazardRatio
             })
         })

+ 8 - 0
src/types/proto/notify.d.ts

@@ -38,5 +38,13 @@ declare global {
             CurrentNetBalance: number; // double 净值
             RiskType: number; // int32 风控类型:0:默认风险率监控,1:安全度风控
         }
+
+        /** 风控消息管理端通知客户端 */
+        interface RiskToWebNtf {
+            Header: IMessageHead;
+            NtfHeader: NotifyHead; // NotifyHead 公共消息头
+            MsgId: number; // uint64 消息ID
+            Content: string; // string 消息内容
+        }
     }
 }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است