oneMarket.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view>
  3. <navigation-bar title="一级市场" background-color="#fff" front-color="#000000" />
  4. <u-list class="list" width="100%" @scrolltolower="scrolltolower">
  5. <u-list-item v-for="(item, index) in goods" :key="index">
  6. <view class="card" @click="toDetails(item.id)">
  7. <view class="card-body">
  8. <image
  9. src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
  10. mode="aspectFill" class="img"></image>
  11. <view class="txt">
  12. <view style="font-size: 30rpx;height: 140rpx;">{{item.goodsName}}</view>
  13. <view class="piece">{{item.price}} 元</view>
  14. </view>
  15. </view>
  16. </view>
  17. </u-list-item>
  18. <u-loadmore v-if="goods" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore" margin-bottom="50" />
  19. </u-list>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. loadmoreStatus: 'loadmore',
  27. goods: []
  28. }
  29. },
  30. onLoad() {
  31. this.getGoodsList()
  32. // this.loadmore()
  33. },
  34. methods: {
  35. getGoodsList() {
  36. // let params = {
  37. // goodsType: 1
  38. // }
  39. this.$api.getGoodsList().then(res => {
  40. this.goods = res.data
  41. this.goods.forEach((item, index) => {
  42. if (index === this.goods.length - 1) {
  43. this.loadmoreStatus = 'nomore'
  44. } else {
  45. this.loadmoreStatus = 'loadmore'
  46. }
  47. })
  48. })
  49. },
  50. scrolltolower() {
  51. this.getGoodsList()
  52. },
  53. // loadmore() {
  54. // if (this.loadmoreStatus === 'loadmore') {
  55. // this.pageNo++;
  56. // this.loadmoreStatus = 'loading'
  57. // }
  58. // }
  59. toDetails(id) {
  60. this.$common.to('/pages/goodsDetails/goodsDetails?id='+id)
  61. }
  62. }
  63. }
  64. </script>
  65. <style>
  66. .list {
  67. height: 100%;
  68. border-radius: 10rpx;
  69. background-color: #fff;
  70. }
  71. .card {
  72. padding: 10rpx;
  73. }
  74. .card-body {
  75. display: flex;
  76. height: 300rpx;
  77. width: 100%;
  78. /* border: #888 1rpx solid; */
  79. box-shadow: 1rpx 1rpx #888;
  80. border-radius: 10rpx;
  81. }
  82. .img {
  83. height: 300rpx;
  84. width: 300rpx;
  85. margin-right: 10rpx;
  86. }
  87. .txt {
  88. padding: 10rpx;
  89. width: 300rpx;
  90. }
  91. .piece {
  92. margin: 50rpx 10rpx;
  93. color: red;
  94. position: relative;
  95. top: 50rpx;
  96. /* left: 5rpx; */
  97. }
  98. </style>