shopList.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="main">
  3. <view class="list-box-h">
  4. <view v-for="(item, index) in dataList" :key="index" class="guess-item" @click="navToDetailPage(item)">
  5. <image :src="item.image"></image>
  6. <view class="guess-box">
  7. <view class="title clamp2">{{ item.store_name }}</view>
  8. <view class="price-box flex">
  9. <view class="yuanprice">{{ item.ot_price }}</view>
  10. <image src="../../static/img/jiantou.png" mode=""></image>
  11. <view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view>
  12. </view>
  13. <view class="price">¥{{ item.price }}</view>
  14. <view class="btn">立即购买</view>
  15. </view>
  16. </view>
  17. </view>
  18. <uni-load-more :status="loadingType"></uni-load-more>
  19. </view>
  20. </template>
  21. <script>
  22. import { getProducts } from '@/api/product.js';
  23. export default {
  24. data() {
  25. return {
  26. list: [],
  27. page: 1,
  28. limit: 10,
  29. loadingType: 'more',
  30. cid: 0,
  31. vip:0
  32. }
  33. },
  34. onLoad(opt) {
  35. this.cid = opt.cid||''
  36. this.tit = decodeURI(opt.tit)
  37. uni.setNavigationBarTitle({
  38. title: this.tit
  39. })
  40. this.vip = +opt.vip||0
  41. this.getArticleList()
  42. },
  43. methods: {
  44. navto(url) {
  45. uni.navigateTo({
  46. url: url
  47. })
  48. },
  49. getArticleList() {
  50. let obj = this
  51. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  52. return
  53. }
  54. obj.loadingType = 'loading'
  55. getProducts({
  56. page: obj.page,
  57. limit: obj.limit,
  58. can_up_level:this.vip//设置是否vip商品
  59. },obj.cid).then(({data}) => {
  60. obj.list = obj.list.concat(data)
  61. obj.page++
  62. if(data.length == obj.limit) {
  63. obj.loadingType = 'more'
  64. }else {
  65. obj.loadingType = 'noMore'
  66. }
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. page {
  74. background-color: #fff;
  75. min-height: 100%;
  76. }
  77. .main {
  78. margin-top: 40rpx;
  79. padding: 0 40rpx;
  80. .main-t-t {
  81. // width: 100;
  82. display: flex;
  83. justify-content: center;
  84. .main-t-t-i {
  85. width: 376rpx;
  86. height: 34rpx;
  87. margin: auto;
  88. }
  89. }
  90. .main-top {
  91. align-items: center;
  92. .main-left {
  93. display: flex;
  94. justify-content: flex-start;
  95. align-items: center;
  96. .shu {
  97. width: 8rpx;
  98. height: 38rpx;
  99. background: #05ab81;
  100. border-radius: 4rpx;
  101. }
  102. .main-title {
  103. margin-left: 10rpx;
  104. font-size: 36rpx;
  105. font-family: PingFang SC;
  106. font-weight: bold;
  107. color: #202739;
  108. }
  109. .main-tip {
  110. font-size: 22rpx;
  111. font-family: PingFang SC;
  112. font-weight: bold;
  113. color: #95a0b1;
  114. margin-left: 14rpx;
  115. }
  116. }
  117. }
  118. }
  119. </style>