group-buy.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="list group-buy">
  3. <div class="content">
  4. <div class="list-banner">
  5. <img src="~/assets/images/group-banner.jpg" alt />
  6. </div>
  7. <div class="goods-list group-list">
  8. <ProdItem :pale-list="teamBuyingList" :list-type="1" />
  9. <!-- 页码 -->
  10. <!-- <div class="pagination">
  11. <div class="pages" v-if="page.pages >= 1">
  12. <a
  13. href="javascript:void(0);"
  14. class="item prev"
  15. :class="{default: page.current <= 1}"
  16. @click="getTeamBuyingList(page.current -1)"
  17. >上一页</a>
  18. <div v-for="(item,index) in page.rainbow" :key="index">
  19. <a
  20. href="javascript:void(0);"
  21. @click="getTeamBuyingList(item)"
  22. class="item"
  23. :class="{cur: page.current === item}"
  24. v-if="item !== '...'"
  25. >{{item}}</a>
  26. <span class="ellipsis" v-else>...</span>
  27. </div>
  28. <a
  29. href="javascript:void(0);"
  30. class="item next"
  31. :class="{default: page.current > page.pages - 1}"
  32. @click="getTeamBuyingList(page.current +1)"
  33. >下一页</a>
  34. <div class="go-page">
  35. 到第
  36. <input type="text" class="page-input" />页
  37. <a href class="page-btn">GO</a>
  38. </div>
  39. <div class="total-num">
  40. <span class="num">{{page.pages}}</span>条
  41. </div>
  42. </div>
  43. </div>-->
  44. <!-- /页码 -->
  45. <!-- 页码 -->
  46. <pagination v-model="current" :pages="pages" @changePage="getTeamBuyingList"></pagination>
  47. <!-- /页码 -->
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script src='~/assets/js/load-transition'></script>
  53. <script>
  54. import ProdItem from '~/components/prod-item'
  55. import PageUtil from '~/plugins/pageUtil'
  56. import CategroySidebar from '~/components/categroy-sidebar'
  57. import Pagination from '~/components/pagination'
  58. export default {
  59. components: {
  60. ProdItem,
  61. Pagination
  62. },
  63. data () {
  64. return {
  65. teamBuyingList: [], //团购列表
  66. total: 0, // 总条
  67. pages: 0, // 总页数
  68. current: this.$route.query.current || 1, // 当前页数
  69. size: 12, // 每页显示多少条
  70. }
  71. },
  72. mounted () {
  73. // 设置网页标题
  74. document.title = this.$t('commonHead.groupDiscount')
  75. this.getTeamBuyingList(this.current) //团购列表
  76. },
  77. methods: {
  78. /**
  79. * 请求团购列表
  80. */
  81. getTeamBuyingList (current) {
  82. // this.$axios.get('/groupProd/page', {
  83. this.$axios.get('/search/page', {
  84. params: {
  85. current: current,
  86. size: 12,
  87. prodType: 1,
  88. isActive: 1 // 过滤掉活动商品
  89. }
  90. })
  91. .then((({ data }) => {
  92. this.teamBuyingList = data.records[0].products
  93. this.pages = data.pages
  94. // data.rainbow = PageUtil.rainbowWithDot(data.current, data.pages, 5)
  95. // this.page = data
  96. }))
  97. },
  98. /**
  99. * 分页
  100. */
  101. // changePage(value) {
  102. // this.current = value
  103. // this.getTeamBuyingList()
  104. // },
  105. },
  106. }
  107. </script>
  108. <style scoped src='~/assets/css/list.css'></style>