list.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="content">
  3. <view class="good-list">
  4. <view class="good" v-for="item in list" @click="navTo('/pages/goods_details/index?id=' + item.product.id)">
  5. <image :src="item.slider_image" mode="" class="good-image"></image>
  6. <view class="good-name ">
  7. <view class="clamp">
  8. {{item.store_name}}
  9. </view>
  10. </view>
  11. <view class="time-wrap">
  12. <view class="time">
  13. 时间:{{item.product.unit_name}}
  14. </view>
  15. </view>
  16. <view class="good-price">
  17. <view class="price">
  18. ¥{{item.product.price}}
  19. </view>
  20. <view class="xl">
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <u-loadmore :status="loadingType" />
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. getServeItem
  31. } from "@/api/store.js"
  32. export default {
  33. data() {
  34. return {
  35. list: [],
  36. type: 0,
  37. page: 1,
  38. limit: 100,
  39. loadingType: 'loadmore'
  40. }
  41. },
  42. onLoad(opt) {
  43. if (opt.type) {
  44. this.type = opt.type
  45. }
  46. this.getList()
  47. },
  48. onShow() {
  49. },
  50. onReachBottom() {
  51. // this.getList()
  52. },
  53. onReady() {
  54. },
  55. methods: {
  56. navTo(url) {
  57. uni.navigateTo({
  58. url
  59. });
  60. },
  61. getList() {
  62. let that = this;
  63. let getList;
  64. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  65. return
  66. }
  67. that.loadingType = 'loading'
  68. if (that.type == 0) {
  69. getList = getServeItem
  70. }
  71. getList({
  72. page: that.page,
  73. pageSize: that.limit,
  74. service_card_id: 0
  75. }).then(res => {
  76. console.log(res)
  77. let arr = res.data.list
  78. that.list = that.list.concat(arr)
  79. console.log(that.list)
  80. that.page++
  81. if (arr.length == that.limit) {
  82. that.loadingType = 'loadmore'
  83. } else {
  84. that.loadingType = 'nomore'
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. .gq-list {
  93. display: flex;
  94. flex-wrap: wrap;
  95. justify-content: flex-start;
  96. // justify-content: space-between;
  97. padding: 20rpx 0 20rpx 20rpx;
  98. }
  99. .gq-item {
  100. margin: 0 0 20rpx 14rpx;
  101. width: 227rpx;
  102. // height: 425rpx;
  103. background: #FFFFFF;
  104. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  105. border-radius: 10rpx;
  106. display: flex;
  107. flex-direction: column;
  108. align-items: center;
  109. justify-content: space-between;
  110. padding: 15rpx 14rpx;
  111. .gq-logo {
  112. width: 182rpx;
  113. height: 192rpx;
  114. display: flex;
  115. justify-content: center;
  116. align-items: center;
  117. margin-bottom: 20rpx;
  118. image {
  119. width: 182rpx;
  120. height: 192rpx;
  121. background-color: #eee;
  122. }
  123. }
  124. .store-name {
  125. padding-top: 10rpx;
  126. text-align: center;
  127. width: 100%;
  128. font-size: 26rpx;
  129. font-weight: 500;
  130. color: #262261;
  131. overflow: hidden;
  132. }
  133. .info {
  134. width: 100%;
  135. display: flex;
  136. padding: 5rpx 0;
  137. .info-tit {
  138. font-size: 18rpx;
  139. flex-shrink: 0;
  140. }
  141. .info-val {
  142. flex-grow: 1;
  143. text-align: center;
  144. font-size: 20rpx;
  145. width: 140rpx;
  146. border-bottom: 1px #C7C7C7 solid;
  147. }
  148. }
  149. }
  150. .good-list {
  151. display: flex;
  152. justify-content: space-between;
  153. flex-wrap: wrap;
  154. padding: 20rpx 28rpx;
  155. .good {
  156. width: 336rpx;
  157. height: 500rpx;
  158. background: #FFFFFF;
  159. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  160. border-radius: 14rpx;
  161. margin-bottom: 20rpx;
  162. position: relative;
  163. .good-image {
  164. width: 336rpx;
  165. height: 336rpx;
  166. background-color: #eee;
  167. border-radius: 14rpx 14rpx 0 0;
  168. }
  169. .good-name {
  170. font-size: 28rpx;
  171. font-weight: bold;
  172. color: #333333;
  173. padding: 0 20rpx;
  174. }
  175. .good-key {
  176. font-size: 22rpx;
  177. font-weight: 500;
  178. color: #999999;
  179. padding-left: 20rpx
  180. }
  181. .time {
  182. padding: 5rpx 10rpx;
  183. border: 1px solid #ff6973;
  184. color: #ff6973;
  185. display: inline-block;
  186. margin: 10rpx 0;
  187. margin-left: 20rpx;
  188. }
  189. .good-price {
  190. display: flex;
  191. width: 336rpx;
  192. justify-content: space-between;
  193. font-size: 28rpx;
  194. font-weight: bold;
  195. color: #ff6973;
  196. position: absolute;
  197. bottom: 20rpx;
  198. padding: 0 20rpx;
  199. .xl {
  200. font-size: 20rpx;
  201. font-weight: bold;
  202. color: #999999;
  203. }
  204. }
  205. }
  206. }
  207. </style>