|
|
@@ -9,53 +9,59 @@
|
|
|
</template>
|
|
|
</app-navbar>
|
|
|
</template>
|
|
|
- <Tabs v-model:active="tabIndex">
|
|
|
- <Tab title="卖大厅" />
|
|
|
+ <Tabs v-model:active="tabIndex" @click="onTabChange">
|
|
|
<Tab title="买大厅" />
|
|
|
+ <Tab title="卖大厅" />
|
|
|
</Tabs>
|
|
|
- <div class="trade">
|
|
|
- <div class="trade-section sell" v-if="dataList.length">
|
|
|
- <app-list :columns="columns" :data-list="dataList">
|
|
|
- <template #username="{ row }">
|
|
|
- <span >{{ row.userid }}</span>
|
|
|
- <span >{{ row.username }}</span>
|
|
|
- </template>
|
|
|
- <template #operate="{ row }">
|
|
|
- <Button size="small" type="primary" round @click="onDelisting(row, tabIndex)">摘牌</Button>
|
|
|
- </template>
|
|
|
- </app-list>
|
|
|
- </div>
|
|
|
+ <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
|
|
|
+ :page-count="pageCount" @refresh="onTabChange">
|
|
|
+ <div class="trade-section sell" v-if="dataList.length">
|
|
|
+ <app-list :columns="columns" :data-list="dataList">
|
|
|
+ <template #username="{ row }">
|
|
|
+ <span >{{ row.userid }}</span>
|
|
|
+ <span >{{ row.username }}</span>
|
|
|
+ </template>
|
|
|
+ <template #operate="{ row }">
|
|
|
+ <Button size="small" type="primary" round @click="onDelisting(row)">{{ tabIndex === 0 ? '卖出' : '买入' }}</Button>
|
|
|
+ </template>
|
|
|
+ </app-list>
|
|
|
</div>
|
|
|
- <component ref="componentRef" :is="componentMap.get(componentId)" v-bind="{ selectedRow, tabIndex }" @closed="closeComponent"
|
|
|
+ </app-pull-refresh>
|
|
|
+ <component ref="componentRef" :is="componentMap.get(componentId)" v-bind="{ selectedRow, tabIndex, item }" @closed="closeComponent"
|
|
|
v-if="componentId" />
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
-import { Tab, Tabs, Button } from 'vant'
|
|
|
+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 { queryTjmdTradeOrderDetail } from '@/services/api/swap'
|
|
|
+import { useLoginStore } from '@/stores'
|
|
|
+import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
['delisting', defineAsyncComponent(() => import('./components/delisting/Index.vue'))],
|
|
|
- ['listing', defineAsyncComponent(() => import('./components/delisting/Index.vue'))],
|
|
|
+ ['listing', defineAsyncComponent(() => import('./components/listing/Index.vue'))],
|
|
|
])
|
|
|
|
|
|
-const { getQueryStringToNumber } = useNavigation()
|
|
|
+const loginStore = useLoginStore()
|
|
|
+
|
|
|
+const { getParamString } = useNavigation()
|
|
|
const { componentRef, componentId, openComponent, closeComponent } = useComponent()
|
|
|
-const goodsId = getQueryStringToNumber('id')
|
|
|
+const item: Model.QuoteGoodsListRsp = JSON.parse(getParamString('item')?.toString() || '{}')
|
|
|
const tabIndex = shallowRef(0)
|
|
|
const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
|
|
|
const error = shallowRef(false)
|
|
|
const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
|
|
|
|
|
|
-const { pageIndex } = useRequest(queryTjmdTradeOrderDetail, {
|
|
|
+const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDetail, {
|
|
|
params: {
|
|
|
- goodsid: goodsId,
|
|
|
+ pagesize: 20,
|
|
|
+ goodsid: item.goodsid,
|
|
|
buyorsell: tabIndex.value
|
|
|
},
|
|
|
onSuccess: (res) => {
|
|
|
@@ -69,6 +75,12 @@ const { pageIndex } = useRequest(queryTjmdTradeOrderDetail, {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+const onTabChange = () => {
|
|
|
+ run({
|
|
|
+ buyorsell: tabIndex.value
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
const columns: Model.TableColumn[] = [
|
|
|
{ prop: 'orderprice', label: '价格' },
|
|
|
{ prop: 'orderqty', label: '数量' },
|
|
|
@@ -76,18 +88,18 @@ const columns: Model.TableColumn[] = [
|
|
|
{ prop: 'operate', label: '摘牌' },
|
|
|
]
|
|
|
|
|
|
-const onDelisting = (row: Model.TjmdTradeOrderDetailRsp, value: number) => {
|
|
|
- tabIndex.value = value
|
|
|
+const onDelisting = (row: Model.TjmdTradeOrderDetailRsp) => {
|
|
|
selectedRow.value = row
|
|
|
- showComponent('delisting')
|
|
|
+ /// 不能与自己成交
|
|
|
+ if (row.userid === loginStore.userId) {
|
|
|
+ showToast('不能与自己成交')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ openComponent('delisting')
|
|
|
}
|
|
|
|
|
|
const onListing = () => {
|
|
|
- showComponent('listing')
|
|
|
-}
|
|
|
-
|
|
|
-const showComponent = (componentName: string) => {
|
|
|
- openComponent(componentName)
|
|
|
+ openComponent('listing')
|
|
|
}
|
|
|
|
|
|
</script>
|