index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <app-view class="home-main" flex>
  3. <template #header>
  4. <app-navbar title="铁合金掌上行" :show-back-button="false" />
  5. </template>
  6. <div class="home-main__banner home-main__banner--header">
  7. <Swipe :autoplay="3000" indicator-color="white" lazy-render>
  8. <SwipeItem v-for="(item, index) in topBanners" :key="index">
  9. <img :src="getImageUrl(item.imagepath)" />
  10. </SwipeItem>
  11. </Swipe>
  12. </div>
  13. <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh">
  14. <div class="home-main__iconbar">
  15. <ul>
  16. <li @click="routerTo('product')">
  17. <app-iconfont icon="icon-chanpinjieshao" label-direction="bottom">产品介绍</app-iconfont>
  18. </li>
  19. <li @click="routerTo('contract')">
  20. <app-iconfont icon="icon-chanpinjiage" label-direction="bottom">合同转让</app-iconfont>
  21. </li>
  22. <li @click="routerTo('rules-ptgz')">
  23. <app-iconfont icon="icon-pingtaiguize" label-direction="bottom">平台规则</app-iconfont>
  24. </li>
  25. </ul>
  26. <ul>
  27. <li @click="routerTo('credit-signin')">
  28. <app-iconfont icon="icon-woderenwu" label-direction="bottom">我的任务</app-iconfont>
  29. </li>
  30. <li @click="routerTo('rules-myrz')">
  31. <app-iconfont icon="icon-maoyirongzi" label-direction="bottom">贸易融资</app-iconfont>
  32. </li>
  33. <li @click="routerTo('rules-ccwl')">
  34. <app-iconfont icon="icon-a-bianzu12" label-direction="bottom">仓储物流</app-iconfont>
  35. </li>
  36. </ul>
  37. </div>
  38. <div class="home-main__market" v-if="false">
  39. <div class="left">
  40. <h2>合金指数</h2>
  41. <span>{{ formatDate(marketRun.tradedate, "YYYY-MM-DD") }}</span>
  42. </div>
  43. <div class="right">
  44. <table cellspacing="0" cellpadding="0">
  45. <tbody>
  46. <tr v-for="(item, index) in dataList" :key="index">
  47. <td>{{ item.wrstandardname }}</td>
  48. <td>{{ item.prespotgoodsprice }}</td>
  49. <td>{{ item.todayspotgoodsprice }}</td>
  50. <td>{{ item.chg }}</td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <div class="home-main__banner home-main__banner--body">
  57. <Swipe :autoplay="3000" indicator-color="white" lazy-render>
  58. <SwipeItem v-for="(item, index) in bodyBanners" :key="index">
  59. <img :src="getImageUrl(item.imagepath)" />
  60. </SwipeItem>
  61. </Swipe>
  62. </div>
  63. <div class="home-main__news">
  64. <Cell class="titlebar" title-class="titlebar-title" value-class="titlebar-more" title="市场资讯" value="更多资讯"
  65. :to="{ name: 'news-list' }" is-link />
  66. <CellGroup class="article">
  67. <template v-for="(item, index) in newsList" :key="index">
  68. <Cell class="article-item" title-class="article-item__title" value-class="article-item__time"
  69. :title="item.title" :value="formatDate(item.creaedate, 'MM/DD')"
  70. :to="{ name: 'news-details', params: { details: JSON.stringify(item) } }" />
  71. </template>
  72. </CellGroup>
  73. </div>
  74. </PullRefresh>
  75. </app-view>
  76. </template>
  77. <script lang="ts" setup>
  78. import { shallowRef } from 'vue'
  79. import { Cell, CellGroup, Swipe, SwipeItem, PullRefresh } from 'vant'
  80. import { getImageUrl, formatDate } from '@/filters'
  81. import { useNavigation } from '@/hooks/navigation'
  82. import { queryImageConfigs } from '@/services/api/common'
  83. import { querySiteColumnDetail } from '@/services/api/news'
  84. import { useQuerySpotGoodsPriceLists } from '@/business/goods'
  85. import { queryMarketRun } from '@/services/api/goods'
  86. import AppIconfont from '@mobile/components/base/iconfont/index.vue'
  87. const { routerTo } = useNavigation()
  88. const refreshing = shallowRef(false) // 是否处于加载中状态
  89. const topBanners = shallowRef<Model.ImageConfigsRsp[]>([]) // 轮播图列表
  90. const bodyBanners = shallowRef<Model.ImageConfigsRsp[]>([]) // 轮播图列表
  91. const newsList = shallowRef<Model.SiteColumnDetailRsp[]>([]) // 资讯列表
  92. const marketRun = shallowRef<Partial<Model.MarketRunRsp>>({}) // 市场
  93. const { dataList, getQuerySpotGoodsPriceLists } = useQuerySpotGoodsPriceLists()
  94. getQuerySpotGoodsPriceLists()
  95. // 下拉刷新
  96. const onRefresh = () => {
  97. querySiteColumnDetail({
  98. data: {
  99. page: 1,
  100. pagesize: 10,
  101. },
  102. success: (res) => {
  103. newsList.value = res.data
  104. },
  105. complete: () => {
  106. refreshing.value = false
  107. }
  108. })
  109. }
  110. queryImageConfigs({
  111. data: {
  112. imageType: 1
  113. },
  114. success: (res) => {
  115. topBanners.value = res.data
  116. }
  117. })
  118. queryImageConfigs({
  119. data: {
  120. imageType: 10
  121. },
  122. success: (res) => {
  123. bodyBanners.value = res.data
  124. }
  125. })
  126. queryMarketRun({
  127. success: (res) => {
  128. marketRun.value = res.data[0]
  129. }
  130. })
  131. onRefresh()
  132. </script>
  133. <style lang="less">
  134. @import './index.less';
  135. </style>