all_serve.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="contain">
  3. <view class="contain_lf">
  4. <scroll-view scroll-y style="height:100%;">
  5. <view v-for="item,index in allData.category":key="index" :class="['all_class_item',active === index?'active':'']"
  6. :data-index="index"
  7. :data-value="item"
  8. :data-id="item.id"
  9. @tap="changeActive">
  10. {{item}}
  11. <view class="line"></view>
  12. </view>
  13. </scroll-view>
  14. </view>
  15. <view class="contain_rh">
  16. <scroll-view scroll-y="true" style="height:100%;" scroll-with-animation="true">
  17. <view v-for="item,index in allData.contain_rh_item_list" :key="index" class="contain_rh_item" :id="item.id">
  18. <view class="contain_rh_item_top">
  19. <view class="contain_rh_item_top_lf">{{item.title}}</view>
  20. </view>
  21. <view class="contain_rh_item_bottom">
  22. <view v-for="item,index in item.arr" :key="index" class="bottom_item">{{item.title}}</view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. let app = getApp();
  31. import api from "../../../../../api.js";
  32. export default {
  33. data() {
  34. return {
  35. fName:'全部',
  36. storeId:1757,//商家id
  37. allData:null,//所有数据
  38. active: 0,//左侧导航栏指示
  39. }
  40. },
  41. mounted() {
  42. this.getData();
  43. },
  44. methods: {
  45. //加载数据
  46. getData(){
  47. let data = {
  48. fName:this.fName,
  49. storeId:this.storeId,
  50. }
  51. api.getShopMessage(data).then((res)=>{
  52. console.log(res);
  53. this.allData = res.data.data;
  54. })
  55. },
  56. //导航栏点击切换查询数据
  57. changeActive(e){
  58. let value = e.currentTarget.dataset.value;
  59. let index = e.currentTarget.dataset.index;
  60. this.active = index;
  61. this.fName = value;
  62. this.getData();
  63. },
  64. }
  65. }
  66. </script>
  67. <style>
  68. page{
  69. width:100%;
  70. height:100%;
  71. }
  72. .contain{
  73. width:100%;
  74. height:100%;
  75. padding-top:30rpx;
  76. box-sizing: border-box;
  77. overflow: hidden;
  78. border-top:1px solid #f2f2f2;
  79. }
  80. .contain_lf{
  81. width:180rpx;
  82. height:100%;
  83. float:left;
  84. background-color: #F3F3F3;
  85. }
  86. .all_class_item{
  87. height:102rpx;
  88. line-height: 102rpx;
  89. text-align: center;
  90. color:#999999;
  91. font-size: 30rpx;
  92. position: relative;
  93. }
  94. .line{
  95. width:6rpx;
  96. height:50rpx;
  97. background-color: #E77817;
  98. position: absolute;
  99. top:28rpx;
  100. left:0;
  101. display: none;
  102. }
  103. .active{
  104. color:#000000;
  105. font-weight: bold;
  106. background-color: #ffffff;
  107. }
  108. .active .line{
  109. display: block;
  110. }
  111. .contain_rh{
  112. width:calc(100% - 180rpx);
  113. height:100%;
  114. padding: 0 32rpx 0 30rpx;
  115. box-sizing: border-box;
  116. overflow: hidden;
  117. float:left;
  118. }
  119. .contain_rh_item_top{
  120. width:100%;
  121. height:72rpx;
  122. line-height: 72rpx;
  123. }
  124. .contain_rh_item_top_lf{
  125. color:#000000;
  126. font-size: 26rpx;
  127. font-weight: bold;
  128. float:left;
  129. }
  130. .contain_rh_item_top_rg{
  131. color:#999999;
  132. font-size: 24rpx;
  133. float:right;
  134. }
  135. .contain_rh_item{
  136. margin-bottom:22rpx;
  137. }
  138. .shuang_you{
  139. display: inline-block;
  140. font-size: 24rpx;
  141. color:#999999;
  142. }
  143. .contain_rh_item_bottom{
  144. width:100%;
  145. overflow: hidden;
  146. }
  147. .bottom_item{
  148. width:152rpx;
  149. height:68rpx;
  150. background:rgba(247,247,247,1);
  151. border-radius:6rpx;
  152. text-align: center;
  153. line-height: 68rpx;
  154. font-size: 24rpx;
  155. color:#777777;
  156. float:left;
  157. margin:0 26rpx 26rpx 0;
  158. overflow: hidden;
  159. text-overflow: ellipsis;
  160. white-space: nowrap;
  161. }
  162. .bottom_item:nth-child(3n){
  163. margin-right: 0;
  164. }
  165. </style>