shopList.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. }
  32. },
  33. onLoad(opt) {
  34. this.cid = opt.cid
  35. this.tit = decodeURI(opt.tit)
  36. uni.setNavigationBarTitle({
  37. title: this.tit
  38. })
  39. this.getArticleList()
  40. },
  41. methods: {
  42. navto(url) {
  43. uni.navigateTo({
  44. url: url
  45. })
  46. },
  47. getArticleList() {
  48. let obj = this
  49. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  50. return
  51. }
  52. obj.loadingType = 'loading'
  53. getProducts({
  54. page: obj.page,
  55. limit: obj.limit,
  56. can_up_level:1//设置是否vip商品
  57. },obj.cid).then(({data}) => {
  58. obj.list = obj.list.concat(data)
  59. obj.page++
  60. if(data.length == obj.limit) {
  61. obj.loadingType = 'more'
  62. }else {
  63. obj.loadingType = 'noMore'
  64. }
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. page {
  72. background-color: #fff;
  73. min-height: 100%;
  74. }
  75. .main {
  76. margin-top: 40rpx;
  77. padding: 0 40rpx;
  78. .main-t-t {
  79. // width: 100;
  80. display: flex;
  81. justify-content: center;
  82. .main-t-t-i {
  83. width: 376rpx;
  84. height: 34rpx;
  85. margin: auto;
  86. }
  87. }
  88. .main-top {
  89. align-items: center;
  90. .main-left {
  91. display: flex;
  92. justify-content: flex-start;
  93. align-items: center;
  94. .shu {
  95. width: 8rpx;
  96. height: 38rpx;
  97. background: #05ab81;
  98. border-radius: 4rpx;
  99. }
  100. .main-title {
  101. margin-left: 10rpx;
  102. font-size: 36rpx;
  103. font-family: PingFang SC;
  104. font-weight: bold;
  105. color: #202739;
  106. }
  107. .main-tip {
  108. font-size: 22rpx;
  109. font-family: PingFang SC;
  110. font-weight: bold;
  111. color: #95a0b1;
  112. margin-left: 14rpx;
  113. }
  114. }
  115. }
  116. }
  117. </style>