|
|
@@ -1,24 +1,30 @@
|
|
|
<template>
|
|
|
- <app-view>
|
|
|
+ <app-view class="goods-detail">
|
|
|
<template #header>
|
|
|
- <app-navbar title="订单挂牌大厅" >
|
|
|
+ <app-navbar :title="item.goodscode+'/'+item.goodsname" >
|
|
|
<template #right>
|
|
|
<div class="button-more" @click="onListing">
|
|
|
<span>挂牌</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</app-navbar>
|
|
|
- <div>
|
|
|
- <span>{{ item.goodsname }}/{{ item.goodscode }}</span>
|
|
|
- <span>--</span>
|
|
|
- </div>
|
|
|
</template>
|
|
|
- <Tabs v-model:active="tabIndex" @click="onTabChange">
|
|
|
- <Tab title="买大厅" />
|
|
|
- <Tab title="卖大厅" />
|
|
|
- </Tabs>
|
|
|
+ <div class="goods-detail_quote" v-if="quote">
|
|
|
+ <ul class="price">
|
|
|
+ <li :class="quote.lastColor">{{ quote.last }}</li>
|
|
|
+ <li :class="quote.lastColor">{{ handleNumberValue(quote.rise.toFixed(quote.decimalplace)) }}</li>
|
|
|
+ <li :class="quote.lastColor">{{ parsePercent(quote.change) }}</li>
|
|
|
+ </ul>
|
|
|
+ <ul class="time">
|
|
|
+ <li>{{ formatDate(quote.lasttime, 'MM-DD HH:mm:ss') }}</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
<app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
|
|
|
:page-count="pageCount" @refresh="onTabChange">
|
|
|
+ <Tabs v-model:active="tabIndex" @click="onTabChange">
|
|
|
+ <Tab title="买大厅" />
|
|
|
+ <Tab title="卖大厅" />
|
|
|
+ </Tabs>
|
|
|
<div class="trade-section sell" v-if="dataList.length">
|
|
|
<app-list :columns="columns" :data-list="dataList">
|
|
|
<template #username="{ row }">
|
|
|
@@ -36,21 +42,27 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
+import { shallowRef, onMounted, onUnmounted,defineAsyncComponent } from 'vue'
|
|
|
import { Tab, Tabs, Button, showToast } from 'vant'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
import { useNavigation } from '@/hooks/navigation'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
-import AppList from '@mobile/components/base/list/index.vue'
|
|
|
import { queryWrTradeOrderDetail } from '@/services/api/transfer'
|
|
|
-import { useLoginStore } from '@/stores'
|
|
|
+import { useLoginStore, useFuturesStore } from '@/stores'
|
|
|
+import { parsePercent, handleNumberValue, formatDate } from '@/filters'
|
|
|
+
|
|
|
+import AppList from '@mobile/components/base/list/index.vue'
|
|
|
import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
+import quoteSocket from '@/services/websocket/quote'
|
|
|
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
['delisting', defineAsyncComponent(() => import('./components/delisting/Index.vue'))],
|
|
|
['listing', defineAsyncComponent(() => import('./components/listing/Index.vue'))],
|
|
|
])
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const loginStore = useLoginStore()
|
|
|
|
|
|
const { getParamString } = useNavigation()
|
|
|
@@ -60,6 +72,8 @@ const tabIndex = shallowRef(0)
|
|
|
const selectedRow = shallowRef<Model.WrTradeOrderDetailRsp>()
|
|
|
const error = shallowRef(false)
|
|
|
const dataList = shallowRef<Model.WrTradeOrderDetailRsp[]>([])
|
|
|
+const subscribe = quoteSocket.addSubscribe([item.goodscode])
|
|
|
+const quote = futuresStore.getQuoteInfo(item.goodscode)
|
|
|
|
|
|
const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetail, {
|
|
|
params: {
|
|
|
@@ -80,7 +94,8 @@ const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetai
|
|
|
|
|
|
const onTabChange = () => {
|
|
|
run({
|
|
|
- buyorsell: tabIndex.value
|
|
|
+ buyorsell: tabIndex.value,
|
|
|
+ page: 1
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -105,4 +120,9 @@ const onListing = () => {
|
|
|
openComponent('listing')
|
|
|
}
|
|
|
|
|
|
+onMounted(() => subscribe.start())
|
|
|
+
|
|
|
+onUnmounted(() => subscribe.stop())
|
|
|
+
|
|
|
+
|
|
|
</script>
|