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

267 lines
6.7 KiB

5 years ago
5 years ago
5 years ago
  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 style="white-space: nowrap">{{ 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. name: '最新'
  66. }
  67. },
  68. onLoad(options){
  69. console.log(this.filter)
  70. this.name = options.name || this.name;
  71. },
  72. methods: {
  73. // 引入数据,并序列化,避免数据引用
  74. productionObj(){
  75. return JSON.parse( JSON.stringify(filterObj) );
  76. },
  77. // 切换显示隐藏筛选
  78. switchFilter(key){
  79. if(this.filter_key != key){
  80. this.show_filter = true;
  81. }else{
  82. this.show_filter = !this.show_filter;
  83. }
  84. this.filter_key = key;
  85. },
  86. // 选中筛选条件
  87. activeItem(value){
  88. this.filter[this.filter_key].selected = value;
  89. // TODO 接口请求
  90. },
  91. // 切换筛选条件
  92. switchCondition(key, value){
  93. this.filter[this.filter_key][key].selected = value;
  94. },
  95. // 输入框失去焦点事件
  96. inputBlur(key, event){
  97. this.filter[this.filter_key][key] = event.detail.value;
  98. },
  99. // 重置筛选条件
  100. reset(){
  101. this.filter = this.productionObj();
  102. this.show_filter = false;
  103. },
  104. // 确定筛选
  105. comfirm(){
  106. this.$msg('筛选成功!');
  107. this.show_filter = false;
  108. console.log(this.filter);
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped="scoped">
  114. .head{
  115. width: 750rpx;
  116. height: 102rpx;
  117. border-bottom: 1rpx solid #e5e5e5;
  118. position: fixed;
  119. background-color: #FFFFFF;
  120. z-index: 9;
  121. display: flex;
  122. justify-content: space-between;
  123. align-items: center;
  124. padding: 0 32rpx;
  125. box-sizing: border-box;
  126. .sign-in-btn{
  127. margin: 0;
  128. width: 140rpx;
  129. height: 62rpx;
  130. background-color: #FCF7FA;
  131. border: 1rpx solid #E21196;
  132. border-radius: 10rpx;
  133. font-size: 28rpx;
  134. color: #E21196;
  135. line-height: 60rpx;
  136. }
  137. .filter-item{
  138. width: 114rpx;
  139. height: 62rpx;
  140. // line-height: 62rpx;
  141. // text-align: right;
  142. display: flex;
  143. flex-wrap: nowrap;
  144. justify-content: center;
  145. align-items: center;
  146. font-size: 28rpx;
  147. color: #222222;
  148. .tab-active{
  149. display: inline-block;
  150. transform: rotate(180deg);
  151. color: #E21196 !important;
  152. }
  153. }
  154. .filter-modal{
  155. position: absolute;
  156. z-index: 7;
  157. background-color: rgba(0,0,0,0.5);
  158. top: 103rpx;
  159. right: 0;
  160. bottom: 0;
  161. left: 0;
  162. width: 100vw;
  163. height: calc(100vh - 103rpx);
  164. .filter-content{
  165. position: absolute;
  166. width: 100%;
  167. height: 300rpx;
  168. background-color: #FFFFFF;
  169. left: 0;
  170. z-index: 14;
  171. overflow-y: scroll;
  172. padding: 0 0 32rpx 32rpx;
  173. display: flex;
  174. flex-direction: column;
  175. justify-content: space-evenly;
  176. view{
  177. height: 60rpx;
  178. // border-bottom: 1rpx solid #e5e5e5;
  179. padding: 20rpx 0;
  180. line-height: 60rpx;
  181. }
  182. }
  183. .filter-many{
  184. position: absolute;
  185. width: 100%;
  186. height: 806rpx;
  187. background-color: #FFFFFF;
  188. left: 0;
  189. z-index: 14;
  190. .filter-main{
  191. height: 675rpx;
  192. overflow-y: scroll;
  193. box-sizing: border-box;
  194. padding: 32rpx;
  195. .filter-title{
  196. font-size: 28rpx;
  197. color: #222222;
  198. font-weight: bold;
  199. margin-bottom: 20rpx;
  200. }
  201. .filter-capsule{
  202. width: 163rpx;
  203. height: 62rpx;
  204. border-radius: 31rpx;
  205. border: 1rpx solid #999999;
  206. font-size: 20rpx;
  207. color: #999999;
  208. text-align: center;
  209. line-height: 62rpx;
  210. margin-right: 12rpx;
  211. &:nth-child(4n){
  212. margin-right: 0rpx;
  213. }
  214. &:nth-child(n+5){
  215. margin-top: 12rpx;
  216. }
  217. }
  218. .filter-active{
  219. border-color: #E21196;
  220. color: #E21196;
  221. }
  222. .input-search{
  223. width: 686rpx;
  224. height: 62rpx;
  225. background-color: #FFFFFF;
  226. border-radius: 10rpx;
  227. border: 1rpx solid #DDDDDD;
  228. box-sizing: border-box;
  229. padding: 0 15rpx;
  230. font-size: 28rpx;
  231. margin-bottom: 50rpx;
  232. }
  233. }
  234. .filter-main>view:nth-child(n+3){
  235. margin-top: 40rpx;
  236. }
  237. .filter-foot{
  238. height: 130rpx;
  239. border-top: 1rpx solid #e5e5e5;
  240. padding: 32rpx;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. .filter-btn{
  245. width: 332rpx;
  246. height: 90rpx;
  247. border-radius: 10rpx;
  248. border: 1rpx solid #555555;
  249. background-color: #FFFFFF;
  250. line-height: 88rpx;
  251. font-size: 32rpx;
  252. color: #555555;
  253. margin: 0;
  254. }
  255. .solid-btn{
  256. background-color: #E21196;
  257. color: #FFFFFF;
  258. border: none;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. </style>