详情小程序
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.

257 lines
6.3 KiB

  1. <template>
  2. <view>
  3. <view class="head">
  4. <button class="sign-in-btn">最新</button>
  5. <!-- tabs -->
  6. <view class="filter-item" v-for="(value, key) in filter" :key="key" @click="switchFilter(key)">
  7. <text>{{ value.selected || value.name }}</text>
  8. <text class="lf-iconfont icon-iconfront-" :class="{'tab-active': show_filter && filter_key == key}"></text>
  9. </view>
  10. <!-- 普通列表文字选择 -->
  11. <view class="filter-modal" v-if="show_filter && filter_key != 'search'" @click="show_filter = false">
  12. <view class="filter-content">
  13. <view v-for="(item, index) in filter[filter_key].data" :key="index" @click="activeItem(item.value)">{{ item.value }}</view>
  14. </view>
  15. </view>
  16. <!-- 多条件搜索 -->
  17. <view class="filter-modal" v-else-if="show_filter && filter_key == 'search'" @click="show_filter = false">
  18. <view class="filter-many" @click.stop>
  19. <view class="filter-main">
  20. <view v-for="(value, key) in filter[filter_key]" :key="key" v-if="key != 'name'">
  21. <block v-if="key == 'search_value'">
  22. <view class="filter-title">会员编号搜索</view>
  23. <input class="input-search" placeholder="请输入会员编号" :value="value" @blur="inputBlur(key, $event)" />
  24. </block>
  25. <block v-else>
  26. <view class="filter-title">{{ value.name }}</view>
  27. <view class="lf-flex-wrap">
  28. <view class="filter-capsule"
  29. :class="{'filter-active': item.value == value.selected}"
  30. v-for="(item, index) in value.data" :key="index"
  31. @click="switchCondition(key, item.value)"
  32. >{{ item.value }}</view>
  33. </view>
  34. </block>
  35. </view>
  36. </view>
  37. <view class="filter-foot">
  38. <button class="filter-btn" @click="reset">重置条件</button>
  39. <button class="filter-btn solid-btn" @click="comfirm">确定</button>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- head end -->
  45. <view style="height: 104rpx;"></view>
  46. <lf-user-list></lf-user-list>
  47. <!-- 加载 -->
  48. <view class="loading-more">
  49. <text>没有更多数据啦~</text>
  50. </view>
  51. <!-- 回到顶部 -->
  52. <u-back-top :scrollTop="pageScrollTop"></u-back-top>
  53. </view>
  54. </template>
  55. <script>
  56. import lfUserList from '@/components/lf-userList/lf-userList.vue'
  57. var filterObj = require('./filter.json');
  58. export default {
  59. components: { lfUserList },
  60. data(){
  61. return {
  62. show_filter: false,
  63. filter: this.productionObj(),
  64. filter_key: ''
  65. }
  66. },
  67. onLoad(){
  68. console.log(this.filter)
  69. },
  70. methods: {
  71. // 引入数据,并序列化,避免数据引用
  72. productionObj(){
  73. return JSON.parse( JSON.stringify(filterObj) );
  74. },
  75. // 切换显示隐藏筛选
  76. switchFilter(key){
  77. if(this.filter_key != key){
  78. this.show_filter = true;
  79. }else{
  80. this.show_filter = !this.show_filter;
  81. }
  82. this.filter_key = key;
  83. },
  84. // 选中筛选条件
  85. activeItem(value){
  86. this.filter[this.filter_key].selected = value;
  87. // TODO 接口请求
  88. },
  89. // 切换筛选条件
  90. switchCondition(key, value){
  91. this.filter[this.filter_key][key].selected = value;
  92. },
  93. // 输入框失去焦点事件
  94. inputBlur(key, event){
  95. this.filter[this.filter_key][key] = event.detail.value;
  96. },
  97. // 重置筛选条件
  98. reset(){
  99. this.filter = this.productionObj();
  100. this.show_filter = false;
  101. },
  102. // 确定筛选
  103. comfirm(){
  104. this.$msg('筛选成功!');
  105. this.show_filter = false;
  106. console.log(this.filter);
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss" scoped="scoped">
  112. .head{
  113. width: 750rpx;
  114. height: 102rpx;
  115. border-bottom: 1rpx solid #e5e5e5;
  116. position: fixed;
  117. background-color: #FFFFFF;
  118. z-index: 9;
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. padding: 0 32rpx;
  123. box-sizing: border-box;
  124. .sign-in-btn{
  125. margin: 0;
  126. width: 140rpx;
  127. height: 62rpx;
  128. background-color: #FCF7FA;
  129. border: 1rpx solid #E21196;
  130. border-radius: 10rpx;
  131. font-size: 28rpx;
  132. color: #E21196;
  133. line-height: 60rpx;
  134. }
  135. .filter-item{
  136. width: 100rpx;
  137. height: 62rpx;
  138. line-height: 62rpx;
  139. text-align: right;
  140. font-size: 28rpx;
  141. color: #222222;
  142. .tab-active{
  143. display: inline-block;
  144. transform: rotate(180deg);
  145. color: #E21196 !important;
  146. }
  147. }
  148. .filter-modal{
  149. position: absolute;
  150. z-index: 7;
  151. background-color: rgba(0,0,0,0.5);
  152. top: 103rpx;
  153. right: 0;
  154. bottom: 0;
  155. left: 0;
  156. width: 100vw;
  157. height: calc(100vh - 103rpx);
  158. .filter-content{
  159. position: absolute;
  160. width: 100%;
  161. height: 300rpx;
  162. background-color: #FFFFFF;
  163. left: 0;
  164. z-index: 14;
  165. overflow-y: scroll;
  166. padding-left: 32rpx;
  167. view{
  168. height: 60rpx;
  169. border-bottom: 1rpx solid #e5e5e5;
  170. line-height: 60rpx;
  171. }
  172. }
  173. .filter-many{
  174. position: absolute;
  175. width: 100%;
  176. height: 806rpx;
  177. background-color: #FFFFFF;
  178. left: 0;
  179. z-index: 14;
  180. .filter-main{
  181. height: 675rpx;
  182. overflow-y: scroll;
  183. box-sizing: border-box;
  184. padding: 32rpx;
  185. .filter-title{
  186. font-size: 28rpx;
  187. color: #222222;
  188. font-weight: bold;
  189. margin-bottom: 20rpx;
  190. }
  191. .filter-capsule{
  192. width: 163rpx;
  193. height: 62rpx;
  194. border-radius: 31rpx;
  195. border: 1rpx solid #999999;
  196. font-size: 28rpx;
  197. color: #999999;
  198. text-align: center;
  199. line-height: 62rpx;
  200. margin-right: 12rpx;
  201. &:nth-child(4n){
  202. margin-right: 0rpx;
  203. }
  204. &:nth-child(n+5){
  205. margin-top: 12rpx;
  206. }
  207. }
  208. .filter-active{
  209. border-color: #E21196;
  210. color: #E21196;
  211. }
  212. .input-search{
  213. width: 686rpx;
  214. height: 62rpx;
  215. background-color: #FFFFFF;
  216. border-radius: 10rpx;
  217. border: 1rpx solid #DDDDDD;
  218. box-sizing: border-box;
  219. padding: 0 15rpx;
  220. font-size: 28rpx;
  221. margin-bottom: 50rpx;
  222. }
  223. }
  224. .filter-main>view:nth-child(n+3){
  225. margin-top: 40rpx;
  226. }
  227. .filter-foot{
  228. height: 130rpx;
  229. border-top: 1rpx solid #e5e5e5;
  230. padding: 32rpx;
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. .filter-btn{
  235. width: 332rpx;
  236. height: 90rpx;
  237. border-radius: 10rpx;
  238. border: 1rpx solid #555555;
  239. background-color: #FFFFFF;
  240. line-height: 88rpx;
  241. font-size: 32rpx;
  242. color: #555555;
  243. margin: 0;
  244. }
  245. .solid-btn{
  246. background-color: #E21196;
  247. color: #FFFFFF;
  248. border: none;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. </style>