酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
2.9 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="page">
  3. <navbar/>
  4. <view class="category">
  5. <uv-vtabs
  6. :chain="chain"
  7. :list="category"
  8. :barItemBadgeStyle="{right:'20px',top:'12px'}"
  9. @change="change">
  10. <uv-vtabs-item>
  11. <view class="category-title">
  12. 租赁
  13. </view>
  14. <view class="list">
  15. <view class="item" v-for="(item,index) in productList" :key="index"
  16. @click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)">
  17. <view class="item-image">
  18. <image
  19. :src="item.pic"
  20. mode="aspectFill"></image>
  21. </view>
  22. <view class="item-unit">
  23. <text class="text">{{item.name}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </uv-vtabs-item>
  28. </uv-vtabs>
  29. </view>
  30. <tabber select="1" />
  31. </view>
  32. </template>
  33. <script>
  34. import tabber from '@/components/base/tabbar.vue'
  35. export default {
  36. components: {
  37. tabber,
  38. },
  39. data() {
  40. return {
  41. category: [],
  42. queryParams: {
  43. pageNo: 1,
  44. pageSize: 10,
  45. },
  46. list : {
  47. records : [],
  48. total : 0,
  49. },
  50. chain: false,
  51. categoryIndex: 0
  52. }
  53. },
  54. computed: {
  55. productList(){
  56. return this.category.length ? this.category[this.categoryIndex].hotelGoodsList || [] : []
  57. }
  58. },
  59. onShow() {
  60. this.categoryList()
  61. },
  62. //滚动到屏幕底部
  63. onReachBottom() {
  64. if(this.queryParams.pageSize < this.list.total){
  65. this.queryParams.pageSize += 10
  66. this.getGoodsPage()
  67. }
  68. },
  69. onReady() {
  70. },
  71. methods: {
  72. categoryList(){
  73. this.$api('categoryList', res => {
  74. if(res.code == 200){
  75. this.category = res.result
  76. this.getGoodsPage()
  77. }
  78. })
  79. },
  80. getGoodsPage(){
  81. this.$api('goodsPage', {
  82. ...this.queryParams,
  83. categoryId : this.category[this.categoryIndex].id
  84. }, res => {
  85. if(res.code == 200){
  86. this.list = res.result
  87. }
  88. })
  89. },
  90. change(index) {
  91. this.categoryIndex = index;
  92. // this.queryParams.pageSize = 10
  93. // this.getGoodsPage()
  94. },
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .category {
  100. font-size: 30rpx;
  101. color: #333;
  102. .category-title{
  103. position: relative;
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. height: 120rpx;
  108. &::before,
  109. &::after {
  110. position: absolute;
  111. top: 50%;
  112. content: '';
  113. width: 10%;
  114. border-top: 2rpx solid black;
  115. }
  116. &::before {
  117. left: 25%;
  118. }
  119. &::after {
  120. right: 25%;
  121. }
  122. }
  123. .list{
  124. display: flex;
  125. flex-wrap: wrap;
  126. margin: 0 auto;
  127. width: 490rpx;
  128. .item {
  129. padding: 10rpx 20rpx;
  130. display: flex;
  131. flex-direction: column;
  132. justify-content: center;
  133. align-items: center;
  134. margin-bottom: 20rpx;
  135. .item-image {
  136. width: 120rpx;
  137. height: 120rpx;
  138. image{
  139. height: 100%;
  140. width: 100%;
  141. border-radius: 50%;
  142. }
  143. }
  144. .item-unit {
  145. font-size: 24rpx;
  146. margin-top: 15rpx;
  147. color: #555;
  148. }
  149. }
  150. .gap {
  151. padding: 0 30rpx;
  152. }
  153. }
  154. }
  155. </style>