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

259 lines
6.4 KiB

  1. <template>
  2. <view>
  3. <view class="head">
  4. <button class="sign-in-btn">{{ name }}</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. 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: 100rpx;
  139. height: 62rpx;
  140. line-height: 62rpx;
  141. text-align: right;
  142. font-size: 28rpx;
  143. color: #222222;
  144. .tab-active{
  145. display: inline-block;
  146. transform: rotate(180deg);
  147. color: #E21196 !important;
  148. }
  149. }
  150. .filter-modal{
  151. position: absolute;
  152. z-index: 7;
  153. background-color: rgba(0,0,0,0.5);
  154. top: 103rpx;
  155. right: 0;
  156. bottom: 0;
  157. left: 0;
  158. width: 100vw;
  159. height: calc(100vh - 103rpx);
  160. .filter-content{
  161. position: absolute;
  162. width: 100%;
  163. height: 300rpx;
  164. background-color: #FFFFFF;
  165. left: 0;
  166. z-index: 14;
  167. overflow-y: scroll;
  168. padding-left: 32rpx;
  169. view{
  170. height: 60rpx;
  171. border-bottom: 1rpx solid #e5e5e5;
  172. line-height: 60rpx;
  173. }
  174. }
  175. .filter-many{
  176. position: absolute;
  177. width: 100%;
  178. height: 806rpx;
  179. background-color: #FFFFFF;
  180. left: 0;
  181. z-index: 14;
  182. .filter-main{
  183. height: 675rpx;
  184. overflow-y: scroll;
  185. box-sizing: border-box;
  186. padding: 32rpx;
  187. .filter-title{
  188. font-size: 28rpx;
  189. color: #222222;
  190. font-weight: bold;
  191. margin-bottom: 20rpx;
  192. }
  193. .filter-capsule{
  194. width: 163rpx;
  195. height: 62rpx;
  196. border-radius: 31rpx;
  197. border: 1rpx solid #999999;
  198. font-size: 20rpx;
  199. color: #999999;
  200. text-align: center;
  201. line-height: 62rpx;
  202. margin-right: 12rpx;
  203. &:nth-child(4n){
  204. margin-right: 0rpx;
  205. }
  206. &:nth-child(n+5){
  207. margin-top: 12rpx;
  208. }
  209. }
  210. .filter-active{
  211. border-color: #E21196;
  212. color: #E21196;
  213. }
  214. .input-search{
  215. width: 686rpx;
  216. height: 62rpx;
  217. background-color: #FFFFFF;
  218. border-radius: 10rpx;
  219. border: 1rpx solid #DDDDDD;
  220. box-sizing: border-box;
  221. padding: 0 15rpx;
  222. font-size: 28rpx;
  223. margin-bottom: 50rpx;
  224. }
  225. }
  226. .filter-main>view:nth-child(n+3){
  227. margin-top: 40rpx;
  228. }
  229. .filter-foot{
  230. height: 130rpx;
  231. border-top: 1rpx solid #e5e5e5;
  232. padding: 32rpx;
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. .filter-btn{
  237. width: 332rpx;
  238. height: 90rpx;
  239. border-radius: 10rpx;
  240. border: 1rpx solid #555555;
  241. background-color: #FFFFFF;
  242. line-height: 88rpx;
  243. font-size: 32rpx;
  244. color: #555555;
  245. margin: 0;
  246. }
  247. .solid-btn{
  248. background-color: #E21196;
  249. color: #FFFFFF;
  250. border: none;
  251. }
  252. }
  253. }
  254. }
  255. }
  256. </style>