index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div>
  3. <form
  4. class="fbt-form"
  5. action="/">
  6. <van-search
  7. v-model="searchValue"
  8. show-action
  9. :shape="'round'"
  10. placeholder="搜索商品标题 领优惠券拿返现"
  11. @search="onSearch">
  12. <template #action>
  13. <div
  14. class="btn"
  15. @click="onSearch">搜索
  16. </div>
  17. </template>
  18. </van-search>
  19. </form>
  20. <!--商家-->
  21. <div
  22. class="business-list">
  23. <van-tabs
  24. v-model="businessValue"
  25. :color="'#F09E38'"
  26. :title-active-color="'#333333'"
  27. :title-inactive-color="'#515151'"
  28. :background="'#fff'"
  29. @click="fetchGoodsList"
  30. ref="fbtCateList">
  31. <van-tab
  32. :name="item.value"
  33. v-for="item in sourceList"
  34. :key="item.value">
  35. <template #title>选项</template>
  36. </van-tab>
  37. </van-tabs>
  38. </div>
  39. <ul class="filter-wrap border-top-1px">
  40. <li
  41. :class="{'active': condition === item.value}"
  42. v-for="item in filterList"
  43. :key="item.value"
  44. @click="condition = item.value">选项
  45. </li>
  46. <li
  47. @click="showType = showType === 1 ? 2 : 1">
  48. <span
  49. :class="['shopfont', showType === 1 ? 'shopfont-liebiao' : 'shopfont-shuangliebiao']"></span>
  50. </li>
  51. </ul>
  52. </div>
  53. </template>
  54. <script>
  55. import { Search, Tabs, Tab } from 'vant'
  56. export default {
  57. name: 'index',
  58. components: {
  59. 'van-search': Search,
  60. 'van-tabs': Tabs,
  61. 'van-tab': Tab
  62. },
  63. data () {
  64. return {
  65. searchValue: '',
  66. sourceList: [
  67. {
  68. name: '京东',
  69. value: 'jd'
  70. },
  71. {
  72. name: '唯品会',
  73. value: 'vip'
  74. },
  75. {
  76. name: '拼多多',
  77. value: 'pdd'
  78. },
  79. {
  80. name: '考拉',
  81. value: 'kaola'
  82. },
  83. {
  84. name: '淘宝',
  85. value: 'taobao'
  86. }
  87. ], // 商家列表
  88. // 1-综合排序,2-价格升序,3-销量降序 默认1
  89. filterList: [
  90. {
  91. name: '综合',
  92. value: 1
  93. },
  94. {
  95. name: '销量',
  96. value: 2
  97. },
  98. {
  99. name: '价格',
  100. value: 3
  101. }
  102. ],
  103. businessValue: 'jd',
  104. condition: 1,
  105. showType: 1 // 列表展示方式
  106. }
  107. },
  108. activated () {
  109. if (!this.$route.meta.isUseCache) {
  110. } else {}
  111. setTimeout(() => {
  112. this.$refs.fbtCateList.resize()
  113. }, 500)
  114. this.$route.meta.isUseCache = false
  115. },
  116. methods: {
  117. onSearch (val) {
  118. console.log(val)
  119. },
  120. fetchGoodsList () {}
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .fbt-form {
  126. ::v-deep .van-search {
  127. padding-bottom: 0;
  128. .van-cell {
  129. align-items: center;
  130. input {
  131. color: #333;
  132. -webkit-text-fill-color: #333;
  133. opacity: 1;
  134. &::-webkit-input-placeholder {
  135. -webkit-text-fill-color: #999;
  136. opacity: 1;
  137. color: #999;
  138. }
  139. }
  140. }
  141. }
  142. .btn {
  143. font-size: 16px;
  144. color: #333;
  145. }
  146. }
  147. .cate-header {
  148. position: relative;
  149. left: 0;
  150. top: 0;
  151. width: 100%;
  152. ::v-deep .van-tabs {
  153. width: calc(100% - 42px);
  154. .van-tabs__nav--line {
  155. .van-tab {
  156. &--active {
  157. .van-tab__text {
  158. font-size: 16px !important;
  159. font-weight: bold;
  160. }
  161. }
  162. .van-tab__text {
  163. font-size: 13px;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. .filter-wrap {
  170. display: flex;
  171. align-items: center;
  172. background: #fff;
  173. @include border-top-1px(#eee);
  174. li {
  175. flex: 1;
  176. line-height: 40px;
  177. font-size: 14px;
  178. color: #999;
  179. text-align: center;
  180. &.active {
  181. font-weight: bolder;
  182. color: #333;
  183. }
  184. }
  185. }
  186. </style>