collectList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="app-page">
  3. <view class="activity-box">
  4. <view class="activity-list" v-for="(item, index) in mList" :key="index" @click="toDetails(item)">
  5. <image style="width: 100%; height: 344rpx; border-radius: 20rpx 20rpx 0 0" :src="item.cover"
  6. mode="aspectFill">
  7. </image>
  8. <view class="list-content text-overflow2">
  9. <view class="text-overflow-single mb10">{{item.goods_name}}</view>
  10. <view class="display-flex-between">
  11. <text class="fs13 fw600 color-red">¥{{item.price_selling}}</text>
  12. <text class="text-through fs12 color-ca">¥{{item.price_market}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view style="width: 100%">
  17. <!-- <u-loadmore :status="status" @loadmore="loadmoreClick" :load-text="loadText" /> -->
  18. </view>
  19. </view>
  20. <!-- <CommercePart :data="mList"></CommercePart> -->
  21. </view>
  22. </template>
  23. <script>
  24. import Empty from "@/components/Empty/index.vue"
  25. import CommercePart from '@/components/CommercePart'
  26. import { getcollectList } from "@/common/api/good.js";
  27. export default {
  28. components: {
  29. Empty,
  30. CommercePart
  31. },
  32. data() {
  33. return {
  34. topData: {
  35. top: 0,
  36. height: 0
  37. },
  38. pageParams: {
  39. page: 1,
  40. pageSize: 8
  41. },
  42. total: 0,
  43. mList: []
  44. }
  45. },
  46. computed: {},
  47. onLoad(options) {
  48. this.getList(true)
  49. },
  50. onReachBottom() {
  51. this.getList()
  52. },
  53. methods: {
  54. toBack() {
  55. uni.navigateBack()
  56. },
  57. toDetails(item) {
  58. uni.navigateTo({
  59. url: `/subPages/goodsDetail/goodsDetail?code=${item.code}&type=common`
  60. })
  61. },
  62. getList(initFlag) {
  63. if (!initFlag) {
  64. if (this.pageParams.page * this.pageParams.pageSize < this.total) {
  65. this.pageParams.page++
  66. } else {
  67. return
  68. }
  69. } else {
  70. this.pageParams.page = 1
  71. this.total = 0
  72. this.mList = []
  73. }
  74. let sendData = {
  75. ...this.pageParams
  76. }
  77. getcollectList()
  78. .then((res) => {
  79. let list = res.data.list.map(item => {
  80. return item.goods
  81. })
  82. this.mList = this.mList.concat(list)
  83. this.total = res.data.page.total
  84. })
  85. },
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .app-page {
  91. width: 100%;
  92. height: 100vh;
  93. // background-color: #fff;
  94. // align-items: center;
  95. // flex-direction: column;
  96. box-sizing: border-box;
  97. padding: 40rpx;
  98. // box-sizing: border-box;
  99. .activity-box {
  100. display: flex;
  101. flex-wrap: wrap;
  102. justify-content: space-between;
  103. .activity-list {
  104. width: calc(50% - 11rpx);
  105. background-color: #fff;
  106. border-radius: 20rpx;
  107. margin-bottom: 22rpx;
  108. padding-bottom: 30rpx;
  109. font-size: 24rpx;
  110. .list-title {
  111. font-size: 30rpx;
  112. padding: 0 16rpx 8rpx;
  113. }
  114. .list-content {
  115. color: #2c2c2c;
  116. padding: 10rpx 16rpx 0;
  117. // display: flex;
  118. }
  119. }
  120. }
  121. }
  122. </style>