Handy_Cao 2 years ago
parent
commit
390ccf6d1e
1 changed files with 22 additions and 2 deletions
  1. 22 2
      src/packages/pc/views/market/trade/swap/detail/order/index.vue

+ 22 - 2
src/packages/pc/views/market/trade/swap/detail/order/index.vue

@@ -27,7 +27,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent, watch, PropType } from 'vue'
+import { shallowRef, defineAsyncComponent, watch, PropType, onUnmounted } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { BuyOrSell } from '@/constants/order'
 import { useComponent } from '@/hooks/component'
@@ -35,6 +35,8 @@ import { useComposeTable } from '@pc/components/base/table'
 import { queryTjmdTradeOrderDetail } from '@/services/api/swap'
 import { useLoginStore, useFuturesStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
+import eventBus from '@/services/bus'
+import { onMounted } from 'vue'
 
 const props = defineProps({
     goodsId: {
@@ -56,7 +58,12 @@ const futuresStore = useFuturesStore()
 const quote = futuresStore.getGoodsQuote(props.goodsId)
 
 const { rowKey, expandKeys, selectedRow, rowClick } = useComposeTable<Model.TjmdTradeOrderDetailRsp>({ rowKey: 'orderid' })
-const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(()=> {
+    // 获取买大厅数据
+    getBuyList()
+    // 获取卖大厅数据
+    getSellList()
+})
 
 const { dataList: buyList, run: getBuyList } = useRequest(queryTjmdTradeOrderDetail, {
     params: {
@@ -104,6 +111,19 @@ watch(() => quote.value, () => {
     getBuyList()
     getSellList()
 })
+
+onUnmounted(() => {
+    notify.cancel()
+})
+
+// 推送委托回应通知
+const notify = eventBus.$on('OrderRsp', () => {
+    // 获取买大厅数据
+    getBuyList()
+    // 获取卖大厅数据
+    getSellList()
+})
+
 </script>
 
 <style lang="less">