index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="body">
  3. <view class="card" v-for="(item, index) in setMealList" :key="index" @tap="routerTo(item)">
  4. <image :src="'https://biaodianfuhao.oss-cn-beijing.aliyuncs.com/'+item.imgUrl"></image>
  5. <view class="title">
  6. {{item.name}}
  7. </view>
  8. <view class="content">
  9. {{item.title}}
  10. </view>
  11. <view class="bottomView">
  12. <view class="priceView">
  13. <view class="unit">
  14. </view>
  15. <view class="price">
  16. {{item.carPrice}}-{{item.truckPrice}}
  17. </view>
  18. </view>
  19. <view class="dprice">
  20. 已售:{{item.buyNum}}
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import SetMeal from '@/components/SetMeal';
  28. import {
  29. packageList
  30. } from "@/api/maintain.js"
  31. export default {
  32. components: {
  33. SetMeal
  34. },
  35. data: function() {
  36. return {
  37. setMealList: [],
  38. pageNo: 1,
  39. pageSize: 10,
  40. loadmore: true
  41. }
  42. },
  43. onLoad() {
  44. this.packageList();
  45. },
  46. onReachBottom() {
  47. if (this.loadmore) {
  48. this.packageList();
  49. }
  50. },
  51. methods: {
  52. // 路由跳转
  53. routerTo(item) {
  54. this.$yrouter.push({
  55. path: "/pages/maintenance/setMeal/setMealDetail/index?item=" + JSON.stringify(item)
  56. });
  57. },
  58. packageList() {
  59. packageList({
  60. pageNo: this.pageNo,
  61. pageSize: this.pageSize,
  62. }).then((res) => {
  63. this.setMealList = [...this.setMealList,...res.data.rows];
  64. if (this.setMealList.length < this.pageSize) {
  65. this.loadmore = false
  66. }
  67. this.pageNo++
  68. })
  69. },
  70. }
  71. }
  72. </script>
  73. <style>
  74. page{
  75. background-color: #EDEDED;
  76. }
  77. </style>
  78. <style lang="less" scoped>
  79. .body {
  80. display: flex;
  81. flex-wrap: wrap;
  82. justify-content: space-between;
  83. padding-top: 20rpx;
  84. padding-bottom: 30rpx;
  85. padding-left: 20rpx;
  86. padding-right: 20rpx;
  87. background-color: #EDEDED;
  88. .card {
  89. width: 344rpx;
  90. height: 532rpx;
  91. background: #FFFFFF;
  92. border: 1px solid #E5E5E5;
  93. box-shadow: 0px 0px 14rpx 0px rgba(125, 125, 125, 0.13);
  94. border-radius: 10rpx;
  95. margin-top: 18rpx;
  96. position: relative;
  97. image {
  98. width: 344rpx;
  99. height: 344rpx;
  100. box-shadow: 0px 0px 14rpx 0px rgba(125, 125, 125, 0.13);
  101. border-radius: 10rpx;
  102. }
  103. .title {
  104. height: 27rpx;
  105. font-size: 28rpx;
  106. font-family: PingFang SC;
  107. font-weight: bold;
  108. color: #333333;
  109. line-height: 39rpx;
  110. padding: 15rpx 0 0 20rpx;
  111. }
  112. .content {
  113. font-size: 22rpx;
  114. font-family: PingFang SC;
  115. font-weight: 500;
  116. color: #666666;
  117. line-height: 28rpx;
  118. padding: 16rpx 20rpx 0 20rpx;
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. display: -webkit-box;
  122. -webkit-line-clamp: 2;
  123. line-clamp: 2;
  124. -webkit-box-orient: vertical;
  125. }
  126. .bottomView {
  127. width: calc(100% - 34rpx);
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. padding: 0rpx 17rpx 0 17rpx;
  132. position: absolute;
  133. bottom: 10rpx;
  134. .priceView {
  135. display: flex;
  136. align-items: baseline;
  137. .unit {
  138. font-size: 20rpx;
  139. font-family: PingFang SC;
  140. font-weight: bold;
  141. color: #FF3C00;
  142. }
  143. .price {
  144. font-size: 32rpx;
  145. font-family: PingFang SC;
  146. font-weight: bold;
  147. color: #FF3C00;
  148. }
  149. }
  150. .dprice {
  151. font-size: 24rpx;
  152. font-family: PingFang SC;
  153. font-weight: 500;
  154. color: #999999;
  155. }
  156. }
  157. }
  158. }
  159. </style>