li.shaoyi 1 éve
szülő
commit
e2aa8f3d79

+ 25 - 0
src/packages/pc/components/base/table-v2/index.less

@@ -6,6 +6,31 @@
     height: 100%;
     color: #fff;
 
+    &__header {
+        display: flex;
+        align-items: center;
+
+        >.block {
+            display: inline-flex;
+            align-items: center;
+            gap: 10px;
+            padding: 6px;
+
+            &:empty {
+                display: none;
+            }
+
+            &--right {
+                margin-left: auto;
+            }
+        }
+    }
+
+    .el-auto-resizer {
+        flex: 1;
+        overflow: hidden;
+    }
+
     .el-table-v2 {
         --el-bg-color: #181e22; //表格背景颜色
         --el-table-row-hover-bg-color: #172b56; // 表格行鼠标经过背景色

+ 8 - 0
src/packages/pc/components/base/table-v2/index.vue

@@ -1,5 +1,13 @@
 <template>
   <div class="app-table-v2">
+    <div class="app-table-v2__header">
+      <div class="block block--left">
+        <slot name="headerLeft"></slot>
+      </div>
+      <div class="block block--right">
+        <slot name="headerRight"></slot>
+      </div>
+    </div>
     <el-auto-resizer>
       <template #default="{ height, width }">
         <el-table-v2 :data="tableList" :columns="generateColumns(width)" :width="width" :height="height"

+ 77 - 0
src/packages/pc/views/footer/pricing/detail2/components/clear/index.vue

@@ -0,0 +1,77 @@
+<!-- 挂牌点价-持仓明细-一键退订 -->
+<template>
+    <app-drawer :title="t('common.tips')" v-model:show="show" :loading="loading" :refresh="refresh">
+        <div class="g-text-message">是否退订全部订单?</div>
+        <template #footer>
+            <el-button type="info" @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.confirm') }}</el-button>
+        </template>
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { ref } from 'vue'
+import { ElMessage } from 'element-plus'
+import { handleRequestBigNumber } from '@/filters'
+import { EBuildType, EDelistingType, EListingSelectType, EValidType, EOrderOperateType } from '@/constants/client'
+import { BuyOrSell, PriceMode } from '@/constants/order'
+import { useOrder } from '@/business/trade'
+import { i18n, useSBYJOrderStore, useFuturesStore } from '@/stores'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+
+const { t } = i18n.global
+
+const sbyjOrderStore = useSBYJOrderStore()
+const futuresStore = useFuturesStore()
+const show = ref(true)
+const refresh = ref(false)
+const loading = ref(false)
+
+const { formSubmit, formData } = useOrder()
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+const onSubmit = async () => {
+    loading.value = true
+    const list = sbyjOrderStore.orderComputedList
+    const errMessage: string[] = []
+
+    for (let i = 0; i < list.length; i++) {
+        const { holderQty, freezeQty, marketID, goodsID, buyOrSell, tradeID } = list[i].tHDetailEx
+        const enableQty = holderQty - freezeQty // 可用数量
+        const quote = futuresStore.getGoodsQuote(list[i].goodsCode)
+
+        if (quote.value && enableQty) {
+            formData.Header = { MarketID: marketID, GoodsID: goodsID }
+            formData.MarketID = marketID
+            formData.GoodsID = goodsID
+            formData.PriceMode = PriceMode.Market
+            formData.BuyOrSell = buyOrSell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
+            formData.OrderPrice = buyOrSell === BuyOrSell.Buy ? quote.value.ask : quote.value.bid
+            formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTINGTHENLISTING
+            formData.DelistingType = EDelistingType.DELISTINGTYPE_PRICE
+            formData.BuildType = EBuildType.BUILDTYPE_CLOSE
+            formData.TimevalidType = EValidType.VALIDTYPE_DR
+            formData.OperateType = EOrderOperateType.ORDEROPERATETYPE_HOLDER_CLOSE
+            formData.RelatedID = handleRequestBigNumber(tradeID)
+            formData.OrderQty = enableQty
+
+            await formSubmit().catch((err) => {
+                errMessage.push(err)
+            })
+        }
+    }
+
+    loading.value = false
+
+    if (errMessage.length) {
+        ElMessage.error(t('common.tips5') + errMessage[0])
+    } else {
+        ElMessage.success(t('common.tips4'))
+    }
+    onCancel(true)
+}
+</script>

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

@@ -1,6 +1,11 @@
 <!-- 挂牌点价-持仓明细 按账户风控 -->
 <template>
     <app-table-v2 :data="sbyjOrderStore.orderComputedList" :columns="tableColumns">
+        <template #headerRight>
+            <div class="buttonbar" v-if="sbyjOrderStore.orderComputedList.length">
+                <el-button type="primary" size="small" @click="openComponent('clear')">一键退订</el-button>
+            </div>
+        </template>
         <template #footer>
             <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
                 @closed="closeComponent" v-if="componentId" />
@@ -22,6 +27,7 @@ import AppTableV2 from '@pc/components/base/table-v2/index.vue'
 const componentMap = new Map<string, unknown>([
     ['transfer', defineAsyncComponent(() => import('./components/transfer/index.vue'))],
     ['delivery', defineAsyncComponent(() => import('./components/delivery/index.vue'))],
+    ['clear', defineAsyncComponent(() => import('./components/clear/index.vue'))],
 ])
 
 const t = i18n.global.t

+ 1 - 1
src/packages/pc/views/market/trade/pricing/list/listing/index.vue

@@ -235,7 +235,7 @@ const onPriceClick = (buyorsell: BuyOrSell, value: number) => {
 
 // 价格输入框获取焦点
 const priceInputFocus = () => {
-    priceRef.value.focus()
+    priceRef.value?.focus()
 }
 
 // 数量输入框获取焦点

+ 23 - 21
src/services/websocket/message.ts

@@ -14,7 +14,7 @@ export async function pushMessage50(pkg: Package50, contentType: 'encrypted' | '
     const { getErrorInfoByCode } = useErrorInfoStore()
     const { funCode, content } = pkg
     const delay = 500 // 延迟推送消息,防止短时间内重复请求
-    
+
     console.log('接收广播通知', funCode)
 
     switch (funCode) {
@@ -94,27 +94,29 @@ export async function pushMessage50(pkg: Package50, contentType: 'encrypted' | '
             break
         }
         case FunCode.RiskToWebNtf: {
-            try {
-                let res: Proto.RiskToWebNtf
-                if (contentType === 'encrypted') {
-                    res = await decodeProto<Proto.RiskToWebNtf>('RiskToWebNtf', content)
-                } else {
-                    const data = new TextDecoder().decode(content)
-                    res = JSON.parse(data)
-                }
-                const msg = JSON.parse(res.Content)
-                switch (true) {
-                    case [1, 2].includes(res.RiskLevel):
-                        eventBus.$emit('RiskToWebNtf', msg, 1)
-                        break
-                    case [3, 5].includes(res.RiskLevel):
-                        eventBus.$emit('RiskToWebNtf', msg, 2)
-                        break
+            timerInterceptor.debounce(async () => {
+                try {
+                    let res: Proto.RiskToWebNtf
+                    if (contentType === 'encrypted') {
+                        res = await decodeProto<Proto.RiskToWebNtf>('RiskToWebNtf', content)
+                    } else {
+                        const data = new TextDecoder().decode(content)
+                        res = JSON.parse(data)
+                    }
+                    const msg = JSON.parse(res.Content)
+                    switch (true) {
+                        case [1, 2].includes(res.RiskLevel):
+                            eventBus.$emit('RiskToWebNtf', msg, 1)
+                            break
+                        case [3, 5].includes(res.RiskLevel):
+                            eventBus.$emit('RiskToWebNtf', msg, 2)
+                            break
+                    }
+                    console.log('接收到风控通知', funCode, res)
+                } catch (err) {
+                    console.error('报文解析失败', funCode, err)
                 }
-                console.log('接收到风控通知', funCode, res)
-            } catch (err) {
-                console.error('报文解析失败', funCode, err)
-            }
+            }, delay, funCode.toString())
             break
         }
         default: {