item.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="content">
  3. <view class="good-list">
  4. <view class="good" v-for="item in list" @click="navTo('/pagesT/unit/itemdetail?id=' + item.id)">
  5. <image :src="item.image" mode="" class="good-image"></image>
  6. <view class="good-name ">
  7. <view class="clamp">
  8. {{item.name}}
  9. </view>
  10. </view>
  11. <!-- <view class="good-key">
  12. 鸿运开来 为成功喝彩
  13. </view> -->
  14. <view class="time-wrap">
  15. <view class="time">
  16. 时间:{{item.service_time}}分钟
  17. </view>
  18. </view>
  19. <view class="good-price">
  20. <view class="price">
  21. ¥{{item.price}}
  22. </view>
  23. <view class="xl">
  24. <!-- 销量:{{item.sales}} -->
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- <view class="gq-list">
  30. <view class="gq-item" v-for="item in list" @click="navTo('/pagesT/unit/itemdetail?id=' + item.id)">
  31. <view class="gq-logo">
  32. <image :src="item.image" mode="" class=""></image>
  33. </view>
  34. <view class="info">
  35. <view class="info-tit">
  36. 名称:
  37. </view>
  38. <view class="info-val clamp">
  39. {{item.name}}
  40. </view>
  41. </view>
  42. <view class="info">
  43. <view class="info-tit">
  44. 价格:
  45. </view>
  46. <view class="info-val clamp">
  47. {{item.price}}
  48. </view>
  49. </view>
  50. <view class="info">
  51. <view class="info-tit">
  52. 服务时间:
  53. </view>
  54. <view class="info-val clamp">
  55. {{item.service_time}}分钟
  56. </view>
  57. </view>
  58. <view class="info">
  59. <view class="info-tit">
  60. 可预约:
  61. </view>
  62. <view class="info-val clamp">
  63. </view>
  64. </view>
  65. <view class="info">
  66. <view class="info-tit">
  67. 可下单:
  68. </view>
  69. <view class="info-val clamp">
  70. </view>
  71. </view>
  72. </view>
  73. </view> -->
  74. <u-loadmore :status="loadingType" />
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. list: [],
  82. type: '',
  83. page: 1,
  84. limit: 100,
  85. loadingType: 'loadmore'
  86. }
  87. },
  88. onLoad(opt) {
  89. this.getList()
  90. },
  91. onShow() {
  92. },
  93. onReachBottom() {
  94. this.getList()
  95. },
  96. onReady() {
  97. },
  98. methods: {
  99. navTo(url) {
  100. // console.log(this.hasLogin)
  101. // return
  102. if (!this.$store.state.hasLogin) {
  103. // #ifdef APP-PLUS
  104. uni.reLaunch({
  105. url: '/pagesT/public/wxLogin'
  106. });
  107. // #endif
  108. // #ifdef MP-WEIXIN
  109. uni.reLaunch({
  110. url: '/pagesT/binding/bindInfo'
  111. });
  112. //#endif
  113. // #ifdef H5
  114. uni.navigateTo({
  115. url: '/pagesT/public/wxLogin?loginType=2'
  116. });
  117. // #endif
  118. } else {
  119. uni.navigateTo({
  120. url
  121. });
  122. }
  123. },
  124. getList() {
  125. let that = this
  126. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  127. return
  128. }
  129. that.loadingType = 'loading'
  130. this.$u.api.getItemList({
  131. page: that.page,
  132. pageSize: that.limit
  133. }).then(res => {
  134. console.log(res)
  135. that.list = that.list.concat(res.data)
  136. console.log(that.list)
  137. that.page++
  138. if (res.data.length == that.limit) {
  139. that.loadingType = 'loadmore'
  140. } else {
  141. that.loadingType = 'nomore'
  142. }
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss">
  149. .gq-list {
  150. display: flex;
  151. flex-wrap: wrap;
  152. justify-content: flex-start;
  153. // justify-content: space-between;
  154. padding: 20rpx 0 20rpx 20rpx;
  155. }
  156. .gq-item {
  157. margin: 0 0 20rpx 14rpx;
  158. width: 227rpx;
  159. // height: 425rpx;
  160. background: #FFFFFF;
  161. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  162. border-radius: 10rpx;
  163. display: flex;
  164. flex-direction: column;
  165. align-items: center;
  166. justify-content: space-between;
  167. padding: 15rpx 14rpx;
  168. .gq-logo {
  169. width: 182rpx;
  170. height: 192rpx;
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. margin-bottom: 20rpx;
  175. image {
  176. width: 182rpx;
  177. height: 192rpx;
  178. background-color: #eee;
  179. }
  180. }
  181. .store-name {
  182. padding-top: 10rpx;
  183. text-align: center;
  184. width: 100%;
  185. font-size: 26rpx;
  186. font-weight: 500;
  187. color: #262261;
  188. overflow: hidden;
  189. }
  190. .info {
  191. width: 100%;
  192. display: flex;
  193. padding: 5rpx 0;
  194. .info-tit {
  195. font-size: 18rpx;
  196. flex-shrink: 0;
  197. }
  198. .info-val {
  199. flex-grow: 1;
  200. text-align: center;
  201. font-size: 20rpx;
  202. width: 140rpx;
  203. border-bottom: 1px #C7C7C7 solid;
  204. }
  205. }
  206. }
  207. .good-list {
  208. display: flex;
  209. justify-content: space-between;
  210. flex-wrap: wrap;
  211. padding: 20rpx 28rpx;
  212. .good {
  213. width: 336rpx;
  214. height: 500rpx;
  215. background: #FFFFFF;
  216. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  217. border-radius: 14rpx;
  218. margin-bottom: 20rpx;
  219. position: relative;
  220. .good-image {
  221. width: 336rpx;
  222. height: 336rpx;
  223. background-color: #eee;
  224. border-radius: 14rpx 14rpx 0 0;
  225. }
  226. .good-name {
  227. font-size: 28rpx;
  228. font-weight: bold;
  229. color: #333333;
  230. padding: 0 20rpx;
  231. }
  232. .good-key {
  233. font-size: 22rpx;
  234. font-weight: 500;
  235. color: #999999;
  236. padding-left: 20rpx
  237. }
  238. .time {
  239. padding: 5rpx 10rpx ;
  240. border: 1px solid #ff6973;
  241. color: #ff6973;
  242. display: inline-block;
  243. margin: 10rpx 0;
  244. margin-left: 20rpx;
  245. }
  246. .good-price {
  247. display: flex;
  248. width: 336rpx;
  249. justify-content: space-between;
  250. font-size: 28rpx;
  251. font-weight: bold;
  252. color: #ff6973;
  253. position: absolute;
  254. bottom: 20rpx;
  255. padding: 0 20rpx;
  256. .xl {
  257. font-size: 20rpx;
  258. font-weight: bold;
  259. color: #999999;
  260. }
  261. }
  262. }
  263. }
  264. </style>