Index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <app-view class="g-detail">
  3. <template #header>
  4. <app-navbar title="转让详情" />
  5. </template>
  6. <Swipe class="g-detail__banner" :autoplay="5000" indicator-color="white" lazy-render>
  7. <SwipeItem v-for="(url, index) in detailBanners" :key="index">
  8. <img :src="url" />
  9. </SwipeItem>
  10. </Swipe>
  11. <div class="g-detail__info" v-if="detail">
  12. <div class="pricebar">
  13. <div class="pricebar-left">
  14. <span class="tag">最新价</span>
  15. <span class="unit">¥</span>
  16. <span class="price">{{ getQuotePrice(detail.goodscode) }}</span>
  17. </div>
  18. <div class="pricebar-right">
  19. <span>订货价:{{ detail.presaleprice.toFixed(2) }}</span>
  20. </div>
  21. </div>
  22. <div class="titlebar">
  23. <span>{{ detail.sellname }}</span>
  24. <span>{{ detail.goodsname }}</span>
  25. </div>
  26. </div>
  27. <Cell title="转让列表" />
  28. <app-list :columns="columns" :data-list="sellList" />
  29. <div class="g-detail__desc">
  30. <template v-for="(url, index) in detailImages" :key="index">
  31. <img :src="url" alt="" />
  32. </template>
  33. </div>
  34. <template #footer>
  35. <div class="g-detail__footer">
  36. <Button type="primary" block round @click="openComponent('listing')">我要转让</Button>
  37. </div>
  38. <component ref="componentRef" :is="componentMap.get(componentId)" v-bind="{ detail }" @closed="closeComponent"
  39. v-if="componentId" />
  40. </template>
  41. </app-view>
  42. </template>
  43. <script lang="ts" setup>
  44. import { computed, defineAsyncComponent } from 'vue'
  45. import { Swipe, SwipeItem, Button, Cell } from 'vant'
  46. import { getFileUrl } from '@/filters'
  47. import { useRequest } from '@/hooks/request'
  48. import { BuyOrSell } from '@/constants/order'
  49. import { queryPresaleDefault } from '@/services/api/transfer'
  50. import { queryTjmdTradeOrderDetail } from '@/services/api/swap'
  51. import { useComponent } from '@/hooks/component'
  52. import { useNavigation } from '@/hooks/navigation'
  53. import { useFuturesStore } from '@/stores'
  54. import AppList from '@mobile/components/base/list/index.vue'
  55. const componentMap = new Map<string, unknown>([
  56. ['listing', defineAsyncComponent(() => import('./components/listing/index.vue'))], // 挂牌
  57. ['delisting', defineAsyncComponent(() => import('./components/delisting/index.vue'))], // 摘牌
  58. ])
  59. const { getQueryStringToNumber } = useNavigation()
  60. const { componentRef, componentId, openComponent, closeComponent } = useComponent()
  61. const { getQuotePrice } = useFuturesStore()
  62. const goodsid = getQueryStringToNumber('goodsid')
  63. const { data: detail } = useRequest(queryPresaleDefault, {
  64. params: {
  65. goodsid,
  66. }
  67. })
  68. const { dataList: sellList } = useRequest(queryTjmdTradeOrderDetail, {
  69. params: {
  70. pagesize: 3,
  71. goodsid,
  72. buyorsell: BuyOrSell.Sell,
  73. }
  74. })
  75. const columns: Model.TableColumn[] = [
  76. { prop: 'username', label: '挂牌方' },
  77. { prop: 'orderqty', label: '数量' },
  78. { prop: 'orderprice', label: '价格' },
  79. { prop: 'operate', label: '操作' },
  80. ]
  81. // 商品banner
  82. const detailBanners = computed(() => {
  83. const bannerpicurl = detail.value?.bannerpicurl ?? ''
  84. return bannerpicurl?.split(',').map((path) => getFileUrl(path))
  85. })
  86. // 商品图片列表
  87. const detailImages = computed(() => {
  88. const pictureurls = detail.value?.pictureurls ?? ''
  89. return pictureurls.split(',').map((path) => getFileUrl(path))
  90. })
  91. </script>
  92. <style lang="less">
  93. @import './index.less';
  94. </style>