|
|
@@ -11,29 +11,28 @@
|
|
|
</template>
|
|
|
<component :is="Price" v-bind="{ goodsCode }" />
|
|
|
<component :is="Chart" v-bind="{ goodsCode }" />
|
|
|
+ <Tabs v-model:active="tabIndex" @click="onRefresh" style="margin-top: .2rem;">
|
|
|
+ <Tab title="买大厅" :name="BuyOrSell.Buy" />
|
|
|
+ <Tab title="卖大厅" :name="BuyOrSell.Sell" />
|
|
|
+ </Tabs>
|
|
|
+ <div class="trade-section sell" v-if="dataList.length">
|
|
|
+ <app-list :columns="columns" :data-list="dataList">
|
|
|
+ <template #orderprice="{ row }">
|
|
|
+ <span :class="quote?.lastColor">{{ row.pricemode === 3 ? estimateprice(row) : row.orderprice
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ <template #username="{ row }">
|
|
|
+ <span>{{ row.userid }}/{{ row.username }}</span>
|
|
|
+ </template>
|
|
|
+ <template #operate="{ row }">
|
|
|
+ <Button size="small" type="primary" :disabled="isDisable(row)" @click="onDelisting(row)">
|
|
|
+ {{ getDelistingButtonTitles(tabIndex, row) }}
|
|
|
+ </Button>
|
|
|
+ </template>
|
|
|
+ </app-list>
|
|
|
+ </div>
|
|
|
+ <Empty description="暂无数据" v-else />
|
|
|
<component :is="Tik" v-bind="{ goodsCode }" />
|
|
|
- <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
|
|
|
- :page-count="pageCount" @refresh="onRefresh">
|
|
|
- <Tabs v-model:active="tabIndex" @click="onTabChange">
|
|
|
- <Tab title="买大厅" :name="BuyOrSell.Buy" />
|
|
|
- <Tab title="卖大厅" :name="BuyOrSell.Sell" />
|
|
|
- </Tabs>
|
|
|
- <div class="trade-section sell" v-if="dataList.length">
|
|
|
- <app-list :columns="columns" :data-list="dataList">
|
|
|
- <template #orderprice="{ row }">
|
|
|
- <span :class="quote?.lastColor">{{ row.pricemode === 3 ? estimateprice(row) : row.orderprice }}</span>
|
|
|
- </template>
|
|
|
- <template #username="{ row }">
|
|
|
- <span>{{ row.userid }}/{{ row.username }}</span>
|
|
|
- </template>
|
|
|
- <template #operate="{ row }">
|
|
|
- <Button size="small" type="primary" :disabled="isDisable(row)" @click="onDelisting(row)">
|
|
|
- {{ getDelistingButtonTitles(tabIndex, row) }}
|
|
|
- </Button>
|
|
|
- </template>
|
|
|
- </app-list>
|
|
|
- </div>
|
|
|
- </app-pull-refresh>
|
|
|
<component ref="componentRef" :is="componentMap.get(componentId)" v-bind="{ selectedRow, tabIndex, item }"
|
|
|
@closed="closeComponent" v-if="componentId" />
|
|
|
</app-view>
|
|
|
@@ -41,7 +40,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, defineAsyncComponent, computed } from 'vue'
|
|
|
-import { Tab, Tabs, Button, showToast } from 'vant'
|
|
|
+import { Tab, Tabs, Button, showToast,Empty } from 'vant'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
@@ -49,13 +48,12 @@ import { BuyOrSell } from '@/constants/order'
|
|
|
import { queryTjmdTradeOrderDetail, queryMdUserSwapProtocol } from '@/services/api/swap'
|
|
|
import { useFuturesStore } from '@/stores'
|
|
|
import { useLoginStore, useUserStore } from '@/stores'
|
|
|
-import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
import AppList from '@mobile/components/base/list/index.vue'
|
|
|
import { getUserId } from '@/services/methods/user'
|
|
|
import { formatDecimal } from '@/filters'
|
|
|
|
|
|
const Price = defineAsyncComponent(() => import('@mobile/components/modules/quote/price/index.vue'))
|
|
|
-const Chart = defineAsyncComponent(() => import('@mobile/components/modules/quote/chart/index.vue'))
|
|
|
+const Chart = defineAsyncComponent(() => import('@mobile/components/modules/hqchart/index.vue'))
|
|
|
const Tik = defineAsyncComponent(() => import('@mobile/components/modules/quote/tik/index.vue'))
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
@@ -63,23 +61,20 @@ const componentMap = new Map<string, unknown>([
|
|
|
['listing', defineAsyncComponent(() => import('./components/listing/Index.vue'))],
|
|
|
])
|
|
|
|
|
|
-const pullRefreshRef = shallowRef()
|
|
|
const loginStore = useLoginStore()
|
|
|
const { getGlobalUrlParams, router } = useNavigation()
|
|
|
const item: Model.QuoteGoodsListRsp = getGlobalUrlParams()
|
|
|
const tabIndex = shallowRef(0)
|
|
|
const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
|
|
|
-const error = shallowRef(false)
|
|
|
-const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
|
|
|
const futuresStore = useFuturesStore()
|
|
|
const quote = futuresStore.getGoodsQuote(item.refgoodsid)
|
|
|
const goodsCode = computed(() => quote.value?.goodscode ?? '')
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
-const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => onTabChange())
|
|
|
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => onRefresh())
|
|
|
|
|
|
/// 查询用户掉期协议签署表
|
|
|
-const { dataList: protocolList} = useRequest(queryMdUserSwapProtocol, {
|
|
|
+const { dataList: protocolList } = useRequest(queryMdUserSwapProtocol, {
|
|
|
params: {
|
|
|
userId: getUserId()
|
|
|
}
|
|
|
@@ -88,37 +83,27 @@ const { dataList: protocolList} = useRequest(queryMdUserSwapProtocol, {
|
|
|
/// 估算价格
|
|
|
const estimateprice = (row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
const decimalplace = (item.decimalplace ?? 2.0)
|
|
|
- return formatDecimal((row.marketmaxsub+(quote.value?.last ?? 0.0)), decimalplace)
|
|
|
+ return formatDecimal((row.marketmaxsub + (quote.value?.last ?? 0.0)), decimalplace)
|
|
|
}
|
|
|
|
|
|
const isDisable = (row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
- return row.userid === getUserId() || ( status(row) === 2 || status(row) === 3 )
|
|
|
+ return row.userid === getUserId() || (status(row) === 2 || status(row) === 3)
|
|
|
}
|
|
|
|
|
|
const status = (row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
return protocolList.value.find((e) => e.areauserid === row.userid)?.protocolstatus ?? 1
|
|
|
}
|
|
|
|
|
|
-const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDetail, {
|
|
|
+const { dataList, run } = useRequest(queryTjmdTradeOrderDetail, {
|
|
|
params: {
|
|
|
- pagesize: 20,
|
|
|
goodsid: item.goodsid,
|
|
|
buyorsell: tabIndex.value
|
|
|
- },
|
|
|
- onSuccess: (res) => {
|
|
|
- if (pageIndex.value === 1) {
|
|
|
- dataList.value = []
|
|
|
- }
|
|
|
- dataList.value.push(...res.data)
|
|
|
- },
|
|
|
- onError: () => {
|
|
|
- error.value = true
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const getDelistingButtonTitles = (tab: number, row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
/// 如果是机构自己的单 不能签署
|
|
|
- if (row.userid === getUserId() ) {
|
|
|
+ if (row.userid === getUserId()) {
|
|
|
return '摘牌'
|
|
|
}
|
|
|
switch (status(row)) {
|
|
|
@@ -137,7 +122,7 @@ const getDelistingButtonTitles = (tab: number, row: Model.TjmdTradeOrderDetailRs
|
|
|
setTimeout(() => {
|
|
|
// 获取买卖大厅数据
|
|
|
run()
|
|
|
-}, 30*1000)
|
|
|
+}, 30 * 1000)
|
|
|
|
|
|
const onRefresh = () => {
|
|
|
run({
|
|
|
@@ -145,12 +130,6 @@ const onRefresh = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const onTabChange = () => {
|
|
|
- /// 重置为1
|
|
|
- pageIndex.value = 1
|
|
|
- onRefresh()
|
|
|
-}
|
|
|
-
|
|
|
const columns: Model.TableColumn[] = [
|
|
|
{ prop: 'orderprice', label: '价格' },
|
|
|
{ prop: 'orderqty', label: '数量' },
|
|
|
@@ -172,8 +151,8 @@ const onDelisting = (row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
case 1: /// 未签署
|
|
|
/// 传对应的机构 ID
|
|
|
/// 进行下一步
|
|
|
- router.push({ name: 'account-protocol', query: { memberUserId: row.userid.toString() }})
|
|
|
- break;
|
|
|
+ router.push({ name: 'account-protocol', query: { memberUserId: row.userid.toString() } })
|
|
|
+ break;
|
|
|
default: /// 其他状态
|
|
|
break;
|
|
|
}
|