shopList.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 { article } from '@/api/user.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. article({
  54. page: obj.page,
  55. limit: obj.limit
  56. },obj.cid).then(({data}) => {
  57. obj.list = obj.list.concat(data)
  58. obj.page++
  59. if(data.length == obj.limit) {
  60. obj.loadingType = 'more'
  61. }else {
  62. obj.loadingType = 'noMore'
  63. }
  64. })
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. page {
  71. background-color: #fff;
  72. min-height: 100%;
  73. }
  74. .main {
  75. margin-top: 40rpx;
  76. padding: 0 40rpx;
  77. .main-t-t {
  78. // width: 100;
  79. display: flex;
  80. justify-content: center;
  81. .main-t-t-i {
  82. width: 376rpx;
  83. height: 34rpx;
  84. margin: auto;
  85. }
  86. }
  87. .main-top {
  88. align-items: center;
  89. .main-left {
  90. display: flex;
  91. justify-content: flex-start;
  92. align-items: center;
  93. .shu {
  94. width: 8rpx;
  95. height: 38rpx;
  96. background: #05ab81;
  97. border-radius: 4rpx;
  98. }
  99. .main-title {
  100. margin-left: 10rpx;
  101. font-size: 36rpx;
  102. font-family: PingFang SC;
  103. font-weight: bold;
  104. color: #202739;
  105. }
  106. .main-tip {
  107. font-size: 22rpx;
  108. font-family: PingFang SC;
  109. font-weight: bold;
  110. color: #95a0b1;
  111. margin-left: 14rpx;
  112. }
  113. }
  114. }
  115. }
  116. </style>