酒店桌布为微信小程序
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.

177 lines
3.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 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. .page{
  100. /deep/ .uv-vtabs{
  101. height: calc(100vh - 360rpx) !important;
  102. }
  103. /deep/ .uv-vtabs__bar{
  104. height: calc(100vh - 360rpx) !important;
  105. }
  106. /deep/ .uv-vtabs__content{
  107. height: calc(100vh - 360rpx) !important;
  108. }
  109. }
  110. .category {
  111. font-size: 30rpx;
  112. color: #333;
  113. .category-title{
  114. position: relative;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. height: 120rpx;
  119. &::before,
  120. &::after {
  121. position: absolute;
  122. top: 50%;
  123. content: '';
  124. width: 10%;
  125. border-top: 2rpx solid black;
  126. }
  127. &::before {
  128. left: 25%;
  129. }
  130. &::after {
  131. right: 25%;
  132. }
  133. }
  134. .list{
  135. display: flex;
  136. flex-wrap: wrap;
  137. margin: 0 auto;
  138. width: 490rpx;
  139. .item {
  140. padding: 10rpx 20rpx;
  141. display: flex;
  142. flex-direction: column;
  143. justify-content: center;
  144. align-items: center;
  145. margin-bottom: 20rpx;
  146. .item-image {
  147. width: 120rpx;
  148. height: 120rpx;
  149. image{
  150. height: 100%;
  151. width: 100%;
  152. border-radius: 50%;
  153. }
  154. }
  155. .item-unit {
  156. font-size: 24rpx;
  157. margin-top: 15rpx;
  158. color: #555;
  159. }
  160. }
  161. .gap {
  162. padding: 0 30rpx;
  163. }
  164. }
  165. }
  166. </style>