金诚优选前端代码
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.

182 lines
4.8 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="搜索" :showIcon="true" @changeHeight="e => nav_height = e"></lf-nav>
  4. <view class="head">
  5. <u-search placeholder="请输入商品名或商户名" action-text="取消" v-model="value" @custom="customClick"></u-search>
  6. </view>
  7. <view>
  8. <u-tabs :list="tab_list" active-color="#15716E" inactive-color='#777777' :is-scroll="false" :current="tab_current" @change="tabChange"></u-tabs>
  9. </view>
  10. <swiper :current="tab_current" @change="swiperChange" :style="{height: autoHeight}">
  11. <swiper-item v-for="(tab_item, tab_index) in tab_list" :key="tab_index">
  12. <scroll-view :scroll-y="true" :style="{height: autoHeight}">
  13. <view class="scroll-content" v-if="tab_index == 0">
  14. <lf-waterfall :list="goods_list"></lf-waterfall>
  15. </view>
  16. <view class="scroll-content" v-else>
  17. <view class="shop-box" v-for="(item, index) in 3" :key="index">
  18. <image class="shop-img"></image>
  19. <view class="shop-info">
  20. <view class="lf-line-1">luckin coffee 瑞幸咖啡</view>
  21. <view>餐饮·美食</view>
  22. </view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. </swiper-item>
  27. </swiper>
  28. </view>
  29. </template>
  30. <script>
  31. import lfWaterfall from '@/components/lf-waterfall-shopdetails/lf-waterfall.vue';
  32. export default {
  33. components: {
  34. lfWaterfall
  35. },
  36. data() {
  37. return {
  38. value: '',
  39. tab_current: 0,
  40. tab_list: [{
  41. name: '商品(8)'
  42. },{
  43. name: '商户(1)'
  44. }],
  45. scrollH: 0,
  46. nav_height: 0,
  47. goods_list: [
  48. {
  49. id: 10,
  50. original_price: "4111.00",
  51. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  52. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  53. price: "2412.00",
  54. product_id: 1008,
  55. sale: 0,
  56. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  57. },
  58. {
  59. id: 10,
  60. original_price: "4111.00",
  61. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  62. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  63. price: "2412.00",
  64. product_id: 1008,
  65. sale: 0,
  66. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  67. },
  68. {
  69. id: 10,
  70. original_price: "4111.00",
  71. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  72. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  73. price: "2412.00",
  74. product_id: 1008,
  75. sale: 0,
  76. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  77. },
  78. {
  79. id: 10,
  80. original_price: "4111.00",
  81. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  82. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  83. price: "2412.00",
  84. product_id: 1008,
  85. sale: 0,
  86. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  87. }
  88. ]
  89. }
  90. },
  91. computed: {
  92. autoHeight(){
  93. return `calc(${this.scrollH}px - ${this.nav_height}px - 124rpx - 86rpx)`;
  94. }
  95. },
  96. onLoad(options){
  97. let info = uni.getSystemInfoSync();
  98. this.scrollH = info.screenHeight;
  99. this.value = options.value || '';
  100. },
  101. methods: {
  102. customClick(){
  103. this.$toBack();
  104. },
  105. tabChange(event){
  106. this.tab_current = event;
  107. },
  108. swiperChange(event){
  109. this.tab_current = event.detail.current;
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .head{
  116. padding: 30rpx 32rpx;
  117. }
  118. .scroll-content{
  119. padding: 30rpx 32rpx;
  120. }
  121. .shop-box{
  122. width: 100%;
  123. height: 100rpx;
  124. display: flex;
  125. &:nth-child(n+2){
  126. margin-top: 60rpx;
  127. }
  128. .shop-img{
  129. width: 100rpx;
  130. height: 100rpx;
  131. background-color: #EEEEEE;
  132. border-radius: 5rpx;
  133. margin-right: 15rpx;
  134. }
  135. .shop-info{
  136. width: 570rpx;
  137. height: 100rpx;
  138. display: flex;
  139. flex-direction: column;
  140. justify-content: space-between;
  141. &>view:nth-child(1){
  142. font-size: 36rpx;
  143. color: #222222;
  144. font-weight: bold;
  145. }
  146. &>view:nth-child(2){
  147. font-size: 24rpx;
  148. color: #777777;
  149. }
  150. }
  151. }
  152. // tabs 样式修改
  153. /deep/.u-scroll-box {
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  158. }
  159. /deep/.u-scroll-box .u-tab-bar {
  160. background-color: #15716E!important;
  161. width: 80rpx!important;
  162. position: absolute;
  163. left: 0;
  164. bottom: -12rpx;
  165. }
  166. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  167. background-color: #15716E!important;
  168. width: 56rpx!important;
  169. position: absolute;
  170. height: 5rpx!important;
  171. left: 8rpx;
  172. bottom: -4rpx;
  173. }
  174. /deep/ .u-tab-item {
  175. font-size: 28rpx!important;
  176. }
  177. </style>