item.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="content">
  3. <view class="gq-list">
  4. <view class="gq-item" v-for="item in list" @click="navTo('/pagesT/unit/itemdetail?id=' + item.id)">
  5. <view class="gq-logo">
  6. <image :src="item.image" mode="" class=""></image>
  7. </view>
  8. <view class="info">
  9. <view class="info-tit">
  10. 名称:
  11. </view>
  12. <view class="info-val clamp">
  13. {{item.name}}
  14. </view>
  15. </view>
  16. <view class="info">
  17. <view class="info-tit">
  18. 价格:
  19. </view>
  20. <view class="info-val clamp">
  21. {{item.price}}
  22. </view>
  23. </view>
  24. <view class="info">
  25. <view class="info-tit">
  26. 服务时间:
  27. </view>
  28. <view class="info-val clamp">
  29. {{item.service_time}}分钟
  30. </view>
  31. </view>
  32. <view class="info">
  33. <view class="info-tit">
  34. 可预约:
  35. </view>
  36. <view class="info-val clamp">
  37. </view>
  38. </view>
  39. <view class="info">
  40. <view class="info-tit">
  41. 可下单:
  42. </view>
  43. <view class="info-val clamp">
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <u-loadmore :status="loadingType" />
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. list: [],
  56. type: '',
  57. page: 1,
  58. limit: 12,
  59. loadingType: 'loadmore'
  60. }
  61. },
  62. onLoad(opt) {
  63. this.getList()
  64. },
  65. onShow() {
  66. },
  67. onReachBottom() {
  68. this.getList()
  69. },
  70. onReady() {
  71. },
  72. methods: {
  73. navTo(url) {
  74. // console.log(this.hasLogin)
  75. // return
  76. if (!this.$store.state.hasLogin) {
  77. // #ifdef APP-PLUS
  78. uni.reLaunch({
  79. url: '/pagesT/public/wxLogin'
  80. });
  81. // #endif
  82. // #ifdef MP-WEIXIN
  83. uni.reLaunch({
  84. url: '/pagesT/binding/bindInfo'
  85. });
  86. //#endif
  87. // #ifdef H5
  88. uni.navigateTo({
  89. url: '/pagesT/public/wxLogin?loginType=2'
  90. });
  91. // #endif
  92. } else {
  93. uni.navigateTo({
  94. url
  95. });
  96. }
  97. },
  98. getList() {
  99. let that = this
  100. if (that.loadingType == 'loading') {
  101. return
  102. }
  103. that.loadingType = 'loading'
  104. this.$u.api.getItemList({
  105. page: that.page,
  106. pageSize: that.limit
  107. }).then(res => {
  108. console.log(res)
  109. that.list = that.list.concat(res.data)
  110. console.log(that.list)
  111. that.page++
  112. if(res.data.length == that.limit) {
  113. that.loadingType = 'loadmore'
  114. }else {
  115. that.loadingType = 'nomore'
  116. }
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .gq-list {
  124. display: flex;
  125. flex-wrap: wrap;
  126. justify-content: flex-start;
  127. // justify-content: space-between;
  128. padding: 20rpx 0 20rpx 20rpx;
  129. }
  130. .gq-item {
  131. margin: 0 0 20rpx 14rpx;
  132. width: 227rpx;
  133. // height: 425rpx;
  134. background: #FFFFFF;
  135. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  136. border-radius: 10rpx;
  137. display: flex;
  138. flex-direction: column;
  139. align-items: center;
  140. justify-content: space-between;
  141. padding: 15rpx 14rpx;
  142. .gq-logo {
  143. width: 182rpx;
  144. height: 192rpx;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. margin-bottom: 20rpx;
  149. image {
  150. width: 182rpx;
  151. height: 192rpx;
  152. background-color: #eee;
  153. }
  154. }
  155. .store-name {
  156. padding-top: 10rpx;
  157. text-align: center;
  158. width: 100%;
  159. font-size: 26rpx;
  160. font-weight: 500;
  161. color: #262261;
  162. overflow: hidden;
  163. }
  164. .info {
  165. width: 100%;
  166. display: flex;
  167. padding: 5rpx 0;
  168. .info-tit {
  169. font-size: 18rpx;
  170. flex-shrink: 0;
  171. }
  172. .info-val {
  173. flex-grow: 1;
  174. text-align: center;
  175. font-size: 20rpx;
  176. width: 140rpx;
  177. border-bottom: 1px #C7C7C7 solid;
  178. }
  179. }
  180. }
  181. </style>