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

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